Hi Bryant The RestServlet stores the requestProcessor on the servletContext, by default it saves it under an attribute named RequestProcessor.class.getName() If you register more then one servlet and you want each to have a separate RequestProcessor you need to indicate the RestServlet to save the RequestProcessor under a different attribute.
You can specify the attribute name by setting the "symphony.requestProcessorAttribute" init parameter of the RestServlet. See modification below. --Eli -----Original Message----- From: Bryant Luk [mailto:[email protected]] Sent: Thursday, July 02, 2009 2:09 AM To: [email protected] Subject: Multiple RestServlets in single web application? Hi, Does the RestServlet support multiple servlet instances in the same web application? It seems that only the first servlet (in alphabetical order) is fired up correctly. If I have two instances of the servlet, say MessageBodyWriterExceptions and MessageBodyReaderExceptions, only MessageBodyReaderExceptions seems to work. If I then rename MessageBodyReaderExceptions to "Z" (or comment out the servlet definition), then my MessageBodyWriterExceptions servlet JAX-RS app works. My web.xml: <web-app> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>MessageBodyWriterExceptions</servlet-name> <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class> <init-param> <param-name>javax.ws.rs.Application</param-name> <param-value>org.apache.wink.jaxrs.test.providers.writerexceptions.Application</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>MessageBodyReaderExceptions</servlet-name> <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class> <init-param> <param-name>javax.ws.rs.Application</param-name> <param-value>org.apache.wink.jaxrs.test.providers.readerexceptions.Application</param-value> </init-param> [E.B] <init-param> <param-name>symphony.requestProcessorAttribute</param-name> <param-value>requestProcessorAttribute_2</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBodyWriterExceptions</servlet-name> <url-pattern>/writerexceptions/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>MessageBodyReaderExceptions</servlet-name> <url-pattern>/readerexceptions/*</url-pattern> </servlet-mapping> </web-app> -- - Bryant Luk
