5.2. Deploy/Undeploy a REST Service

Note

This function is for users with the administrator role only.

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 Run --> Deploy 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

Warning

  • It is impossible to deploy the service with the registered URI pattern if the path (including name) of the new service is different from the original one.

To cope with it, you have to undeploy the service with the registered URI pattern first.

  • It is necessary to validate the Groovy scripts used by the service before deploying it by going to Run --> Validate from the top menu.

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:

[ERROR] /repository/collaboration/rennes.groovy
undeploy failed. Error (400: Bad Request)
Can not unbind script rennes.groovy, not bound or has wrong mapping to the
resource class

Warning

Deleting the service will not make it undeploy. You have to undeploy the service before deleting it. In other cases, the workaround is to create it again in the same place and then undeploy.

Copyright ©2012. All rights reserved. eXo Platform SAS