org.ow2.jonas.web.base.osgi.httpservice
Class OSGIResourcesServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.ow2.jonas.web.base.osgi.httpservice.OSGIResourcesServlet
- All Implemented Interfaces:
- Serializable, Servlet, ServletConfig
public class OSGIResourcesServlet
- extends HttpServlet
Servlet deployed to server when resources are registered with
HttpService#registerResources(String, String, HttpContext)
.
- Author:
- Guillaume Porcher
- See Also:
- Serialized Form
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OSGIResourcesServlet
public OSGIResourcesServlet(org.osgi.service.http.HttpContext httpContext,
String baseName)
- Default constructor.
- Parameters:
httpContext
- The HttpContext used during servlet or resource
registration.baseName
- The base name of the resources that are registered.
doGet
protected void doGet(HttpServletRequest req,
HttpServletResponse resp)
throws IOException
- Called by the server (via the service method) to allow a servlet to
handle a GET request. A target resource name is constructed by adding
baseName to request path. The resource URL is resolved by using
HttpContext.getResource(String)
. The contents of the resource is
then returned to the client.
- Overrides:
doGet
in class HttpServlet
- Parameters:
req
- an HttpServletRequest object that contains the request the
client has made of the servletresp
- an HttpServletResponse object that contains the response the
servlet sends to the client
- Throws:
IOException
- if an input or output error is detected when the
servlet handles the request
doPost
protected void doPost(HttpServletRequest req,
HttpServletResponse resp)
throws IOException
- Called by the server (via the service method) to allow a servlet to
handle a POST request. This method internally calls
doGet(HttpServletRequest, HttpServletResponse)
.
- Overrides:
doPost
in class HttpServlet
- Parameters:
req
- an HttpServletRequest object that contains the request the
client has made of the servletresp
- an HttpServletResponse object that contains the response the
servlet sends to the client
- Throws:
IOException
- if an input or output error is detected when the
servlet handles the request
Copyright © 2013 OW2 Consortium. All Rights Reserved.