+1 to auto populating a new parameter and enabling it by default.

Question, does the runtime work when two servlets share the same request
processor?  My impression from Bryant's note was no, but Eli seemed to
indicate that they did.  Or, is it that only one servlet needs to be fired
because the config that existed for both applications is now smashed
together?

Looking at how the servlets are defined in Bryant's example, it seems more
intuitive to have the configs separated out on a per servlet basis.  If I
want them together, then I can just add the resources/providers to a single
Application class and be done with it.

-Nick



Nicholas Gallardo
WebSphere  - REST & WebServices Development
[email protected]
Phone: 512-286-6258
Building: 903 / 5G-016


                                                                       
             Bryant Luk                                                
             <bryant....@gmail                                         
             .com>                                                      To
                                       [email protected]   
             07/02/2009 08:51                                           cc
             AM                                                        
                                                                   Subject
                                       Re: Multiple RestServlets in single
             Please respond to         web application?                
             wink-...@incubato                                         
               r.apache.org                                            
                                                                       
                                                                       
                                                                       
                                                                       




Hi Eli,

Just curious why we need the application developer to add that
parameter.  Is there any way that we can autogenerate that parameter
within the runtime?  The reasons why I think we should autogenerate:

1)  Application portability.  If other implementations take their
JAX-RS application and switch to Wink (or start with Wink), the first
impression may be that we don't work out of the box.
2)  I haven't tested this but if we use Wink as a shared library
across a container's applications (such as Geronimo/WebSphere), I
think this would cause some administration headaches since every
parameter value (I'm assuming) has to be unique.  Some application
developers might not communicate their unique attribute names, and
this would be a really hard thing to find out when an application
doesn't work correctly.

I think we can have it as an optional attribute if you want to use the
same RequestProcessor across two servlet instances, just that by
default, we generate a unique one per servlet instance.

Thoughts?

On Thu, Jul 2, 2009 at 3:34 AM, Baram, Eliezer<[email protected]> wrote:
> 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
>



--

- Bryant Luk

Reply via email to