users@jersey.java.net

Re: [Jersey] web.xml url-pattern and _at_PathParam

From: Ronak Patel <ronak2121_at_yahoo.com>
Date: Wed, 13 May 2009 10:47:10 -0700 (PDT)

Paul, Thanks for your reply. My JSP page is a login page for J2EE security using the <login-config> element rather than a jsp that is part of the business logic of the application. How would you handle that? Would it be the same way as this below? Ronak ________________________________ From: Paul Sandoz <Paul.Sandoz@Sun.COM> To: users@jersey.dev.java.net Sent: Wednesday, May 13, 2009 8:34:56 AM Subject: Re: [Jersey] web.xml url-pattern and @PathParam Hi Ronak, Part of the problem might be the multiple declarations of URL pattern. Why do you have multiple declarations? Also, when you list the URLs are they relative URLs to the base say of "/surface/" or "/weather/" ? If you want to support JSPs and resource classes from the same base URI then i recommend using the ServletContainer as a filter and declare a regex pattern so that matching paths are not served by Jersey. See the bookstore sample [1], specifically the web.xml http://fisheye4.atlassian.com/browse/~raw,r=2009/jersey/trunk/jersey/samples/bookstore/src/main/webapp/WEB-INF/web.xml notice the init param: <init-param> <param-name>com.sun.jersey.config.property.WebPageContentRegex</param-name> <param-value>/(images|css|jsp)/.*</param-value> </init-param> that declares a regex to match against the request URL path. If the regex matches then Jersey will pass the request on to the next filter in the chain: https://jersey.dev.java.net/nonav/apidocs/1.1.0-ea/jersey/com/sun/jersey/spi/container/servlet/ServletContainer.html#PROPERTY_WEB_PAGE_CONTENT_REGEX In the bookstore sample the regex matches directions that contain images, CSS files, and JSP files. Paul. On May 13, 2009, at 12:03 PM, Ronak Patel wrote: Hi All, I'm using Jersey 1.0.3 and came across a weird problem. My web application is a mixture of a JSP page and the main REST web application. To accomodate both in the same web.xml, my web.xml structure for my REST web application is as follows: <servlet><display-name>sno</display-name><servlet-name>sno</servlet-name><servlet-class>com</servlet-class><load-on-startup>1</load-on-startup></servlet><servlet-mapping><servlet-name>sno</servlet-name><url-pattern>/forecast/*</url-pattern> <url-pattern>/surface/*</url-pattern> <url-pattern>/weather/*</url-pattern> Code as follows always results in an HTTP 404: @Controller@Path("/nation/{nationId}/")publicclassNationController {@GET@Produces("application/xml")publicResponse getNationByNationId( {@PathParam("nationId") finalLong nationId)} } All of the following URLs fail: /nation /nation/ /nation/1 /nation/1/ I would assume all 4 of these URIs would work. Why doesn't Jersey match these uri properly? Ronak <url-pattern>/region/*</url-pattern></servlet-mapping>.sun.jersey.spi.spring.container.servlet.SpringServlet --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@jersey.dev.java.net For additional commands, e-mail: users-help@jersey.dev.java.net