Jersey MVC web.xml configuration - java

When I am trying to configure the web.xml file for Jersey MVC I am unable to get the result.
my web.xml file
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<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>com.res.app.Test</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/webapi/*</url-pattern>
</servlet-mapping>
</web-app>
maven dependencies for jersey mvc:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-mvc</artifactId>
<version>2.27</version>
</dependency>
I have a requirement that the html page content updated dynamically(text format and variables will vary) for every link. so i choose jersey mvc, As of now my project is maven build i am using jersey archtypes. Above is my web.xml file but while im trying to configure the mvc i am getting 404 error. please help me out, Thanks in advance.

Related

Tomcat server is running but its resources are not found

I´ve created an maven project with the jersey archetype and attached a tomcat server to it. My tomcat server is running, but when i try to access to a resource, it does not appear (Error 404:Not found,
The required resource is not available.)
I already have tried to change the server path to use tomcat installation option. Also, i added a project facet with a dynamic project module.
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>com.telusko.pablo</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/webapi/*</url-pattern>
</servlet-mapping>
pom.xml
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<!-- uncomment this to get JSON support
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
</dependency>
-->
</dependencies>
<properties>
<jersey.version>2.26-b03</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
I only expect to can access the resources and not get the error 404.

Jersey Rest API Documentation using Swagger

I am trying to view the list of my jersey rest service methods in API Documentation using Swagger. Went through few examples/sample given in GitHub sites. But still I am not able to list out my service methods when I try to access the context-root link. Getting 404 service not found.
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.danfoss.des</groupId>
<artifactId>SampleRestProject</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>SampleRestProject Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey-jaxrs</artifactId>
<version>1.5.0</version>
</dependency>
<!-- <dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.9.1</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency> -->
</dependencies>
<build>
<finalName>SampleRestProject</finalName>
</build>
web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>io.swagger.jaxrs.listing,com.danfoss.des</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<!-- <init-param>
<param-name>api.version</param-name>
<param-value>1.0.0</param-value>
</init-param>
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>http://localhost:8081/SampleRestProject/</param-value>
</init-param> -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>JerseyJaxrsConfig</servlet-name>
<servlet-class>io.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
<init-param>
<param-name>api.version</param-name>
<param-value>1.0</param-value>
</init-param>
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>http://localhost:8081/SampleRestProject/rest</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<!-- <welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list> -->
</web-app>
Service java class:
package com.danfoss.des;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.danfoss.model.Track;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
#Path("/helloWorld")
#Api(value="helloWorld", description="Sample hello world swagger service")
public class RESTfulHelloWorld
{
#GET
#Produces("text/html")
#Path("/startingPage")
#ApiOperation(value="Starting of the swagger service")
public Response getStartingPage()
{
String output = "Staring method is invoked";
return Response.status(200).entity(output).build();
}
}
My Project structure
The link am trying to access to view the list: http://localhost:8081/SampleRestProject/api-docs
Can someone please help me find out where exactly am going wrong or if I am missing out anything.
The JerseyJaxrsConfig class is part of the swagger-jersey2-jaxrs library and hence is not available when deploying the webapp, because you're using swagger-jersey-jaxrs combined with Jersey 1.9 (which is good).
Simply replace
<servlet-class>io.swagger.jaxrs.config.JerseyJaxrsConfig</servlet-class>
with
<servlet-class>io.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
to use the correct configuration class and then try accessing http://localhost:8081/SampleRestProject/rest/swagger.json again.
Also while you're at it, consider defining Swagger's basepath as a relative path so you're able to deploy the webapp on different ports.
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>/SampleRestProject/rest</param-value>
</init-param>

Apache Tomcat 9 - HTTP Status 404 on browser

I'm trying to create a simple web service, but I'm getting 404 when I try to go to the URL.
Here's the web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>Test</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>Test</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
Here's pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>1</groupId>
<artifactId>1</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.17</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20080701</version>
</dependency>
</dependencies>
</project>
And here's the basic rest class:
package Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
/**
* Created by * on 4.02.2017.
*/
#Path("/api")
public class Test {
#GET
#Path("/get/test")
public String getSmth(String request) {
return "Testing";
}
}
And when I go to:
http://127.0.0.1:8080/Test/rest/api/get/test
I get:
HTTP Status 404 -
type Status report
message
description The requested resource is not available.
Apache Tomcat/9.0.0.M17
When I go to the Tomcat app manager I can see my app running there. Am I doing something really wrong or missing something?
Thanks,
Eerik
In the code you are using glassfish server and not tomcat. In the IDE you are using try to use glassfish server instead of tomcat with the same code.

Jersey ClassNotFoundException when contextInitialized

