Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

JSPservletPkg
Class JSPhandler.ClassEntry  view JSPhandler.ClassEntry download JSPhandler.ClassEntry.java

java.lang.Object
  extended byJSPservletPkg.JSPhandler.ClassEntry
All Implemented Interfaces:
org.osgi.service.http.HttpContext
Enclosing class:
JSPhandler

class JSPhandler.ClassEntry
extends java.lang.Object
implements org.osgi.service.http.HttpContext

Class invoked by JSPhandler for a given jar name. It caches created target servlets and JSPs and manages a JSPloader. The JES2 ClassEntry implements the archive HttpContext.


Nested Class Summary
(package private)  class JSPhandler.ClassEntry.ServletInfo
          Class of servletObjects entries.
(package private)  class JSPhandler.ClassEntry.Stat
          wraps statistic data.
 
Field Summary
(package private)  BasicSchemeHandler basic
          Security (page access) handler object
(package private)  JSPhandler handler
          back pointer on JSPhandler
(package private)  java.lang.String jarName
          jar name
(package private)  java.lang.String jarURL
          jar remote location (URL)
(package private)  JSPloader jl
          ClassLoader
(package private)  java.util.HashMap servletObjects
          HashMap key: class name (full path) value: ServletInfo
(package private)  JSPhandler.ClassEntry.Stat stat
          Archive statistic object created in ClassEntry constructor.
 
Fields inherited from interface org.osgi.service.http.HttpContext
AUTHENTICATION_TYPE, AUTHORIZATION, REMOTE_USER
 
Constructor Summary
(package private) JSPhandler.ClassEntry(JSPhandler jh, java.lang.String jarName, java.lang.String jarURL)
          Constructor.
 
Method Summary
private  void buildResources()
          Register resources starting with the archive name.
private  void buildServlets()
          Creates servlets found in the archive and registers them.
private  void challenge(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Service method invoked by handleSecurity.
(package private)  void delete()
          Clears itself and class loaded stuff.
protected  void finalize()
          to avoid loitering
 java.lang.String getMimeType(java.lang.String str)
          HttpContext getMimeType.
 java.net.URL getResource(java.lang.String str)
          HttpContext getResource.
 boolean handleSecurity(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Handle security for a request.
private  javax.servlet.Servlet instantiate(java.lang.String classPath, java.lang.Class jspClass)
          Creates a servlet using JSPloader and stores it in servletObjects.
private  boolean isServlet(java.lang.Class cl)
          Checks if a class implements Servlet.
(package private)  void update(java.lang.String remoteLocation)
          Clears itself and class loaded stuff and recreates class loader.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jl

JSPloader jl
ClassLoader


jarName

java.lang.String jarName
jar name


jarURL

java.lang.String jarURL
jar remote location (URL)


servletObjects

java.util.HashMap servletObjects
HashMap key: class name (full path) value: ServletInfo

See Also:
JSPhandler.ClassEntry.ServletInfo

handler

JSPhandler handler
back pointer on JSPhandler


stat

JSPhandler.ClassEntry.Stat stat
Archive statistic object created in ClassEntry constructor.


basic

BasicSchemeHandler basic
Security (page access) handler object

Constructor Detail

JSPhandler.ClassEntry

JSPhandler.ClassEntry(JSPhandler jh,
                      java.lang.String jarName,
                      java.lang.String jarURL)
                throws JSPloaderException
Constructor.
  • get JAR remote location from remoteLocations.
  • Creates JSPloader.
  • Instanciates a servletObjects target cache.

Method Detail

getResource

public java.net.URL getResource(java.lang.String str)
HttpContext getResource.

Specified by:
getResource in interface org.osgi.service.http.HttpContext

getMimeType

public java.lang.String getMimeType(java.lang.String str)
HttpContext getMimeType. In most cases, better to return null. Could return "text/html".

Specified by:
getMimeType in interface org.osgi.service.http.HttpContext

handleSecurity

public boolean handleSecurity(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse res)
Handle security for a request. HttpService calls this method prior to servicing a request.

Specified by:
handleSecurity in interface org.osgi.service.http.HttpContext

challenge

private final void challenge(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse res)
Service method invoked by handleSecurity.


isServlet

private final boolean isServlet(java.lang.Class cl)
Checks if a class implements Servlet. Recursive invocation.


buildServlets

private void buildServlets()
                    throws JSPloaderException
Creates servlets found in the archive and registers them. Invoked in constructor and update methods. To select classes to instanciate, uses reflection and scans the inheritence hierarchy for Servlet.


buildResources

private void buildResources()
Register resources starting with the archive name. I use a replacement to com.sun.jes.impl.http.ResourceServlet.


delete

final void delete()
Clears itself and class loaded stuff.


update

final void update(java.lang.String remoteLocation)
           throws JSPloaderException
Clears itself and class loaded stuff and recreates class loader.
  1. Enumerates servletObjects target cache and destroys each target found
  2. Clear references.
  3. Invokes garbage collector.
  4. Creates new JSPloader.
  5. Instanciates a new servletObjects target cache.


instantiate

private javax.servlet.Servlet instantiate(java.lang.String classPath,
                                          java.lang.Class jspClass)
                                   throws JSPloaderException
Creates a servlet using JSPloader and stores it in servletObjects. In JES2 implementation, servletObjects acts as a repository of servlets to unregister.


finalize

protected void finalize()
to avoid loitering