public class PortableServletContainer extends Object implements Filter, Servlet
com.sun.jersey.spi.container.servlet.ServletContainer and Jersey 2.x specific
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>
| Constructor and Description |
|---|
PortableServletContainer()
Create a new servlet container.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain) |
ServletConfig |
getServletConfig() |
String |
getServletInfo() |
void |
init(FilterConfig filterConfig) |
void |
init(ServletConfig config) |
void |
service(ServletRequest req,
ServletResponse res) |
public PortableServletContainer()
public void init(FilterConfig filterConfig) throws ServletException
init in interface FilterServletExceptionpublic void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
doFilter in interface FilterIOExceptionServletExceptionpublic void init(ServletConfig config) throws ServletException
init in interface ServletServletExceptionpublic ServletConfig getServletConfig()
getServletConfig in interface Servletpublic void service(ServletRequest req, ServletResponse res) throws ServletException, IOException
service in interface ServletServletExceptionIOExceptionpublic String getServletInfo()
getServletInfo in interface ServletCopyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.