JSPservletPkg
Class JSPhandler

java.lang.Object
  |
  +--JSPservletPkg.JSPhandler

public class JSPhandler
extends java.lang.Object

Class invoked by JSPservlet for a given context path. It forwards the requests to a compiled jsp or servlet loaded by JSPloader.

Changes:

Copyright (c) 2000-2001

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; version 2
 of the License.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 

Version:
1, 0, 4
Author:
Alexis Grandemange
See Also:
JSPservlet, JSPhandler.ClassEntry, JSPloader

Inner Class Summary
(package private)  class JSPhandler.ClassEntry
          Class invoked by JSPhandler for a given jar name.
 class JSPhandler.Log
          Class wraping trace use.
(package private)  class JSPhandler.Scanner
          Implements a scanner thread.
 
Field Summary
(package private)  byte[][] aErrorPage
          Area of error handling pages
(package private)  java.lang.String allPermissionPolicy
          describes an default policy file and set sandbox for archive execution.
(package private)  CacheIntf cache
          Version 1.0.4.
(package private)  java.lang.String cachePath
          path were jars are locally stored - initialized by constructor.
(package private)  java.lang.String CALDAPpasswd
          Password to use to connect to LDAP for CA certificate.
(package private)  java.lang.String CALDAPuser
          Principal to use to connect to LDAP for CA certificate.
(package private)  java.lang.String CAURL
          URL to access CA certificate in LDAP.
(package private)  java.util.HashMap classEntries
          ClassEntry HashMap. key: jar name value: ClassEntry
(package private)  java.lang.String[] classPath
          Version 1.0.4.
(package private)  ClassPathLoader classPathLoader
          Version 1.0.4.
 java.lang.String cpath
          Version 1.0.4.
(package private)  java.lang.String CRLLDAPpasswd
          Password to use to connect to LDAP for CRL.
(package private)  java.lang.String CRLLDAPuser
          Principal to use to connect to LDAP for CRL.
(package private)  int CRLperiod
          Certificate Revocation List Scan Period in seconds.
(package private)  java.lang.String CRLURL
          URL to access Certificate Revocation List in LDAP.
(package private)  java.lang.String defaultPolicy
          describes a policy for archive without policy.
(package private) static int EP_NOTFOUND
          servlet or resource not found
(package private) static int EP_OTHER
          other errors
(package private) static int EP_REVOKED
          archive certificate revoked
(package private) static int EP_SIZE
          error page array size
(package private) static int EP_UNAUTHORIZED
          servlet attempted an unauthorized access
(package private)  int expiration
          resources expiration time in seconds - initialized by constructor.
(package private)  java.lang.String ID
          PageBox unique identifier
(package private)  java.lang.String keystore
          keystore location.
(package private)  java.lang.String keystorePassword
          keystore password.
 JSPhandler.Log log
          Handle on Log object.
(package private)  java.lang.String mapperCacheFile
          Version 1.0.4.
(package private)  java.util.Properties mappingProp
          Version 1.0.4.
(package private)  java.lang.String pageboxMapping
          Version 1.0.4.
(package private)  java.util.Properties publisherProp
          Version 1.0.3.
(package private)  java.lang.String publishers
          Publisher property file name.
(package private)  java.lang.String remoteLocFile
          remote locations properties file name - initialized by constructor.
(package private)  java.util.Properties remoteLocProp
          remote locations Properties - initialized by constructor.
(package private) static int SCANPERIOD
          Scanner wake-up
(package private)  java.lang.ClassLoader servletClassLoader
          ClassLoader used to create JSPservlet.
(package private)  JSPservletPkg.ServletConfig servletConfig
          ServletConfig - provided by JSPservlet.
(package private)  boolean toStat
          record statistics or not
 
Constructor Summary
(package private) JSPhandler(JSPservletPkg.ServletConfig sc, java.lang.String contextPath, JSPservletPkg.ServletContext ctx, java.lang.String URI, java.lang.String URIRealPath)
          Version 1.0.3: + publishers.
Version 1.0.4: + mapperCacheFile, classPath, overClassPath, pageboxMapping.
 
Method Summary
 void delete(java.lang.String jarName)
          Invoked by ServletUpdate.
protected  void finalize()
          to avoid loitering
(package private)  JSPservletPkg.Servlet get(java.lang.String jarName, java.lang.String classPath)
          Invoked by JSPservlet.
(package private)  byte[] getErrorBuf(JSPservletPkg.ServletContext ctx, java.lang.String name)
           
(package private)  long getLastModified(java.lang.String jarName, java.lang.String classPath)
          Invoked by JSPservlet.
(package private)  MapperIntf getMapper(java.lang.String jarName)
          Version 1.0.3 Invoked by JSPservlet.
(package private)  java.io.InputStream getResourceAsStream(java.lang.String jarName, java.lang.String classPath)
          Invoked by JSPservlet.
