You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Pradeep Fernando <pr...@gmail.com> on 2011/02/11 07:29:53 UTC

how to deploy two jax-rs applications withing the same .war

hi ,

I have two jax-rs applications (I extend javax.ws.rs.core.Application
to provide resource classes in each of the applications). I have
packaged them in to two jar files.
I placed them in the lib folder in the war file.

How can i set the init parameter of web.xml to give these two
application classes.  I tried several ways, but only one of them get
deployed each time.

thanks in advance,
--Pradeep

Re: how to deploy two jax-rs applications withing the same .war

Posted by Pradeep Fernando <pr...@gmail.com>.
hi,

thanks a lot BLuk.

--Pradeep.

Re: how to deploy two jax-rs applications withing the same .war

Posted by Bryant Luk <br...@gmail.com>.
Hello,

You will need to add an init-param with the name
"requestProcessorAttribute" to each servlet definition and give a
unique value per servlet definition.  The unique value is used to
store the request processor into the servlet context.  Internally,
this allows other servlets to pick up the request processor for the
JAX-RS application so they can re-use the processor if they want to.

    <servlet>
        <servlet-name>RestServlet1</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>com.example.YourApplication</param-value>
        </init-param>
        <init-param>
            <param-name>requestProcessorAttribute</param-name>
            <param-value>com.example.YourApplicationUniqueID</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>RestServlet2</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>com.example.YourSecondApplication</param-value>
        </init-param>
        <init-param>
            <param-name>requestProcessorAttribute</param-name>
            <param-value>aUniqueIdentifierHere</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

On Fri, Feb 11, 2011 at 12:29 AM, Pradeep Fernando <pr...@gmail.com> wrote:
> hi ,
>
> I have two jax-rs applications (I extend javax.ws.rs.core.Application
> to provide resource classes in each of the applications). I have
> packaged them in to two jar files.
> I placed them in the lib folder in the war file.
>
> How can i set the init parameter of web.xml to give these two
> application classes.  I tried several ways, but only one of them get
> deployed each time.
>
> thanks in advance,
> --Pradeep
>



-- 

@bluk