This chapter includes the following topics:

Note

eXo IDE also supports validating and classpath configuration of POGO files that are similar to REST Service.

The eXo IDE application provides the original approach to operate with REST Service to validate, deploy/undeploy and launch applications, which are compatible with the JSR-311 specification without restarting the server, or installing additional programs:

Operation User with "developer" role User with "administrator" role
Validate Enabled Enabled
Deploy Disabled Enabled
Undeploy Disabled Enabled
Deploy in Sandbox Enabled Enabled
Undeploy from Sandbox Enabled Enabled
Set/Unset Autoload Disabled Enabled
Run in Sandbox Enabled Enabled
Launch REST Service Disabled Enabled

With eXo IDE, you can validate REST Service before saving, deploying, launching or undeploying the service. The feedback from server is displayed in the Output tab:

All REST Service commands are placed at the right part of the toolbar and in the Run from the top menu.

To clear the Output pane, click at the right top corner of this pane.

See also

Deploy a REST Service

1. Save the file before deploying.

2. Open the saved file in the Content pane.

3. Click on the toolbar;

Or, go to RunDeploy from the top menu.

The deployment request is sent to the server. In case of no errors, the message is displayed in the Output tab as below:

[INFO]rennes.groovy deployed successfully

Otherwise, there will be an error message, for example:


[ERROR] rennes.groovy deploy failed. Error (400: Bad Request)
Unexpected error. Error occurs when parse stream, compiler error:
startup failed, rennes.groovy: 4: unable to resolve class javax.ws.rs.Path1
@ line 4, column 1.rennes.groovy: 8: unable to resolve class Path , unable to
find class for annotation
@ line 8, column 1.rennes.groovy: 11: unable to resolve class Path , unable to
find class for annotation
@ line 11, column 3.
3 errors

Undeploy a Rest Service

1. Select the service deployed in the Workspace pane.

2. Double-click the selected service to open it in the Content pane.

3. Click on the toolbar.

In case of no errors, there will be a message informs undeploying successfully in the Output tab.

[INFO] /repository/collaboration/rennes.groovy undeployed successfully.

You can deploy multiple REST Services, and double-deploy the services. However, you cannot undeploy services which were not previously deployed. In this case, you will receive an error message from the server as below:

With eXo IDE, you cannot only write and deploy services, but launch these services and view service response in the Output tab. You can view WADL-description of methods, make requests with your own header, query, path parameters and body content using one of the supported methods. To do that, simply click on the toolbar,

Or, go to RunLaunch REST Service... from the top menu as follows:

1. Select the deployed REST Service.

2. Click on the toolbar to get the REST Service form which is relied on the WADL-description of REST Service.

3. Select and type the path to the service in the Path field. Path parameters are enclosed in curly braces.

4. Select one of the supported methods from the Method combo-box.

5. Select the appropriate Request Media Type.

6. Check the Response Media Type.

7. Uncheck the redundant query parameters and set values of the rest in the table at the bottom of the dialog window.

8. Go to the Header Parameters middle tab and set appropriate values.

9. Set request with the body content within the Body tab. This tab is disabled for the GET request.

10. Click Send.

You will receive a success message if the path is verified to be correct or an error message in the Output tab.

To learn about launching REST Service, see the REST Service operations illustration above.

The following table shows annotations of reproducing service in the Launch REST Service form:

REST Service Annotation Element of Launch REST Service form
@Path The Path field
@GET, @POST,... The Method field.
@Consumes The Request Media Type field.
@Produces The Response Media Type field.
@PathParam The path parameters figured in curly braces, for example, /service/{param}/{paramList: .+}.
@HeaderParam The Header Parameter tab of the bottom table.
@QueryParam The Query Parameter tab of the bottom table.
@DefaultValue The By default column of the bottom table.

1. Create, save and deploy the REST Service with the next content:

2. Select RunLaunch REST Service... from the top menu, or click on the toolbar.

3. Select the Path field as "/testMediaTypes", method OPTIONS, then click Send.

The OPTIONS request is sent. You will see the response in the Output tab. For example:



<application xmlns="http://research.sun.com/wadl/2006/10">
   <resources base="http://192.168.0.8:8080/rest">
      <resource path="/testMediaTypes">
         <method name="OPTIONS">
            <response>
               <representation mediaType="application/vnd.sun.wadl+xml"/>
            </response>
         </method>
         <resource path="InnerPath/{pathParam}">
            <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="pathParam" style="template" type="xs:string"/>
            <method id="post1" name="POST">
               <request>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Test-Header1" style="header" type="xs:string"/>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Test Query Parameter 1" style="query" type="xs:string"/>
                  <representation mediaType="application/xml"/>
               </request>
               <response>
                  <representation mediaType="text/html"/>
               </response>
            </method>
            <method id="post2" name="POST">
               <request>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Test-Header2" style="header" type="xs:string"/>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Test Query Parameter 2" style="query" type="xs:string"/>
                  <representation mediaType="application/xml"/>
               </request>
               <response>
                  <representation mediaType="application/json"/>
               </response>
            </method>
         </resource>
      </resource>
   </resources>