When I connect to the selected servlet, it throw me a ClassNotFoundException. I am using eclipse neon with Tomcat8 and jersey RESTful framework. Its possible that I have the servlet conf in wrong in the web.xml?
Error showed:
SEVERE: Allocate exception for servlet jersey
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1332)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:518)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:499)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1102)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>org.CTAG.DATEX2REST</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<display-name>CTAG DATEX2</display-name>
<servlet>
<servlet-name>jersey</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>org.CTAG.DATEX2REST</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>jersey</servlet-name>
<url-pattern>/rest</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
com.CTAG.application.Init
</listener-class>
</listener>
</web-app>
The POM.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.CTAG.DATEX2REST</groupId>
<artifactId>org.CTAG.DATEX2REST</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>org.CTAG.DATEX2REST Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>org.CTAG.DATEX2REST</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>true</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Your web.xml content is incorrect, it matches with Jersey 2.x while you obviously use Jersey 1.x, indeed the package names start with com.sun.jersey in Jersey 1.x while in Jersey 2.x they start with org.glassfish.jersey.
Check here what should be the content of your web.xml in case of Jersey 1.x..
<servlet>
<servlet-name>jersey</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>org.CTAG.DATEX2REST</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>jersey</servlet-name>
<url-pattern>/rest</url-pattern>
</servlet-mapping>
Or switch to Jersey 2.x.
Fixing the dependencies
You are mixing Jersey 1.x (com.sun.jersey) and Jersey 2.x (org.glassfish.jersey).
I understand you wan't to use Jersey 2.x, so remove:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.9</version>
</dependency>
And then add to your pom.xml
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<!-- if your container implements Servlet API older
than 3.0, use "jersey-container-servlet-core" -->
<artifactId>jersey-container-servlet</artifactId>
<version>2.23.2</version>
</dependency>
Deploying in a Servlet 2.x container (like Tomcat 6)
Jersey integrates with any Servlet containers supporting at least Servlet 2.5 specification. For these environments, you have to explicitly declare the Jersey container servlet in your web application's web.xml deployment descriptor file:
<web-app>
<servlet>
<servlet-name>MyApplication</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
...
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>MyApplication</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
</web-app>
The content of the <init-param> element will vary depending on the way you decide to configure Jersey resources.
Deploying in a Servlet 3.x container (like Tomcat 7 and above)
In a Servlet 3.0 container, you just need to implement a custom Application / ResourceConfig subclass. For simple deployments, no web.xml is necessary at all. Instead, an #ApplicationPath annotation can be used to annotate the custom Application / ResourceConfig subclass and define the base application URI for all JAX-RS resources configured in the application:
#ApplicationPath("api")
public class MyApplication extends ResourceConfig {
public MyApplication() {
packages("org.foo.rest;org.bar.rest");
}
}
For other deployment options, have a look at the documentation.

REST api 404 on mapping

I am trying to create a rest api using jersey on glassfish 4 server.
Currently i am getting error 404 whenever I go to my mapping:
http://localhost:8080/LibraryRestTest/api/books
Sadly i get 0 errors on my glassfish console log. I have also tried manually deploying my war on glassfish admin console to result in the same error.
Is there something I haven't yet implemented ?
All files i have created in my project :
glassfish-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<context-root>/LibraryRestTest</context-root>
</glassfish-web-app>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<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>
com.koen.library
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
</web-app>
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.koen</groupId>
<artifactId>LibraryRestTest</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>WebContent\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jersey.version>2.22</jersey.version>
<parser.version>2.22</parser.version>
</properties>
<dependencies>
<dependency>
<groupId>com.koen.library</groupId>
<artifactId>libraryJPA</artifactId>
<version>0.0.1</version>
</dependency>
<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${jersey.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${parser.version}</version>
</dependency>
</dependencies>
</project>
BookResource.java
package com.koen.library;
import java.util.ArrayList;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import com.koen.library.pojo.Book;
#Path("books")
public class BookResource {
#GET
#Produces("application/json")
public ArrayList<Book> getAll(){
return new ArrayList<Book>(){{add(new Book(6, "The Brothers Karamazov", "Fyodor Dostoevsky"));}};
}
#GET
#Path("/{id}")
public Book getById(#PathParam ("id") int id){
return null;
}
}
Instead of mapping a jersey servlet in web.xml, you could configure your REST endpoint using Java code using standard Java EE 7 API (Application and #ApplicaionPath:
#ApplicationPath("api")
public class ApplicationConfig extends Application {
}
This will automatically attach all resources annotated with #Path to the api suffix.
If you do not want all resources to map to this suffix, you may list each class in particular, if you override getClasses() method:
#ApplicationPath("api")
public class ApplicationConfig extends Application {
#Override
public Set<Class<?>> getClasses() {
return Arrays.asList(com.koen.library.BookResource.class);
}
}
The fix to my problem was:
<param-value>true</param-value>
I had to add that line in my web.xml.
Now i don't get any 404 error on my mapping.
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<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>
com.koen.library
</param-value>
</init-param>
<param-value>true</param-value>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
</web-app>

Categories