Skip to content

How to package multiple services into a single jar

Jasper Nalbach edited this page Feb 22, 2016 · 2 revisions

When developing RESTful services or applications one could consider implementing each resource as a single las2peer service. Another scenario where this how to applies, is grouping several services into a single jar file. However the default should be to provide a single service managing all resources.

Development

First step to take is to ensure that each service got it's own unique REST mapping. It's suggested to give each service a unique prefix by annotating it's full class. Please read the How to Create Mapping for more details.

Next step is to gather the code in any package structure you want and compile it into a single jar file. The jar should contain as in the default case all class files regarding your services.

At this point you're almost done. You just have to deploy your services.

Deployment

As with single services please upload your jar file to the services folder of your las2peer node. Then you just have to start the services you want by calling the following functions either from LAS2peer node console or start script.

startService('[email protected]','someFirstPass') startService('[email protected]','someSecondPass')

The las2peer class loader will automatically check all jars inside the services folder, tries to find the service class and instantiates it.

Clone this wiki locally