</application>

4. Open the Launch REST Service... form again and select the another Path field:

5. Select the Response Media Type = "text/html" item.

6. Enter "/testMediaTypes/InnerPath/value1" in the Path field. In the Query Parameter tab, set "Test Query Parameter 1"="value2". In the Header Parameter tab, set "Test-Header1"="value3". In the Body tab, type "example".

7. Click Send.

The request is created and then sent. You will see the response in the Output tab:


[OUTPUT] - -Status - - - - - - - -
200 OK
- -Headers- - - - - - - -
Server : Apache-Coyote/1.1
Content-Type : text/html
Transfer-Encoding : chunked
Date : Mon, 05 Jul 2010 09:06:55 GMT
- -Text - - - - - - - - -
PathParam 1:value1; Test Query Parameter 1: value2; Test-Header1: value3; Body: example

The Netvibes widget uses Universal Widget API (UWA) - a powerful framework for Web widgets development - for both Netvibes widgets and many various environments.

The UWA widget consists of combinations from XHTML/XML, JavaScript/Ajax, CSS code with the MIME type application/x-uwa-widget. In eXo IDE, you can create the Netvibes widget, preview it and deploy to the Netvibes Ecosystem.

Note

If you want to get acquainted with writing your own widgets, refer to this page.

Create Netvibes widget

Click on the toolbar and then select Netvibes Widget from the drop-down menu;

Or, go to FileNetvibes Widget from the top menu.

The new Netvibes widget file is opened in the editor, enabling you to edit and save it.

Preview Netvibes widget

1. Open your desired widget file in the Content pane.

2. Click on the toolbar;

Or, go to RunShow Preview from the top menu.

The selected widget is opened in the Preview tab.

Deploy Netvibes widget to Netvibes Ecosystem

Netvibes widgets are placed in the remote system called Netvibes Ecosystem. This is the location where such widgets can be found and compiled for other platforms.

There are a couple of ways to deploy a Netvibes widget. You can do it manually, or use the deployment mechanism. Manual deployment is easier because you do not need to get an API key from Netvibes.

Manual deployment

1. Get the URL of your Netvibes widget by selecting your widget, then clicking ViewGet URL. Copy the URL.

2. Go to the Netvibes Ecosystem, click Create or submit and Submit Widget.

3. Paste the URL of your gadget, and don not forget to remove the /private part from it. If you do not do this, Netvibes will not be able to access it.

4. Fill in the form and finish the process. The widget is now available in the ecosystem.

Note

For deployment using our wizard, you need to contact Netvibes at and ask for your API key.

Deploy UWA widget:

1. Get the URL of your netvibes widget. To do this, select your widget and click ViewGet URL from the menu. Copy the URL.

2. Click on the toolbar;

Or, go to RunDeploy UWA widget on the top menu to open the Deploy UWA widget to Ecosystem form:

3. Paste the URL of your gadget, and do not forget to remove the "/private" part from it, or netvibes will not be able to access it.

4. Enter the information about the widget in the fields in the Step 2 form. All fields marked with asterisk (*) are required..

Click Next after completing your details.

5. Enter your netvibes credentials and the API key/secret that netvibes gave you by email. All these fields are mandatory.

Details:

Field Description
Login Your login at Netvibes Ecosystem.
Password Your password at Netvibes Ecosystem.
Api Key The string generated by Netvibes and used for identifying you.
Secret Key The string generated by Netvibes and used for submitting your actions.

Tip

Click the Back button to return to the previous step to edit your entered information.

6. Click to start deploying the widget to the Netvibes Ecosyste.

The result is displayed in the Output pane. If the deployment is successful, you will receive the message below:


[INFO]*[http://78.137.4.16:53081/rest/ide-vfs-webdav/repository/dev-monit/TestWidget.html] deployed successfully.

If unsuccessful, you will receive the error message which varies, depending on each case.

[ERROR] Error: The link already exists.

Note

The deployed widget can be found at the Ecosystem page on the My creation tab.

View Netvibes documentation

There is a convenient way to view the developer's documentation, while creating your widget in eXo IDE. When opening Netvibes widget in editor, click Show Documentation on the toolbar or go to ViewDocumentation.

Top menu item and a pane with loaded documentation will be opened at the right part of the application.

See also

Create a Data Object

Click Data Object;

Or, go to FileNewData Object from the top menu.

Your newly created file will be opened in editor, so you will be able to edit and save it.

Preview a Node Type

1. Click on the Toolbar;

Or, go to RunPreview node type from the top menu.

2. Select a node type format in the appeared form:

3. Click Generate. The generated node type definition will be displayed in the separate tab of Operation pane with title Preview node type:

Create a Node Type

1. Click on the toolbar;

Or, go to RunDeploy node type from the top menu.

2. Select a required node type format in the Deploy Node Type form.

3. Select the action in case such node type already exists:

4. Click Deploy.

If the node type has been deployed successfully, you will see the message Node type is successfully deployed. Otherwise, the error message will be shown.

See also

Copyright © 2009-2012. All rights reserved. eXo Platform SAS