org.w3c.jigsaw.servlet
Class JigsawServletContext

java.lang.Object
  |
  +--org.w3c.tools.resources.event.StructureChangedAdapter
        |
        +--org.w3c.jigsaw.servlet.JigsawServletContext

public class JigsawServletContext
extends StructureChangedAdapter
implements javax.servlet.ServletContext, PropertyMonitoring


Field Summary
protected static java.lang.String deflogfile
           
protected static java.lang.String logdir
           
 
Constructor Summary
protected JigsawServletContext(ResourceReference ref, ObservableProperties props)
          Create a new ServletContext.
 
Method Summary
protected  AutoReloadServletLoader createNewLocalServletLoader(boolean keepold)
           
 java.lang.Object getAttribute(java.lang.String name)
          ServletContext implementation - Get an attribute value.
 java.util.Enumeration getAttributeNames()
           
 javax.servlet.ServletContext getContext(java.lang.String uripath)
           
protected  AutoReloadServletLoader getLocalServletLoader()
          Get or create a suitable LocalServletLoader instance to load that servlet.
 int getMajorVersion()
           
 java.lang.String getMimeType(java.lang.String filename)
          ServletContext implementation - Get the MIME type for given file.
 int getMinorVersion()
           
 java.lang.String getRealPath(java.lang.String path)
          ServletContext implementation - Translate a piece of path.
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String urlpath)
          Returns a RequestDispatcher object for the specified URL path if the context knows of an active source (such as a servlet, JSP page, CGI script, etc) of content for the particular path.
 java.net.URL getResource(java.lang.String path)
           
 java.io.InputStream getResourceAsStream(java.lang.String path)
           
 ServerInterface getServer()
           
 java.lang.String getServerInfo()
          ServletContext implementation - Get server informations.
 javax.servlet.Servlet getServlet(java.lang.String name)
          Deprecated. since jsdk2.1
 java.io.File getServletDirectory()
           
 java.io.File getServletLogFile()
           
 java.util.Enumeration getServletNames()
          Deprecated. since jsdk2.1
 java.util.Enumeration getServlets()
          Deprecated. since jsdk2.1
protected  long getServletTimeout()
           
protected static java.lang.String guessContentTypeFromName(java.lang.String fname)
          A useful utility routine that tries to guess the content-type of an object based upon its extension.
 void log(java.lang.Exception ex, java.lang.String msg)
          Deprecated. since jsdk2.1
 void log(java.lang.String msg)
          ServletContext implementation - Log a message.
 void log(java.lang.String message, java.lang.Throwable throwable)
           
 boolean propertyChanged(java.lang.String name)
           
 void removeAttribute(java.lang.String name)
           
 void resourceUnloaded(StructureChangedEvent evt)
           
 void setAttribute(java.lang.String name, java.lang.Object object)
           
 
Methods inherited from class org.w3c.tools.resources.event.StructureChangedAdapter
resourceCreated, resourceModified, resourceRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logdir

protected static java.lang.String logdir

deflogfile

protected static java.lang.String deflogfile
Constructor Detail

JigsawServletContext

protected JigsawServletContext(ResourceReference ref,
                               ObservableProperties props)
Create a new ServletContext.
Parameters:
ref - a ResourceReference pointing on a ServletDirectoryFrame.
Method Detail

propertyChanged

public boolean propertyChanged(java.lang.String name)
Specified by:
propertyChanged in interface PropertyMonitoring

resourceUnloaded

public void resourceUnloaded(StructureChangedEvent evt)
Overrides:
resourceUnloaded in class StructureChangedAdapter

getServletTimeout

protected long getServletTimeout()

guessContentTypeFromName

protected static java.lang.String guessContentTypeFromName(java.lang.String fname)
A useful utility routine that tries to guess the content-type of an object based upon its extension.

getMimeType

public java.lang.String getMimeType(java.lang.String filename)
ServletContext implementation - Get the MIME type for given file.
Specified by:
getMimeType in interface javax.servlet.ServletContext

getServer

public ServerInterface getServer()

getServletLogFile

public java.io.File getServletLogFile()

getServlet

public javax.servlet.Servlet getServlet(java.lang.String name)
Deprecated. since jsdk2.1
ServletContext implementation - Lookup a given servlet.
Specified by:
getServlet in interface javax.servlet.ServletContext

getServlets

public java.util.Enumeration getServlets()
Deprecated. since jsdk2.1
ServletContext implementation - Enumerate all servlets within context.
Specified by:
getServlets in interface javax.servlet.ServletContext

getServletNames

public java.util.Enumeration getServletNames()
Deprecated. since jsdk2.1
ServletContext implementation - Enumerate all servlets names within context.
Specified by:
getServletNames in interface javax.servlet.ServletContext

log

public void log(java.lang.String msg)
ServletContext implementation - Log a message.
Specified by:
log in interface javax.servlet.ServletContext

log

public void log(java.lang.Exception ex,
                java.lang.String msg)
Deprecated. since jsdk2.1
Specified by:
log in interface javax.servlet.ServletContext

log

public void log(java.lang.String message,
                java.lang.Throwable throwable)
Specified by:
log in interface javax.servlet.ServletContext

getRealPath

public java.lang.String getRealPath(java.lang.String path)
ServletContext implementation - Translate a piece of path.
Specified by:
getRealPath in interface javax.servlet.ServletContext

getServerInfo

public java.lang.String getServerInfo()
ServletContext implementation - Get server informations.
Specified by:
getServerInfo in interface javax.servlet.ServletContext

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
ServletContext implementation - Get an attribute value. We map this into the ServletWrapper attributes, without support for name clashes though.
Specified by:
getAttribute in interface javax.servlet.ServletContext
Parameters:
name - The attribute name.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object object)
Specified by:
setAttribute in interface javax.servlet.ServletContext

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface javax.servlet.ServletContext

getAttributeNames

public java.util.Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface javax.servlet.ServletContext

getLocalServletLoader

protected AutoReloadServletLoader getLocalServletLoader()
Get or create a suitable LocalServletLoader instance to load that servlet.
Returns:
A LocalServletLoader instance.

createNewLocalServletLoader

protected AutoReloadServletLoader createNewLocalServletLoader(boolean keepold)

getServletDirectory

public java.io.File getServletDirectory()

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String urlpath)
Returns a RequestDispatcher object for the specified URL path if the context knows of an active source (such as a servlet, JSP page, CGI script, etc) of content for the particular path. This format of the URL path must be of the form /dir/dir/file.ext. The servlet engine is responsible for implementing whatever functionality is required to wrap the target source with an implementation of the RequestDispatcher interface.
Specified by:
getRequestDispatcher in interface javax.servlet.ServletContext
Parameters:
urlpath - Path to use to look up the target server resource

getMajorVersion

public int getMajorVersion()
Specified by:
getMajorVersion in interface javax.servlet.ServletContext

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface javax.servlet.ServletContext

getContext

public javax.servlet.ServletContext getContext(java.lang.String uripath)
Specified by:
getContext in interface javax.servlet.ServletContext

getResource

public java.net.URL getResource(java.lang.String path)
                         throws java.net.MalformedURLException
Specified by:
getResource in interface javax.servlet.ServletContext

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.String path)
Specified by:
getResourceAsStream in interface javax.servlet.ServletContext