users@jersey.java.net

[Jersey] _at_ApplicationPath not working

From: Gili <gili.tzabari_at_gmail.com>
Date: Thu, 13 Jan 2011 20:18:31 -0800 (PST)

Hi,

I am trying to deploy a JAX-RS application using Netbeans 7.0 (dev build),
Glassfish 3.1.1 and Jersey 1.4.

If I add the following web.xml file to my project everything works fine:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
        <servlet>
                <servlet-name>foo.ApplicationConfig</servlet-name>
                <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
                <servlet-name>foo.ApplicationConfig</servlet-name>
                <url-pattern>/*</url-pattern>
        </servlet-mapping>
        <session-config>
                <session-timeout>
            30
                </session-timeout>
        </session-config>
</web-app>

If, however, I remove web.xml and define the following class then my
resource doesn't get loaded:

@ApplicationPath("/*")
public class ApplicationConfig extends DefaultResourceConfig
{
        @Override
        public Set<Class<?>> getClasses()
        {
                return Sets.<Class<?>>newHashSet(DoctorsResource.class);
        }
}

What am I doing wrong?

Thank you,
Gili
-- 
View this message in context: http://jersey.576304.n2.nabble.com/ApplicationPath-not-working-tp5920648p5920648.html
Sent from the Jersey mailing list archive at Nabble.com.