org.clazzes.util.http.osgi
Class DefaultHttpContext

java.lang.Object
  extended by org.clazzes.util.http.osgi.DefaultHttpContext
All Implemented Interfaces:
org.osgi.service.http.HttpContext

public class DefaultHttpContext
extends Object
implements org.osgi.service.http.HttpContext

A default HTTP context, which my be shared among bundles using the static instance returned by getInstance().

The method getResource(String) look up the resource under the context class loader of the current thread under normative path /OSGI-INF/webapp/.


Field Summary
static String MIME_TYPES_PROPERTY
          The system property to check for an alternative mime.types file to parse instead of the built-in classpath resource.
 
Fields inherited from interface org.osgi.service.http.HttpContext
AUTHENTICATION_TYPE, AUTHORIZATION, REMOTE_USER
 
Constructor Summary
DefaultHttpContext()
           
 
Method Summary
static Map<String,String> getExtensionMimeTypes()
           
static org.osgi.service.http.HttpContext getInstance()
           
 String getMimeType(String name)
           
 URL getResource(String name)
           
 boolean handleSecurity(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIME_TYPES_PROPERTY

public static final String MIME_TYPES_PROPERTY
The system property to check for an alternative mime.types file to parse instead of the built-in classpath resource.

See Also:
Constant Field Values
Constructor Detail

DefaultHttpContext

public DefaultHttpContext()
Method Detail

getInstance

public static final org.osgi.service.http.HttpContext getInstance()
Returns:
The static, shared instance for web application, which want to share HTTP sessions.

getExtensionMimeTypes

public static final Map<String,String> getExtensionMimeTypes()
Returns:
A static, unmodifiable view on the map of MIME types used by getMimeType(String) mapping extensions to MIME types.

handleSecurity

public boolean handleSecurity(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws IOException
Specified by:
handleSecurity in interface org.osgi.service.http.HttpContext
Throws:
IOException

getResource

public URL getResource(String name)
Specified by:
getResource in interface org.osgi.service.http.HttpContext

getMimeType

public String getMimeType(String name)
Specified by:
getMimeType in interface org.osgi.service.http.HttpContext


Copyright © 2012. All Rights Reserved.