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 got an 404 error in the end. But if I change the url to
http://localhost:8080/DukesAgeService/webresources/dukesAge
It 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.2
implements 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")
XYZFacadeREST
class 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 webresources
with resources
(point 1) and the path in point 2 with dukesAge
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With