REST Web Services in MyEclipse
MyEclipse includes tools that let you amp up your web development by adding REST web services to your applications. The REST features in MyEclipse are based on Jersey, which is the reference implementation for JAX-RS, the Java API for RESTful Web Services.
A Web Service project is one of the project types you can create using a technology-specific project wizard. When you begin a new Web Service project, you can specify the REST (JAX-RS) framework.
Other configurations specific to JAX-RS that you can set in a new project are Servlet name, URL pattern, and the Jersey libraries you want to add to the build path.
You can also add the REST Web Service facet to any JavaEE 5 or higher project. Right-click the project, and select MyEclipse>Project Facets>Install JAX-RS Facet from the menu to configure the existing project as a REST web service project.
3. Use REST Web Services to Expose JPA Entities
Another option is to expose reverse-engineered database entities via REST web services. Exposing the entities generates REST facades. The facades provide methods that are exposed via REST for managing the database. See Exposing JPA Entities via REST Web Services for more information.
The New Web Service wizard gets you started with creating a web service. Use the Web Services icon on the toolbar.
You can choose the REST (JAX-RS) framework, and the web service creation strategy. Bottom-up creates the web service from a Java class. Top-down starts with a WSDL.
If you chose the bottom-up scenario, you can create a web service from a new or existing class.
Add REST resource methods to your web service class either using the Add button in the New REST Web Service window shown above, or by opening the Java class file, right-clicking the editor, and selecting MyEclipse>Add REST Method from the menu.
When you add methods, the New JAX-RS Resource Method window appears. Specify the method name, path, parameter details, etc.
The REST Project Explorer view gives you an overview at a glance of the web services you've defined for a specific project. Use this view to quickly navigate between methods and resources; double-clicking a method in the REST Project Explorer opens the resource file to the selected method.
When you select a REST web services project in the Explorer view, the project is scanned for all methods and resources, and they appear neatly organized in the REST Project Explorer. The same resource information appears in the MyEclipse Explorer in the project's REST Resources node.
To open the Rest Project Explorer view, select Window>Show View from the menu. Search for REST, or open the MyEclipse Java Enterprise node.
Right-clicking a project in the Explorer view, and selecting Run As>MyEclipse Server Application deploys the application and starts the server so you can test your REST services.
To test in the REST explorer, right-click a project, and select MyEclipse>Test with REST Web Services Explorer.
You can select operations and methods to test. The Test method link invokes the service. A new tab appears for the specified method where you can specify test details and run the test.