users@jersey.java.net

[Jersey] Help required for jersey and struts2 integration

From: vijai sahu <sahuvijay21_at_gmail.com>
Date: Wed, 8 Feb 2012 15:50:45 +0530

Hi,

I am trying to use jersey with my existing struts2 application.

But calling "http://localhost:8080/AlertManager/users" gives resource not
found status code 404 error

my configration are as below

web.xml
------------

<servlet>
           <servlet-name>JerseyTest</servlet-name>
            <servlet-class>
                com.sun.jersey.spi.container.servlet.ServletContainer
            </servlet-class>
        <init-param>
            <param-name>
                com.sun.jersey.config.property.resourceConfigClass
            </param-name>
            <param-value>
                com.sun.jersey.api.core.PackagesResourceConfig
            </param-value>
        </init-param>
        <init-param>
            <param-name>
                com.sun.jersey.config.property.packages
            </param-name>
            <param-value>com.canvasm.am.web</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
    </servlet>


  <servlet-mapping>
        <servlet-name>JerseyTest</servlet-name>
        <url-pattern>/AlertManager</url-pattern>
    </servlet-mapping>


Struts.xml
----------------
Even i used following in struts.xml

<constant name="struts.action.excludePattern"
value="/NewAlert,/CancelAlert,/users" />

UsersResource.java
--------------------------------

@Path("/users")
public class UsersResource {
    @GET
    @Produces("application/xml")
    public String getXML() {
        return UserBO.getAllXML();
    }

    @GET
    @Produces("application/json")
    public String getJSON() {
        return UserBO.getAllJSON();
    }

    @POST
// @Consumes("application/xml")
    @Produces("application/xml")
    public String createUser(String representation) {

}


Thanks for your valuable feedback.