com.sun.grizzly.osgi.httpservice
Class OSGiServletContext

java.lang.Object
  extended by com.sun.grizzly.http.servlet.ServletContextImpl
      extended by com.sun.grizzly.osgi.httpservice.OSGiServletContext
All Implemented Interfaces:
ServletContext

public class OSGiServletContext
extends ServletContextImpl

OSGi ServletContextImpl integration.

Author:
Hubert Iwaniuk

Constructor Summary
OSGiServletContext(org.osgi.service.http.HttpContext httpContext, Logger logger)
          Default constructor.
 
Method Summary
 String getMimeType(String file)
          OSGi integration.
 URL getResource(String path)
          OSGi integration.
 InputStream getResourceAsStream(String path)
          OSGi integration.
 
Methods inherited from class com.sun.grizzly.http.servlet.ServletContextImpl
destroyListeners, getAttribute, getAttributeNames, getBasePath, getContext, getContextPath, getInitParameter, getInitParameterNames, getListeners, getMajorVersion, getMinorVersion, getNamedDispatcher, getRealPath, getRequestDispatcher, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServlets, initListeners, log, log, log, normalize, removeAttribute, setAttribute, setBasePath, setContextPath, setDisplayName, setInitParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiServletContext

public OSGiServletContext(org.osgi.service.http.HttpContext httpContext,
                          Logger logger)
Default constructor.

Parameters:
httpContext - HttpContext to provide integration with OSGi.
logger - Logger util.
Method Detail

getResource

public URL getResource(String path)
                throws MalformedURLException
OSGi integration. Uses HttpContext.getResource(String).

Return the URL to the resource that is mapped to a specified path. The path must begin with a "/" and is interpreted as relative to the current context root.

Specified by:
getResource in interface ServletContext
Overrides:
getResource in class ServletContextImpl
Parameters:
path - The path to the desired resource
Throws:
MalformedURLException - if the path is not given in the correct form

getResourceAsStream

public InputStream getResourceAsStream(String path)
OSGi integration. Uses HttpContext.getResource(String).

Return the requested resource as an InputStream. The path must be specified according to the rules described under getResource. If no such resource can be identified, return null.

Specified by:
getResourceAsStream in interface ServletContext
Overrides:
getResourceAsStream in class ServletContextImpl
Parameters:
path - The path to the desired resource.

getMimeType

public String getMimeType(String file)
OSGi integration. Uses HttpContext.getMimeType(String).

Return the MIME type of the specified file, or null if the MIME type cannot be determined.

Specified by:
getMimeType in interface ServletContext
Overrides:
getMimeType in class ServletContextImpl
Parameters:
file - Filename for which to identify a MIME type


Copyright © 2012 Oracle Corporation. All Rights Reserved.