public class PortableServletContainer extends Object implements javax.servlet.Filter, javax.servlet.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(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
javax.servlet.ServletConfig |
getServletConfig() |
String |
getServletInfo() |
void |
init(javax.servlet.FilterConfig filterConfig) |
void |
init(javax.servlet.ServletConfig config) |
void |
service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res) |
public PortableServletContainer()
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
javax.servlet.ServletException
public javax.servlet.ServletConfig getServletConfig()
getServletConfig
in interface javax.servlet.Servlet
public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, IOException
service
in interface javax.servlet.Servlet
javax.servlet.ServletException
IOException
public String getServletInfo()
getServletInfo
in interface javax.servlet.Servlet
public void destroy()
destroy
in interface javax.servlet.Filter
destroy
in interface javax.servlet.Servlet
Copyright © 2007-2015, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.