org.eclipse.persistence.jpa.rs.jersey
Class PortableServletContainer
java.lang.Object
org.eclipse.persistence.jpa.rs.jersey.PortableServletContainer
public class PortableServletContainer
- extends java.lang.Object
Jersey Servlet/Filter class that can be referenced in web.xml instead of Jersey 1.x specific
com.sun.jersey.spi.container.servlet.ServletContainer and Jersey 2.x specific
org.glassfish.jersey.servlet.ServletContainer to enable web application portability between
Jersey 1.x and Jersey 2.x servlet containers.
Since for some of the servlet init parameters that can be
specified in web.xml you may want different values depending on which version of Jersey container is present,
You can prefix the init parameter name either with jersey1# or jersey2# to
make it specific to a given version. For example, to specify different values for
javax.ws.rs.Application init parameter depending on the version of Jersey used, you can include
the following in your web.xml:
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.portability.PortableServletContainer</servlet-class>
<init-param>
<param-name>jersey1#javax.ws.rs.Application</param-name>
<param-value>myapp.jersey1specific.Jersey1Application</param-value>
</init-param>
<init-param>
<param-name>jersey2#javax.ws.rs.Application</param-name>
<param-value>myapp.jersey2specific.Jersey2Application</param-value>
</init-param>
</servlet>
- Author:
- Martin Matula (martin.matula at oracle.com)
|
Method Summary |
void |
destroy()
|
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
|
ServletConfig |
getServletConfig()
|
java.lang.String |
getServletInfo()
|
void |
init(FilterConfig filterConfig)
|
void |
init(ServletConfig config)
|
void |
service(ServletRequest req,
ServletResponse res)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PortableServletContainer
public PortableServletContainer()
- Create a new servlet container.
init
public void init(FilterConfig filterConfig)
throws ServletException
- Throws:
ServletException
doFilter
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws java.io.IOException,
ServletException
- Throws:
java.io.IOException
ServletException
init
public void init(ServletConfig config)
throws ServletException
- Throws:
ServletException
getServletConfig
public ServletConfig getServletConfig()
service
public void service(ServletRequest req,
ServletResponse res)
throws ServletException,
java.io.IOException
- Throws:
ServletException
java.io.IOException
getServletInfo
public java.lang.String getServletInfo()
destroy
public void destroy()