(package private)  java.util.Properties getRoutingPages(java.lang.String jarName)
          Version 1.0.3 Invoked by JSPservlet.
(package private)  BackCheck getRoutingResource(java.lang.String jarName, java.lang.String classPath)
          Version 1.0.3 Invoked by JSPservlet.
 boolean publisherUpdate(java.lang.String jarName, java.lang.String publisher)
          Version 1.0.3. Invoked by JSPservlet and ServletUpdate. Updates and persists remote properties. Assumes jarName and publisher are not null.
 boolean update(java.lang.String jarName, java.lang.String remoteLocation)
          Invoked by JSPservlet, ServletUpdate and JSPupdate.
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

cachePath

java.lang.String cachePath
path were jars are locally stored - initialized by constructor.
See Also:
JSPhandler.ClassEntry, JSPloader

classEntries

java.util.HashMap classEntries
ClassEntry HashMap. key: jar name value: ClassEntry

remoteLocFile

java.lang.String remoteLocFile
remote locations properties file name - initialized by constructor.
See Also:
JSPhandler.ClassEntry

mapperCacheFile

java.lang.String mapperCacheFile
Version 1.0.4. Persistent mapper cache file.

cache

CacheIntf cache
Version 1.0.4. Mapper cache.

log

public JSPhandler.Log log
Handle on Log object.

remoteLocProp

java.util.Properties remoteLocProp
remote locations Properties - initialized by constructor.
See Also:
update(String jarName, String remoteLocation), JSPhandler.ClassEntry

servletConfig

JSPservletPkg.ServletConfig servletConfig
ServletConfig - provided by JSPservlet.
See Also:
JSPhandler.ClassEntry

servletClassLoader

java.lang.ClassLoader servletClassLoader
ClassLoader used to create JSPservlet.

defaultPolicy

java.lang.String defaultPolicy
describes a policy for archive without policy.

allPermissionPolicy

java.lang.String allPermissionPolicy
describes an default policy file and set sandbox for archive execution.

keystore

java.lang.String keystore
keystore location. Also states if policy should be downloaded.

keystorePassword

java.lang.String keystorePassword
keystore password.

expiration

int expiration
resources expiration time in seconds - initialized by constructor.

CRLURL

java.lang.String CRLURL
URL to access Certificate Revocation List in LDAP. Initialized by constructor.

CRLLDAPuser

java.lang.String CRLLDAPuser
Principal to use to connect to LDAP for CRL. Initialized by constructor.

CRLLDAPpasswd

java.lang.String CRLLDAPpasswd
Password to use to connect to LDAP for CRL. Initialized by constructor.

CRLperiod

int CRLperiod
Certificate Revocation List Scan Period in seconds. Initialized by constructor.

CAURL

java.lang.String CAURL
URL to access CA certificate in LDAP. Initialized by constructor.

CALDAPuser

java.lang.String CALDAPuser
Principal to use to connect to LDAP for CA certificate. Initialized by constructor.

CALDAPpasswd

java.lang.String CALDAPpasswd
Password to use to connect to LDAP for CA certificate. Initialized by constructor.

toStat

boolean toStat
record statistics or not

publishers

java.lang.String publishers
Publisher property file name.

publisherProp

