I started learning JavaEE yesterday and I chose an Oracle official guide FirstCup to get started
I’m using Netbeans 7.2 with GlassFish Server 3.1.2.2 and I’m sure I followed every instruction step by step. But I have two problems:
- I didn’t see any REST Resources Configuration dialog as it says in the doc.
-
I got an 404 error in the end. But if I change the url to
http://localhost:8080/DukesAgeService/webresources/dukesAgeIt works! I got this url by expanding RESTful Web Services->Right clicking DUkesAgeResource [dukesAge] ->Test Resource Uri
I want to know:
-
where I can find this REST Resources Configuration dialong in 1.
-
if 2 is a print mistake in Oracle the documentation. It says the relative url should be
/resources/dukesAge -
Why the url must end with
/webresources/dukesAge, can I change it?
As pointed out in the comments,
NetBeans 7.2implements a default configuration for RESTFul Web Services that is different from the previous versions. This standard configuration can be overridden during the creation of the web service. Once created with the defaults, you can’t use the wizard anymore (the Configuration choice from the right-click menu is grayed out).Consequently, in order to view / edit the RESTFul paths, you need to edit the auto-generated Java classes directly:
@javax.ws.rs.ApplicationPath("webresources")XYZFacadeRESTclass contains the path relative to each entity class in the annotation@Path("entity.XYZ")If you want to have the same paths as in the tutorial, you need to replace
webresourceswithresources(point 1) and the path in point 2 withdukesAge.