org.glassfish.jersey.servlet
Class WebComponent

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

public class WebComponent
extends Object

An abstract Web component that may be extended by a Servlet and/or Filter implementation, or encapsulated by a Servlet or Filter implementation.

Author:
Paul Sandoz

Constructor Summary
WebComponent(ResourceConfig resourceConfig)
           
WebComponent(WebConfig webConfig)
           
 
Method Summary
protected  ResourceConfig getDefaultResourceConfig(Map<String,Object> props, WebConfig wc, org.glassfish.hk2.Module... modules)
          Get the default resource configuration if one is not declared in the web.xml.
 int service(URI baseUri, URI requestUri, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          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)
             throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

WebComponent

public WebComponent(ResourceConfig resourceConfig)
             throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException
Method Detail

service

public int service(URI baseUri,
                   URI requestUri,
                   javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            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.
request - the HttpServletRequest object that contains the request the client made to the Web component.
response - the HttpServletResponse object that contains the response the Web component returns to the client.
Returns:
the status code of the response.
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.

getDefaultResourceConfig

protected ResourceConfig getDefaultResourceConfig(Map<String,Object> props,
                                                  WebConfig wc,
                                                  org.glassfish.hk2.Module... modules)
                                           throws javax.servlet.ServletException
Get the default resource configuration if one is not declared in the web.xml.

This implementation returns an instance of ResourceConfig that scans in files and directories as declared by the ServerProperties.PROVIDER_CLASSPATH property value if present, otherwise in the "WEB-INF/lib" and "WEB-INF/classes" directories.

An inheriting class may override this method to supply a different default resource configuration implementation.

Parameters:
props - the properties to pass to the resource configuration.
wc - the web configuration.
modules - modules to pass to the Application configuration.
Returns:
the default resource configuration.
Throws:
javax.servlet.ServletException - in case of any issues with providing the default resource configuration.


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.