java.util.Properties publisherProp
Version 1.0.3. Publisher Properties - initialized by constructor.
  • Key: Archive name.
  • Value: Publisher.

  • EP_OTHER

    static final int EP_OTHER
    other errors

    EP_NOTFOUND

    static final int EP_NOTFOUND
    servlet or resource not found

    EP_UNAUTHORIZED

    static final int EP_UNAUTHORIZED
    servlet attempted an unauthorized access

    EP_REVOKED

    static final int EP_REVOKED
    archive certificate revoked

    EP_SIZE

    static final int EP_SIZE
    error page array size

    SCANPERIOD

    static final int SCANPERIOD
    Scanner wake-up

    aErrorPage

    byte[][] aErrorPage
    Area of error handling pages

    ID

    java.lang.String ID
    PageBox unique identifier

    cpath

    public java.lang.String cpath
    Version 1.0.4. Support archives.

    classPath

    java.lang.String[] classPath
    Version 1.0.4. Support archives.

    classPathLoader

    ClassPathLoader classPathLoader
    Version 1.0.4. Class loader for classPath archives.

    pageboxMapping

    java.lang.String pageboxMapping
    Version 1.0.4. Pagebox mapping property file name.

    mappingProp

    java.util.Properties mappingProp
    Version 1.0.4. Suffix mapping - initialized by constructor.
  • Key: Suffix.
  • Value: class name.
  • Constructor Detail

    JSPhandler

    JSPhandler(JSPservletPkg.ServletConfig sc,
               java.lang.String contextPath,
               JSPservletPkg.ServletContext ctx,
               java.lang.String URI,
               java.lang.String URIRealPath)
         throws JSPloaderException
    Version 1.0.3: + publishers.
    Version 1.0.4: + mapperCacheFile, classPath, overClassPath, pageboxMapping.

    Constructor.

    1. Initializes parameters from web.xml.
    2. Opens the logfile.
    3. Restore remoteLocation properties.

    Parameters:

    Parameters:
    sc - ServletConfig used to initialize target classes.
    contextPath - application prefix.
    Throws:
    JSPloaderException - creation of log failure.
    Method Detail

    getErrorBuf

    final byte[] getErrorBuf(JSPservletPkg.ServletContext ctx,
                             java.lang.String name)

    get

    final JSPservletPkg.Servlet get(java.lang.String jarName,
                                    java.lang.String classPath)
                             throws JSPloaderException,
                                    java.lang.ClassNotFoundException
    Invoked by JSPservlet.
    1. Search ClassEntry with jarName. Creates it if not found
    2. invokes ClassEntry.get()
    Parameters:
    jarName - first part of the path requested by the browser.
    classPath - last part of the path requested by the browser.
    Returns:
    the requested Servlet.
    Throws:
    JSPloaderException - see log for reason.
    See Also:
    JSPhandler.ClassEntry.get(String classPath), JSPservlet.service(HttpServletRequest request, HttpServletResponse response)

    delete

    public final void delete(java.lang.String jarName)
    Invoked by ServletUpdate.
    Parameters:
    jarName - name of the jar.

    publisherUpdate

    public final boolean publisherUpdate(java.lang.String jarName,
                                         java.lang.String publisher)
                                  throws JSPloaderException
    Version 1.0.3.
    Parameters:
    jarName - name of the jar.
    remoteLocation - URL where to download the jar.
    Returns:
    boolean false if forbidden operation (archive already published by another publisher).

    update

    public final boolean update(java.lang.String jarName,
                                java.lang.String remoteLocation)
                         throws JSPloaderException
    Invoked by JSPservlet, ServletUpdate and JSPupdate.
    1. Remove local cache
    2. If remote location was set by JSPupdate, updates and persists remote properties.
    3. Search ClassEntry with jarName. Creates it if not found

    Parameters:
    jarName - name of the jar.
    remoteLocation - URL where to download the jar.
    Returns:
    boolean true if jarName found or false otherwise.
    Throws:
    JSPloaderException - in ClassEntry.get or when persisting modified properties.
    See Also:
    JSPhandler.ClassEntry.update(String remoteLocation), JSPservlet.service(HttpServletRequest request, HttpServletResponse response)

    getResourceAsStream

    final java.io.InputStream getResourceAsStream(java.lang.String jarName,
                                                  java.lang.String classPath)
                                           throws JSPloaderException,
                                                  java.lang.ClassNotFoundException
    Invoked by JSPservlet.
    1. Find remote location in remoteProperties
    2. Find resource in cache.
    3. If not found, download it and store it in cache

    Parameters:
    jarName - name of the jar.
    classPath - path to the resource.
    Returns:
    InputStream on resource.
    See Also:
    JSPservlet.service(HttpServletRequest request, HttpServletResponse response)

    getLastModified

    final long getLastModified(java.lang.String jarName,
                               java.lang.String classPath)
                        throws JSPloaderException,
                               java.lang.ClassNotFoundException
    Invoked by JSPservlet.
    1. Find remote location in remoteProperties
    2. Find resource in cache.
    3. If not found, download it and store it in cache

    Parameters:
    jarName - name of the jar.
    classPath - path to the resource.
    Returns:
    last modified time of resource.
    See Also:
    JSPservlet.service(HttpServletRequest request, HttpServletResponse response)

    getRoutingPages

    final java.util.Properties getRoutingPages(java.lang.String jarName)
                                        throws JSPloaderException,
                                               java.lang.ClassNotFoundException
    Version 1.0.3

    Invoked by JSPservlet. Returns getRoutingPages for an archive.

    Parameters:
    jarName - name of the jar.
    Returns:
    Properties.

    getMapper

    final MapperIntf getMapper(java.lang.String jarName)
                        throws JSPloaderException,
                               java.lang.ClassNotFoundException
    Version 1.0.3

    Invoked by JSPservlet. Returns MapperIntf for an archive.

    Parameters:
    jarName - name of the jar.
    Returns:
    MapperIntf.

    getRoutingResource

    final BackCheck getRoutingResource(java.lang.String jarName,
                                       java.lang.String classPath)
                                throws JSPloaderException,
                                       java.lang.ClassNotFoundException
    Version 1.0.3

    Invoked by JSPservlet. Find if a resource is a routing resource.

    Parameters:
    jarName - name of the jar.
    classPath - path to the resource.
    Returns:
    Mapper if routing resource or null.

    finalize

    protected void finalize()
    to avoid loitering
    Overrides:
    finalize in class java.lang.Object