jason.service.crusader
Class ServletCapsule

java.lang.Object
  |
  +--jason.service.crusader.ServletCapsule
All Implemented Interfaces:
javax.servlet.Servlet, ServletCapsuleInt

public class ServletCapsule
extends java.lang.Object
implements ServletCapsuleInt, javax.servlet.Servlet


Field Summary
static int capsuleID
           
protected  java.lang.String fileName
          Contains the filename of the servlet.
protected  long lastModified
          Denotes the time the servlet was last modified.
protected  boolean readyForService
          Indicates wether the servlet encapsulated is ready for servicing clients' requests or not.
protected  javax.servlet.Servlet servlet
           
protected  java.lang.String servletName
          The fully qualified name of the Servlet class.
static int servletObjectID
           
protected  boolean singleThreadModel
          Indicates wether the servlet implements javax.servlet.SingleThreadModel or not.
 
Constructor Summary
ServletCapsule()
           
 
Method Summary
 void destroy()
           
 int getCapsuleID()
           
 java.lang.String getFileName()
          Returns the real & absolute path name of the .class file of the Servlet
 long getLastModified()
          Returns the lastModified time of the .class file of the servlet.
 javax.servlet.Servlet getServlet()
          Returns the Servlet instance encapsulated
 javax.servlet.ServletConfig getServletConfig()
           
 java.lang.String getServletInfo()
           
 java.lang.String getServletName()
          Returns the fully qualified class name of the Servlet that is stoted in the capsule.
 int getServletObjectID()
           
 void init(javax.servlet.ServletConfig config)
           
 boolean isReadyForService()
          Returns wether a Servlet encapsulated is ready to service a client or not - it shall be predominantly used with Servlets implementing SingleThreadModel and during Servlet decapsulation.
 boolean isSingleThreadModel()
          Returns wether a Servlet encapsulated implements SingleThreadModel or not
 void service(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)
           
 void setFileName(java.lang.String fileName)
          The file name supplied shall have to be the absolute real path name of the .class file of the servlet - URLs are strictly not allowed.
 void setLastModified(long lastModified)
          This should not be called until and unless the Servlet has been reloaded.
 void setReadyForService(boolean readyForService)
          Sets the readyForService status for an encapsulated Servlet
 void setServlet(javax.servlet.Servlet servlet)
          This method replaces the Servlet encapsulated in the capsule.
 void setServletName(java.lang.String servletName)
          The String supplied shall have to be the fully qualified class name of the Servlet.
 void setSingleThreadModel(boolean singleThreadModel)
          Sets the singleThreadModel status for a Servlet that is encapsulated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

capsuleID

public static int capsuleID

servletObjectID

public static int servletObjectID

lastModified

protected long lastModified
Denotes the time the servlet was last modified.


servletName

protected java.lang.String servletName
The fully qualified name of the Servlet class.


fileName

protected java.lang.String fileName
Contains the filename of the servlet.


servlet

protected javax.servlet.Servlet servlet

singleThreadModel

protected boolean singleThreadModel
Indicates wether the servlet implements javax.servlet.SingleThreadModel or not.


readyForService

protected boolean readyForService
Indicates wether the servlet encapsulated is ready for servicing clients' requests or not. It shall be exclusively used for servlets with SingleThreadModel and to prevent the Servlet instance to handle any more requests prio to decapsulation (if the requirement is felt).
NOTE: SERVLETS IMPLEMENTING SingleThreadModel SHOULD NOT BE DECAPSULATED, THEY SHOULD BE ABANDONED ALTOGETHER. IF A CLIENT IS UNDER PROCESSING - THE CLIENT HAS A HIGH CHANCE OF GETTING LOST.

Constructor Detail

ServletCapsule

public ServletCapsule()
Method Detail

getCapsuleID

public int getCapsuleID()
Specified by:
getCapsuleID in interface ServletCapsuleInt

getServletObjectID

public int getServletObjectID()
Specified by:
getServletObjectID in interface ServletCapsuleInt

getLastModified

public long getLastModified()
Returns the lastModified time of the .class file of the servlet. It shall be used for Servlet reloading

Specified by:
getLastModified in interface ServletCapsuleInt

setLastModified

public void setLastModified(long lastModified)
This should not be called until and unless the Servlet has been reloaded.

Specified by:
setLastModified in interface ServletCapsuleInt

getServletName

public java.lang.String getServletName()
Returns the fully qualified class name of the Servlet that is stoted in the capsule.

Specified by:
getServletName in interface ServletCapsuleInt
Returns:
java.lang.String Indicating the fully qualified class name of the Servlet file.

setServletName

public void setServletName(java.lang.String servletName)
The String supplied shall have to be the fully qualified class name of the Servlet.

Specified by:
setServletName in interface ServletCapsuleInt

getFileName

public java.lang.String getFileName()
Returns the real & absolute path name of the .class file of the Servlet

Specified by:
getFileName in interface ServletCapsuleInt

setFileName

public void setFileName(java.lang.String fileName)
The file name supplied shall have to be the absolute real path name of the .class file of the servlet - URLs are strictly not allowed. The name have to be of the form native to the platform. This method shall not perform any conversion.

Specified by:
setFileName in interface ServletCapsuleInt

getServlet

public javax.servlet.Servlet getServlet()
Returns the Servlet instance encapsulated

Specified by:
getServlet in interface ServletCapsuleInt

setServlet

public void setServlet(javax.servlet.Servlet servlet)
This method replaces the Servlet encapsulated in the capsule. Extreme caution must be exercised while decapsulating a servlet - for normal Servlets, the readyForService variable should be set to "false" and the decapsulation should be conducted. For Servlets which implement SingleThreadModel, decapsulation should not be attempted.

Specified by:
setServlet in interface ServletCapsuleInt

isSingleThreadModel

public boolean isSingleThreadModel()
Returns wether a Servlet encapsulated implements SingleThreadModel or not

Specified by:
isSingleThreadModel in interface ServletCapsuleInt

setSingleThreadModel

public void setSingleThreadModel(boolean singleThreadModel)
Sets the singleThreadModel status for a Servlet that is encapsulated

Specified by:
setSingleThreadModel in interface ServletCapsuleInt

isReadyForService

public boolean isReadyForService()
Returns wether a Servlet encapsulated is ready to service a client or not - it shall be predominantly used with Servlets implementing SingleThreadModel and during Servlet decapsulation.

Specified by:
isReadyForService in interface ServletCapsuleInt

setReadyForService

public void setReadyForService(boolean readyForService)
Sets the readyForService status for an encapsulated Servlet

Specified by:
setReadyForService in interface ServletCapsuleInt

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
javax.servlet.ServletException

service

public void service(javax.servlet.ServletRequest request,
                    javax.servlet.ServletResponse response)
             throws javax.servlet.ServletException,
                    java.io.IOException
Specified by:
service in interface javax.servlet.Servlet
javax.servlet.ServletException
java.io.IOException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Servlet

getServletConfig

public javax.servlet.ServletConfig getServletConfig()
Specified by:
getServletConfig in interface javax.servlet.Servlet

getServletInfo

public java.lang.String getServletInfo()
Specified by:
getServletInfo in interface javax.servlet.Servlet