org.glassfish.jersey.servlet
Class WebComponent

java.lang.Object
  extended by org.glassfish.jersey.servlet.WebComponent

public class WebComponent
extends Object

An common Jersey web component that may be extended by a Servlet and/or Filter implementation, or encapsulated by a Servlet or Filter implementation.

Author:
Paul Sandoz (paul.sandoz at oracle.com), Jakub Podlesak (jakub.podlesak at oracle.com), Marek Potociar (marek.potociar at oracle.com), Martin Matula (martin.matula at oracle.com)

Constructor Summary
WebComponent(WebConfig webConfig, ResourceConfig resourceConfig)
          Create and initialize new web component instance.
 
Method Summary
static Map<String,Object> getContextParams(javax.servlet.ServletContext servletContext)
          Extract context param from ServletContext.
 Value<Integer> service(URI baseUri, URI requestUri, javax.servlet.http.HttpServletRequest servletRequest, javax.servlet.http.HttpServletResponse servletResponse)
          Dispatch client requests to a resource class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebComponent

public WebComponent(WebConfig webConfig,
                    ResourceConfig resourceConfig)
             throws javax.servlet.ServletException
Create and initialize new web component instance.

Parameters:
webConfig - we component configuration.
resourceConfig - Jersey application configuration.
Throws:
javax.servlet.ServletException - in case the Jersey application cannot be created from the supplied resource configuration.
Method Detail

service

public Value<Integer> service(URI baseUri,
                              URI requestUri,
                              javax.servlet.http.HttpServletRequest servletRequest,
                              javax.servlet.http.HttpServletResponse servletResponse)
                       throws javax.servlet.ServletException,
                              IOException
Dispatch client requests to a resource class.

Parameters:
baseUri - the base URI of the request.
requestUri - the URI of the request.
servletRequest - the HttpServletRequest object that contains the request the client made to the Web component.
servletResponse - the HttpServletResponse object that contains the response the Web component returns to the client.
Returns:
lazily initialized response status code value provider.
Throws:
IOException - if an input or output error occurs while the Web component is handling the HTTP request.
javax.servlet.ServletException - if the HTTP request cannot be handled.

getContextParams

public static Map<String,Object> getContextParams(javax.servlet.ServletContext servletContext)
Extract context param from ServletContext.

Parameters:
servletContext - actual servlet context.
Returns:
map representing current context parameters.


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.