Changes for page Your First Rest Project

Last modified by Steve Peery on 2013/09/06 11:02

From version 50.1
edited by Steve Peery
on 2023/11/13 11:54
Change comment: Renamed back-links.
To version 45.1
edited by skcodes
on 2013/05/13 12:53
Change comment: There is no comment for this version

Summary

Details

Page properties
Parent
... ... @@ -1,1 +1,0 @@
1 -Getting Started
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.speery
1 +XWiki.skcodes
Tags
... ... @@ -1,1 +1,0 @@
1 -tutorials
Content
... ... @@ -1,4 +1,4 @@
1 -{{toc/}}
1 +{{toc}}{{/toc}}
2 2  
3 3  = Introduction =
4 4  
... ... @@ -10,7 +10,7 @@
10 10  
11 11  = Create a new project =
12 12  
13 -You will need to create a new project for this tutorial. In Eclipse, open the **File** menu, select **New** and select **Wonder REST Application** (or **ERRest Application**, according to //your// WOLips version). Name your project as //BlogRest//.
13 +You will need to create a new project for this tutorial. In Eclipse, open the **File** menu, select **New** and select **Wonder REST Application**. Name your project as //BlogRest//.
14 14  
15 15  = Create the database model =
16 16  
... ... @@ -20,93 +20,21 @@
20 20  
21 21  BlogEntry will have the following columns:
22 22  
23 -|=(((
24 -Column name
25 -)))|=(((
26 -Type
27 -)))|=(((
28 -Constraints
29 -)))
30 -|(((
31 -id
32 -)))|(((
33 -integer
34 -)))|(((
35 -primary key
36 -)))
37 -|(((
38 -title
39 -)))|(((
40 -string(255)
41 -)))|(((
42 -
43 -)))
44 -|(((
45 -content
46 -)))|(((
47 -string(4000)
48 -)))|(((
49 -
50 -)))
51 -|(((
52 -creationDate
53 -)))|(((
54 -timestamp
55 -)))|(((
56 -
57 -)))
58 -|(((
59 -lastModified
60 -)))|(((
61 -timestamp
62 -)))|(((
63 -
64 -)))
65 -|(((
66 -author
67 -)))|(((
68 -integer
69 -)))|(((
70 -relation with Author
71 -)))
23 +|= Column name |= Type |= Constraints
24 +| id | integer | primary key
25 +| title | string(255) |
26 +| content | string(4000) |
27 +| creationDate | timestamp |
28 +| lastModified | timestamp |
29 +| author | integer | relation with Author
72 72  
73 73  Author will have the following columns:
74 74  
75 -|=(((
76 -Column name
77 -)))|=(((
78 -Type
79 -)))|=(((
80 -Constraints
81 -)))
82 -|(((
83 -id
84 -)))|(((
85 -integer
86 -)))|(((
87 -primary key
88 -)))
89 -|(((
90 -firstName
91 -)))|(((
92 -string(50)
93 -)))|(((
94 -
95 -)))
96 -|(((
97 -lastName
98 -)))|(((
99 -string(50)
100 -)))|(((
101 -
102 -)))
103 -|(((
104 -email
105 -)))|(((
106 -string(100)
107 -)))|(((
108 -unique
109 -)))
33 +|= Column name |= Type |= Constraints
34 +| id | integer | primary key
35 +| firstName | string(50) |
36 +| lastName | string(50) |
37 +| email | string(100) | unique
110 110  
111 111  == Creating the EOModel ==
112 112  
... ... @@ -114,34 +114,16 @@
114 114  
115 115  An EOModel consists of entities, attributes and relationships. When using it in a RDBMS context, an entity is a table (or a view), an attribute is a table column and a relationship is a join between two tables.
116 116  
117 -To create the EOModel, in the project right-click on the project name and select **New** -> **EOModel**.
45 +To create the EOModel, in the project right-click on the project name and select **New** > **EOModel**.
118 118  
119 119  Name it **BlogModel** and in the plugin list, select **H2**. Click **Finish**.
120 120  
121 121  The model should show up in a window that looks like this:
122 122  
123 -[[image:attach:EOModeler.png]]
124 -
125 125  If it didn't show up, the window might have opened behind the main Eclipse window. If that's the case, open the **Window** menu and select the windows that have //Entity Modeler// in its name.
126 126  
127 -In the Entity Modeler window, click on **Default**, and for the **URL** field, type
53 +In the Entity Modeler window, click on **Default**, and for the **URL** field, type {{code}}jdbc:h2:~/BlogTutorial{{/code}}. When the database will be created, it will be stored in your home directory (/Users/youruser/ on OS X).
128 128  
129 -{{code}}
130 -jdbc:h2:~/BlogTutorial
131 -{{/code}}
132 -
133 -. When the database will be created, it will be stored in your home directory (/Users/youruser/ on OS X).
134 -
135 -You can also specify an absolute path where to store in you h2 database files. For example on Windows OS **URL** field can be like this:
136 -
137 -{{code}}
138 -jdbc:h2:C:/Users/ ... /BlogTutorial
139 -{{/code}}
140 -
141 -//Notice, in the path, *nix like file separator "/" instead of Windows like// "\" (as you can read [[here>>url:http://www.h2database.com/html/faq.html||shape="rect"]]).
142 -
143 -
144 -
145 145  Now, right-click on **BlogModel** and select **New Entity**.
146 146  
147 147  Type the following details in the **Basic** tab:
... ... @@ -162,97 +162,36 @@
162 162  
163 163  Now, repeat the last two steps to create the other attributes for the **BlogEntry** entity, with the following values:
164 164  
165 -|=(((
166 -Attribute name
167 -)))|=(((
168 -Column
169 -)))|=(((
170 -Prototype
171 -)))
172 -|(((
173 -content
174 -)))|(((
175 -content
176 -)))|(((
177 -longtext
178 -)))
179 -|(((
180 -creationDate
181 -)))|(((
182 -creationDate
183 -)))|(((
184 -dateTime
185 -)))
186 -|(((
187 -lastModified
188 -)))|(((
189 -lastModified
190 -)))|(((
191 -dateTime
192 -)))
75 +|= Attribute name |= Column |= Prototype
76 +| content | content | longtext
77 +| creationDate | creationDate | dateTime
78 +| lastModified | lastModified | dateTime
193 193  
194 194  If you did everything well, the list of attributes should look like this:
195 195  
196 -[[image:attach:list_wlock.png]]
197 -
198 198  You will notice that the attributes have a column with a lock in it. When a lock is present, it will use the value of that attribute for //UPDATE ... WHERE attribute = ''// statement. This is to do optimistic locking, aka to prevent data conflict when the data object was modified by two different users. Using timestamps for optimistic locking is not a good idea because for certain RDBMS, the value can be different because of milliseconds, so remove the locks on the **creationDate** attribute. The final list should look like this:
199 199  
200 -[[image:attach:list.png]]
201 -
202 202  Next step is to create the **Author** entity. Create a new entity with **Author** at its name (and also as the table name), and for the class name, use **your.app.model.Author**. The attributes for this entity are:
203 203  
204 -|=(((
205 -Attribute name
206 -)))|=(((
207 -Column
208 -)))|=(((
209 -Prototype
210 -)))
211 -|(((
212 -firstName
213 -)))|(((
214 -firstName
215 -)))|(((
216 -varchar50
217 -)))
218 -|(((
219 -lastName
220 -)))|(((
221 -lastName
222 -)))|(((
223 -varchar50
224 -)))
225 -|(((
226 -email
227 -)))|(((
228 -email
229 -)))|(((
230 -varchar100
231 -)))
86 +|= Attribute name |= Column |= Prototype
87 +| firstName | firstName | varchar50
88 +| lastName | lastName | varchar50
89 +| email | email | varchar100
232 232  
233 233  Final list of attributes should look like this:
234 234  
235 -[[image:attach:author_list.png]]
236 -
237 237  Now, it's time to link the two entities together. An Author can have multiple blog entries, and a BlogEntry can only have one author. To create the relationship (the join), right-click on **Author** and select **New Relationship**. On your right, select **BlogEntry** in the list. On your left, select **to many BlogEntries**, and on your right, select **to one Author**. Now, in BlogEntry, we need to store the primary key of the author so that we can make the join. The relationship builder allow us to add that attribute, so make sure **and a new foreign key named** is checked (it is checked by default). The **Create Relationship** pane should look like this:
238 238  
239 -[[image:attach:relationship.png]]
240 -
241 241  If you check in the **Outline** tab, you should see that **Author** now have a **blogEntries** relationship, and **BlogEntry** have a **author** relationship.
242 242  
243 -[[image:attach:outline_tab.png]]
97 +You are now ready to save the model. Save it (File > Save) and close the **Entity Modeler** window. If you open the **Sources** in the main Eclipse window, you will notice that the **Sources** folder contains a package named **your.app.model**. (If this folder doesn't appear, you may need to set your preferences to automatically generate these source files; see the second suggestion on http:~/~/wiki.wocommunity.org/display/documentation/Useful+Eclipse+or+WOLips+Preferences.)
244 244  
245 -You are now ready to save the model. Save it (File -> Save) and close the **Entity Modeler** window. If you open the **Sources** in the main Eclipse window, you will notice that the **Sources** folder contains a package named **your.app.model**. (If this folder doesn't appear, you may need to set your preferences to automatically generate these source files; see the second suggestion on [[http:~~/~~/wiki.wocommunity.org/display/documentation/Useful+Eclipse+or+WOLips+Preferences>>url:http://wiki.wocommunity.org/display/documentation/Useful+Eclipse+or+WOLips+Preferences||rel="nofollow" shape="rect" class="external-link"]].)
99 +That package have four Java classes: **Author**, **Author**, **BlogEntry** and **BlogEntry**. Those classes were generated by Veogen, a templating engine build on Velocity. The two classes that starts with a underscore are recreated every time you change the EOModel, so if you want to change something in those classes, you need to change the template (no need for that right now). But you can change freely the two classes that don't have the underscore, and this is what we will be doing.
246 246  
247 -
248 -
249 -That package have four Java classes: **_Author**, **Author**, **_BlogEntry** and **BlogEntry**. Those classes were generated by Veogen, a templating engine build on Velocity. The two classes that starts with a underscore are recreated every time you change the EOModel, so if you want to change something in those classes, you need to change the template (no need for that right now). But you can change freely the two classes that don't have the underscore, and this is what we will be doing.
250 -
251 -
252 -
253 253  What we are going to do is to write a simple method that returns the full name of an author, e.g. a method that simply concatenate the first name, a space and the last name of the author. To do so, double-click on **Author.java** and add the following methods:
254 254  
255 255  {{code}}
104 +
256 256  public String fullName() {
257 257   return this.firstName() + " " + this.lastName();
258 258   }
... ... @@ -262,6 +262,7 @@
262 262  Nothing fancy here. Now open **BlogEntry.java** and add the following method:
263 263  
264 264  {{code}}
114 +
265 265   @Override
266 266   public void awakeFromInsertion(EOEditingContext editingContext) {
267 267   super.awakeFromInsertion(editingContext);
... ... @@ -291,6 +291,7 @@
291 291  Remove the pound char in front of those two properties:
292 292  
293 293  {{code}}
144 +
294 294  #er.migration.migrateAtStartup=true
295 295  #er.migration.createTablesIfNecessary=true
296 296  
... ... @@ -299,14 +299,16 @@
299 299  After removing the pound char, the two properties should look like this:
300 300  
301 301  {{code}}
153 +
302 302  er.migration.migrateAtStartup=true
303 303  er.migration.createTablesIfNecessary=true
304 304  
305 305  {{/code}}
306 306  
307 -You are now ready to start the application so that it creates the database! To do so, right-click on **Application.java** (in the **your.app** folder) and select **Run As** -> **WOApplication**. In Eclipse's Console tab, you should see some output, including something similar to:
159 +You are now ready to start the application so that it creates the database To do so, right-click on **Application.java** (in the **your.app** folder) and select **Run As** > **WOApplication**. In Eclipse's Console tab, you should see some output, including something similar to:
308 308  
309 309  {{code}}
162 +
310 310  BlogRest[62990] INFO er.extensions.migration.ERXMigrator - Upgrading BlogModel to version 0 with migration 'your.app.model.migrations.BlogModel0@4743bf3d'
311 311  BlogRest[62990] INFO er.extensions.jdbc.ERXJDBCUtilities - Executing CREATE TABLE Author(email VARCHAR(100) NOT NULL, firstName VARCHAR(50) NOT NULL, id INTEGER NOT NULL, lastName VARCHAR(50) NOT NULL)
312 312  BlogRest[62990] INFO er.extensions.jdbc.ERXJDBCUtilities - Executing ALTER TABLE Author ADD PRIMARY KEY (id)
... ... @@ -317,7 +317,7 @@
317 317  
318 318  {{/code}}
319 319  
320 -If you see this and that the application is running (it should open a window in your favorite browser), migration worked and your database have been created, congratulations! You can now stop the application (click the square red button in Eclipse's Console tab) and continue to the next step.
173 +If you see this and that the application is running (it should open a window in your favorite browser), migration worked and your database have been created, congratulations You can now stop the application (click the square red button in Eclipse's Console tab) and continue to the next step.
321 321  
322 322  = Creating REST controllers and routes =
323 323  
... ... @@ -354,14 +354,15 @@
354 354  * **indexAction**: to list all (or a sublist) of the objects.
355 355  
356 356  {{info}}
357 -In Project Wonder, **Action** at the end of a method is a convention for REST and Direct Actions, when you call those methods from certain components, you don't need to add the **Action** part.
210 +In Project Wonder, *Action* at the end of a method is a convention for REST and Direct Actions, when you call those methods from certain components, you don't need to add the *Action* part.
358 358  {{/info}}
359 359  
360 -For this tutorial, we will implement the **createAction** and **indexAction** methods. But first, we need to create a key filter. A key filter will... filter the input and the output of REST request so that you don't have to send all attributes for a blog entry. For example, we want to show the details for an author, but we don't want to show the password for the author (in real-life, the password would be encrypted)!
213 +For this tutorial, we will implement the **createAction** and **indexAction** methods. But first, we need to create a key filter. A key filter will... filter the input and the output of REST request so that you don't have to send all attributes for a blog entry. For example, we want to show the details for an author, but we don't want to show the password for the author (in real-life, the password would be encrypted)
361 361  
362 362  Add this method in **BlogEntryController**:
363 363  
364 364  {{code}}
218 +
365 365  protected ERXKeyFilter filter() {
366 366   ERXKeyFilter personFilter = ERXKeyFilter.filterWithAttributes();
367 367   personFilter.setAnonymousUpdateEnabled(true);
... ... @@ -378,6 +378,7 @@
378 378  Now, let's implement the **createAction** method:
379 379  
380 380  {{code}}
235 +
381 381  public WOActionResults createAction() throws Throwable {
382 382   BlogEntry entry = create(filter());
383 383   editingContext().saveChanges();
... ... @@ -391,6 +391,7 @@
391 391  Last step in the controller: implementing the **indexAction** method. Again, the code is simple:
392 392  
393 393  {{code}}
249 +
394 394  public WOActionResults indexAction() throws Throwable {
395 395   NSArray<BlogEntry> entries = BlogEntry.fetchAllBlogEntries(editingContext());
396 396   return response(entries, filter());
... ... @@ -407,6 +407,7 @@
407 407  A route in ERRest is simply a way to define the URL for the entities and to specify which controller the route should use. When your controller extends from **ERXDefaultRouteController**, it's easy to register a controller and a route. In **Application.java**, in the **Application** constructor, add the following code:
408 408  
409 409  {{code}}
266 +
410 410  ERXRouteRequestHandler restRequestHandler = new ERXRouteRequestHandler();
411 411   restRequestHandler.addDefaultRoutes(BlogEntry.ENTITY_NAME);
412 412   ERXRouteRequestHandler.register(restRequestHandler);
... ... @@ -416,13 +416,13 @@
416 416  
417 417  The **addDefaultRoutes** method do all of the required magic, and use convention. That's why we had to name the controller **BlogEntryController**, because the convention is <EntityName>Controller.
418 418  
419 -We are now reading to add and list blog postings! Start the application and take notice of the URL. It should be something like _[[http:~~/~~/yourip:someport/cgi-bin/WebObjects/BlogRest.woa_>>url:http://youripsomeport||shape="rect"]]
276 +We are now reading to add and list blog postings Start the application and take notice of the URL. It should be something like //[[http:~~/~~/yourip:someport/cgi-bin/WebObjects/BlogRest.woa>>http://yourip:someport/cgi-bin/WebObjects/BlogRest.woa_]]//
420 420  
421 421  == Adding posts and authors with curl ==
422 422  
423 423  Since we didn't implement any HTML for our REST routes, we will create blog entries with //curl//, an open source HTTP client that is bundled with Mac OS X (you can use another client, like wget, if you like too). So let's create a blog entry.
424 424  
425 -To create a blog entry, you need to use the POST HTTP method. We will use JSON as the format since it's a bit less chatty than XML. So if the URL to the application is //[[http:~~/~~/192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa_>>url:http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa_||shape="rect"]], the full _curl// command will be:
282 +To create a blog entry, you need to use the POST HTTP method. We will use JSON as the format since it's a bit less chatty than XML. So if the URL to the application is //[[http:~~/~~/192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa>>http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa_]], the full curl// command will be:
426 426  
427 427  {{code}}
428 428  curl -X POST -v -d '{ "title": "First post", "content": "Some text", "author": { "firstName": "Pascal", "lastName": "Robert", "email": "probert@macti.ca" } }' http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.json
... ... @@ -431,6 +431,7 @@
431 431  The response should look this:
432 432  
433 433  {{code}}
291 +
434 434  HTTP/1.0 201 Apple WebObjects
435 435  Content-Length: 249
436 436  x-webobjects-loadaverage: 0
... ... @@ -443,6 +443,7 @@
443 443  To get a list of blog entries:
444 444  
445 445  {{code}}
304 +
446 446  curl -X GET http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.json
447 447  
448 448  {{/code}}
... ... @@ -454,6 +454,7 @@
454 454  Now, let's build a HTML view for blog posts (you don't want your readers to get your posts by JSON, right?). Again, we will use convention to make it work easily. Open up **BlogEntryController** and add the following method:
455 455  
456 456  {{code}}
316 +
457 457  @Override
458 458   protected boolean isAutomaticHtmlRoutingEnabled() {
459 459   return true;
... ... @@ -461,11 +461,12 @@
461 461  
462 462  {{/code}}
463 463  
464 -Switching the return value of this method says that we will follow a certain convention for HTML components. The convention for automatic HTML routing is that the component should be named <EntityName><Action>Page.wo. So in our case, the component will be **BlogEntryIndexPage**. Right-click on the project name in Eclipse and select **New** -> **WOComponent**. Change the name to **BlogEntryIndexPage** and check the **Create HTML contents** button. Click **Finish**.
324 +Switching the return value of this method says that we will follow a certain convention for HTML components. The convention for automatic HTML routing is that the component should be named <EntityName><Action>Page.wo. So in our case, the component will be **BlogEntryIndexPage**. Right-click on the project name in Eclipse and select **New** > **WOComponent**. Change the name to **BlogEntryIndexPage** and check the **Create HTML contents** button. Click **Finish**.
465 465  
466 466  The next step to get it to work is to make **BlogEntryIndexPage** to implement the **er.rest.routes.IERXRouteComponent** interface.
467 467  
468 468  {{code}}
329 +
469 469  import er.rest.routes.IERXRouteComponent;
470 470  
471 471  public class BlogEntryIndexPage extends WOComponent implements IERXRouteComponent {
... ... @@ -475,6 +475,7 @@
475 475  So now, the automatic HTML routing will send the request for **ra/blogEntries.html** to the **BlogEntryIndexPage** component. But we don't have any content in this component, so let's make a method to fetch all blog entries per creation date in descending order. So in **BlogEntryIndexPage.java**, add the following method:
476 476  
477 477  {{code}}
339 +
478 478  public NSArray<BlogEntry> entries() {
479 479   EOEditingContext ec = ERXEC.newEditingContext();
480 480   return BlogEntry.fetchAllBlogEntries(ec, BlogEntry.CREATION_DATE.descs());
... ... @@ -485,6 +485,7 @@
485 485  We need to use that method in a WORepetition, and for that loop, we need a BlogEntry variable to iterate in the list, so add the following code to **BlogEntryIndexPage.java**:
486 486  
487 487  {{code}}
350 +
488 488  private BlogEntry entryItem;
489 489  
490 490   public BlogEntry entryItem() {
... ... @@ -500,6 +500,7 @@
500 500  The Java part is done, so let's add the loop inside the component. Open **BlogEntryIndexPage.wo** (it's located in the **Component** folder) and right after the <body> tag, add:
501 501  
502 502  {{code}}
366 +
503 503  <wo:loop list="$entries" item="$entryItem">
504 504   <p><wo:str value="$entryItem.title" /></p>
505 505   <p><wo:str value="$entryItem.author.fullName" /></p>
... ... @@ -509,13 +509,14 @@
509 509  
510 510  That component code will loop over the blog entries and display the title of the entry + the name of the author. Save everything and run the application.
511 511  
512 -If you go to [[http:~~/~~/192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html>>url:http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html||shape="rect"]], you will see the list of blog entries!
376 +If you go to [[http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html]], you will see the list of blog entries
513 513  
514 514  Now that we have a list of blog entries, let's make a page to show the content of a blog entry. Create a new component named **BlogEntryShowPage**.
515 515  
516 -Open **BlogEntryShowPage.java** and make sure the class implements **er.rest.routes.IERXRouteComponent**.
380 +Open **BlogEntryShowPage.java** and make sure the class implements&nbsp;**er.rest.routes.IERXRouteComponent**.
517 517  
518 518  {{code}}
383 +
519 519  import er.rest.routes.IERXRouteComponent;
520 520  
521 521  public class BlogEntryShowPage extends WOComponent implements IERXRouteComponent {
... ... @@ -525,6 +525,7 @@
525 525  We need to add other methods to receive the BlogEntry object from the controller. In **BlogEntryShowPage.java**, add:
526 526  
527 527  {{code}}
393 +
528 528  private BlogEntry blogEntry;
529 529  
530 530   @ERXRouteParameter
... ... @@ -543,6 +543,7 @@
543 543  The Java part of the work is done, so save the Java class. It's time to work on the component part. Open **BlogEntryShowPage.wo** and between the <body></body> part, add:
544 544  
545 545  {{code}}
412 +
546 546  <h1><wo:str value="$blogEntry.title" /></h1>
547 547   <p><wo:str value="$blogEntry.content" /></p>
548 548   <p>Created on: <wo:str value="$blogEntry.creationDate" dateformat="%Y/%m/%d" /></p>
... ... @@ -553,6 +553,7 @@
553 553  Our view component is done, the only thing remaining is a link for the blog entry list (BlogEntryIndexPage) to the view page (BlogEntryShowPage). Save **BlogEntryShowPage.wo** and open **BlogEntryIndexPage.wo**. We are going to add a link on the title, you will replace to replace this:
554 554  
555 555  {{code}}
423 +
556 556  <p><wo:str value="$entryItem.title" /></p>
557 557  
558 558  {{/code}}
... ... @@ -560,10 +560,11 @@
560 560  with:
561 561  
562 562  {{code}}
431 +
563 563  <p><wo:ERXRouteLink entityName="BlogEntry" record="$entryItem" action="show"><wo:str value="$entryItem.title" /></wo:ERXRouteLink></p>
564 564  
565 565  {{/code}}
566 566  
567 -Save the component and run the app. Go to [[http:~~/~~/192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html>>url:http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html||shape="rect"]] to get the list of posts, and you should see a link on the title. Click on it, and now you get the full details of the blog entry!
436 +Save the component and run the app. Go to [[http://192.168.0.102:52406/cgi-bin/WebObjects/BlogRest.woa/ra/blogEntries.html]] to get the list of posts, and you should see a link on the title. Click on it, and now you get the full details of the blog entry
568 568  
569 -The REST part of this tutorial is now complete, [[you can now move to the next part of the tutorial>>doc:WEB.Home.Getting Started.Your First Framework.WebHome]].
438 +The REST part of this tutorial is now complete, [[you can now move to the next part of the tutorial>>Your First Framework]].
EOModeler.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.XWikiGuest
Size
... ... @@ -1,1 +1,0 @@
1 -34.6 KB
Content
author_list.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.XWikiGuest
Size
... ... @@ -1,1 +1,0 @@
1 -8.4 KB
Content
list.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.XWikiGuest
Size
... ... @@ -1,1 +1,0 @@
1 -9.6 KB
Content
list_wlock.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.XWikiGuest
Size
... ... @@ -1,1 +1,0 @@
1 -11.1 KB
Content
outline_tab.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.XWikiGuest
Size
... ... @@ -1,1 +1,0 @@
1 -10.6 KB
Content
relationship.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.XWikiGuest
Size
... ... @@ -1,1 +1,0 @@
1 -23.2 KB
Content
XWiki.XWikiComments[0]
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.franc
Comment
... ... @@ -1,5 +1,0 @@
1 -In "Creating the EOModel"
2 -
3 -"You are now ready to save the model. Save it (File -> Save) ???? ( where is this ?) and close the **Entity Modeler** window. If you open the **Sources** in the main Eclipse window, you will notice that the **Sources** folder contains a package named **your.app.model**."
4 -
5 -Using a new Golipse install, should this automatic sources creation just work after saving the Model or is there something to configure before ? (Automatically run EOGenerator in WOLips is checked)
Date
... ... @@ -1,1 +1,0 @@
1 -2012-05-23 17:14:53.92
XWiki.XWikiComments[1]
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.cdvalverdeg
Comment
... ... @@ -1,28 +1,0 @@
1 -**When i executed this: **
2 -
3 -(% style="color: rgb(0,0,0);" %)//curl -X POST -v -d '{ "title": "First post", "content": "Some text", "author": { "firstName": "Pascal", "lastName": "Robert", "email": "[[(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 0)" %)probert@macti.ca>>mailto:probert@macti.ca||shape="rect"]](%%)" } }' [[(% style="color: rgb(0, 0, 0); color: rgb(0, 0, 0)" %)http:~~/~~/127.0.0.1:60530~~/~~/cgi-bin/WebObjects/BlogRest.woa/ra/blgEntries.json>>url:http://127.0.0.1:60530//cgi-bin/WebObjects/BlogRest.woa/ra/blgEntries.json||shape="rect"]]//
4 -
5 -**And i get this message in terminal:**
6 -
7 -//* About to connect() to 127.0.0.1 port 60530 (#0)//
8 -//* Trying 127.0.0.1... connected//
9 -//* Connected to 127.0.0.1 (127.0.0.1) port 60530 (#0)//
10 -//> POST ~/~/cgi-bin/WebObjects/BlogRest.woa/ra/blgEntries.json HTTP/1.1//
11 -//> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3//
12 -//> Host: 127.0.0.1:60530//
13 -//> Accept: */*//
14 -//> Content-Length: 138//
15 -//> Content-Type: application/x-www-form-urlencoded//
16 -//> //
17 -//* HTTP 1.0, assume close after body//
18 -//< HTTP/1.0 400 Apple WebObjects//
19 -//< x-webobjects-loadaverage: 0//
20 -//< content-type: application/json//
21 -//< content-length: 53//
22 -//< //
23 -//A <b>Blg Entry</b> must have a <b>To Blg Author</b>.//
24 -//* Closing connection #0//
25 -
26 -(% style="line-height: 1.4285715;" %)**I'm new using ERRest and maybe i forgot to configure something.**
27 -
28 -**Any help would be appreciated.**
Date
... ... @@ -1,1 +1,0 @@
1 -2013-07-04 19:53:39.835
XWiki.XWikiComments[2]
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.cdvalverdeg
Comment
... ... @@ -1,1 +1,0 @@
1 -I found the problem, "(% style="color: rgb(0,0,0);" %)//author//(%%)" is not the name of the relationship in my blog model 
Date
... ... @@ -1,1 +1,0 @@
1 -2013-07-05 13:23:14.677
Reply To
... ... @@ -1,1 +1,0 @@
1 -1
XWiki.XWikiComments[3]
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.larean
Comment
... ... @@ -1,8 +1,0 @@
1 -Hi, I am trying to run this example and I get an error message. In particular, I cannot use curl. I added the records manually and when I try to display them I get this on the console:
2 -\\
3 -
4 -(% class="typ" %)Request(% class="pln" %) start (% class="kwd" %)for(% class="pln" %) URI (% class="pun" %)/(% class="pln" %)cgi(% class="pun" %)-(% class="pln" %)bin(% class="pun" %)/(% class="typ" %)WebObjects(% class="pun" %)/(% class="typ" %)BlogTutorial(% class="pun" %).(% class="pln" %)woa(% class="pun" %)/(% class="pln" %)ra(% class="pun" %)/(% class="pln" %)blogEntries(% class="pun" %).(% class="pln" %)json (% class="typ" %)Headers(% class="pun" %){(% class="pln" %)accept (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"*/*"(% class="pun" %));(% class="pln" %) host (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"127.0.0.1:45743"(% class="pun" %));(% class="pln" %) user(% class="pun" %)-(% class="pln" %)agent (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"curl/7.38.0"(% class="pun" %));(% class="pln" %) (% class="pun" %)}(% class="pln" %) (% class="pun" %)[(% class="lit" %)2015(% class="pun" %)-(% class="lit" %)8(% class="pun" %)-(% class="lit" %)14(% class="pln" %) (% class="lit" %)17(% class="pun" %):(% class="lit" %)20(% class="pun" %):(% class="lit" %)19(% class="pln" %) CEST(% class="pun" %)](% class="pln" %) (% class="pun" %)<(% class="typ" %)WorkerThread14(% class="pun" %)>(% class="pln" %) (% class="pun" %)<(% class="pln" %)er(% class="pun" %).(% class="pln" %)rest(% class="pun" %).(% class="pln" %)routes(% class="pun" %).(% class="typ" %)ERXRouteRequestHandler(% class="pun" %)>:(% class="pln" %) (% class="typ" %)Exception(% class="pln" %) (% class="kwd" %)while(% class="pln" %) handling action named (% class="str" %)"index"(% class="pln" %) on action (% class="kwd" %)class(% class="pln" %) (% class="str" %)"your.app.rest.controllers.BlogEntryController"(% class="pln" %) (% class="pun" %):(% class="pln" %)com(% class="pun" %).(% class="pln" %)webobjects(% class="pun" %).(% class="pln" %)foundation(% class="pun" %).(% class="typ" %)NSForwardException(% class="pln" %) (% class="pun" %)[(% class="pln" %)java(% class="pun" %).(% class="pln" %)lang(% class="pun" %).(% class="pln" %)reflect(% class="pun" %).(% class="typ" %)InvocationTargetException(% class="pun" %)](% class="pln" %) (% class="kwd" %)null(% class="pun" %):(% class="pln" %)java(% class="pun" %).(% class="pln" %)lang(% class="pun" %).(% class="pln" %)reflect(% class="pun" %).(% class="typ" %)InvocationTargetException(% class="pln" %) _ignoredPackages(% class="pun" %)::(% class="pln" %) (% class="pun" %)((% class="str" %)"com.webobjects"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.applet"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.awt"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.awt.datatransfer"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.awt.event"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.awt.image"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.beans"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.io"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.lang"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.lang.reflect"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.math"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.net"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.rmi"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.rmi.dgc"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.rmi.registry"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.rmi.server"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.security"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.security.acl"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.security.interfaces"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.sql"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.text"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.util"(% class="pun" %),(% class="pln" %) (% class="str" %)"java.util.zip"(% class="pun" %))(% class="pln" %) (% class="typ" %)Headers(% class="pun" %){(% class="pln" %)cache(% class="pun" %)-(% class="pln" %)control (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"private"(% class="pun" %),(% class="pln" %) (% class="str" %)"no-cache"(% class="pun" %),(% class="pln" %) (% class="str" %)"no-store"(% class="pun" %),(% class="pln" %) (% class="str" %)"must-revalidate"(% class="pun" %),(% class="pln" %) (% class="str" %)"max-age=0"(% class="pun" %));(% class="pln" %) expires (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"Fri, 14-Aug-2015 15:20:19 GMT"(% class="pun" %));(% class="pln" %) content(% class="pun" %)-(% class="pln" %)type (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"text/html"(% class="pun" %));(% class="pln" %) content(% class="pun" %)-(% class="pln" %)length (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"9296"(% class="pun" %));(% class="pln" %) pragma (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"no-cache"(% class="pun" %));(% class="pln" %) x(% class="pun" %)-(% class="pln" %)webobjects(% class="pun" %)-(% class="pln" %)loadaverage (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"1"(% class="pun" %));(% class="pln" %) date (% class="pun" %)=(% class="pln" %) (% class="pun" %)((% class="str" %)"Fri, 14-Aug-2015 15:20:19 GMT"(% class="pun" %));(% class="pln" %) set(% class="pun" %)-(% class="pln" %)cookie (% class="pun" %)=(% class="pln" %) (% class="pun" %)();(% class="pln" %) (% class="pun" %)}
5 -
6 -{{code language="none"}}{{/code}}
7 -
8 -{{{}}}
Date
... ... @@ -1,1 +1,0 @@
1 -2015-08-17 08:04:44.506