Junos Space SDK > Developer Guides > Junos Space Application Developer Guide > Programming with the Junos Space SDK > Using the Junos Space SDK Plug-in > Using the EJB-REST Wizard

Modifying the REST Interface

This topic explains the options to modify the REST interface methods using Eclipse. An EJB method must follow certain guidelines if it is to be RESTified correctly. For more information, see Guidelines for RESTification of EJB Methods.

Adding the REST Method

  1. Select Junos Space > Manage REST Resources. The Manage REST Resources window is displayed.
  2. Select the Java interface and click Edit Existing Version, the Edit Version window is displayed.
  3. Click Next. The The Configure REST Resource window is displayed.
  4. The Configure REST Resource window shows the newly added method listed in the Methods of Rest Interface table.

  5. Add the additional REST interface methods and configure them.
  6. Click Finish. The first version of the REST interface, the implementation class, and the DTO class are generated.

Remember to add the EJB lookup code in the getBean method in the interface implementation file.

For example, in HelloWorldImpl.java, replace the following TODO comment:

private net.nvd.jssdk.helloworld.HelloWorld getBean() 
{
// TODO: add bean creation logic
// TODO: Use JxServiceLocator.lookup( <EJB NAME> ) for EJB lookup

   helloworldbeanremote = JxServiceLocator.lookup( 'HelloWorldBean');
   return helloworldbeanremote;
}

with

  <Ejb Interface> = JxServiceLocator.lookup("<Bean Name>");.

For example,

  resourceusagebeanremote = JxServiceLocator.lookup("ResourceUsageBean");

Removing a REST Method

To remove a predefined REST interface method (API) from the exposed API list:

  1. Navigate to the Configure REST Resource window.
  2. Select the method to be deleted from the Methods of REST Interface table.
  3. Click Remove.

Editing a REST Method

To edit a predefined REST interface method:

  1. Navigate to the Configure REST Resource window.
  2. Select the method to be edited from the Methods of REST Interface table.
  3. Click Edit. The Configuring REST Method wizard is launched for the selected method.
  4. Edit the REST method settings and click Finish.