users@glassfish.java.net

Re: Where does Glassfish put RESTful URLs?

From: Bhakti Mehta <bhakti.mehta_at_oracle.com>
Date: Mon, 24 Oct 2011 15:36:58 -0700

I had run into a similar issue and the problem was resolved by fixing
the right package for the restful webservice in my web.xml for
com.sun.jersey.config.property.packages init-param. Can you confirm if
the package name of your SendMessageWithReplyToResource class is
rest.resource?

Regards,
Bhakti

On 10/24/11 3:09 PM, forums_at_java.net wrote:
> I've got a .ear file that contains a .war with a RESTful web service.
> If I
> go to localhost:8080/appname [1] the index.jsp page is displayed so
> the .war
> file was deployed correctly. If I try to send a GET to the RESTful web
> service using its URL
> localhost:8080/appname/rest/sendMessageWithReplyTo [2]
> I get a 404 error.
>
> Is there some way to make Glassfish tell me where it put my RESTful web
> service?
>
> Here are my web.xml and Rest class implementation:
>
> <web-app> <display-name>rest.resource</display-name> <servlet>
> <servlet-name>Jersey REST Service</servlet-name>
> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>rest.resource</param-value> </init-param>
> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping>
> <servlet-name>Jersey REST Service</servlet-name>
> <url-pattern>/rest/*</url-pattern> </servlet-mapping> </web-app>
>
>
> @Path("/sendMessageWithReplyTo") public class
> SendMessageWithReplyToResource
> { @GET @Produces(MediaType.TEXT_HTML) public String
> callSendMessageWithReplyTo() { return "<html> " + "<title>" +
> "callSendMessageWithReplyTo()" + "</title>" + "<body><h1>" + "Called
> sendMessageWithReplyTo()" + "</body></h1>" + "</html> "; } }
>
> [1] http://localhost:8080/appname
> [2] http://localhost:8080/appname/rest/sendMessageWithReplyTo
>
> --
>
> [Message sent by forum member 'dwschulze']
>
> View Post: http://forums.java.net/node/856647
>
>