How to configure Jersey 2.22 in the project?

2

I'm having a hard time configuring the Jersey 2.22.1 in my web project that is deployed on the Tomcat 8 server, which I am developing on Netbeans. Note: I use maven.

I have read and reread documentation but it does not fit into my development environment.

My question is how to configure the files pom.xml and web.xml .

    
asked by anonymous 28.11.2015 / 22:24

1 answer

1

I did it.

web.xml

    <servlet>
        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>meu.pacote.dos.recursos</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/webservice/*</url-pattern>
    </servlet-mapping>

pom.xml

<properties>
    ...
    <jersey.version>2.22.1</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
     ...
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>2.22.1</version>
    </dependency>
 </dependencies>
    
29.11.2015 / 03:03