org.mmbase.servlet
Class JamesServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.mmbase.servlet.MMBaseServlet
                    |
                    +--org.mmbase.servlet.JamesServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
remoteXML, servdb, servflash, servjumpers, servscan, SimpleFormToMailServlet

public class JamesServlet
extends MMBaseServlet

JamesServlet is a adaptor class. It is used to extend the basic Servlet to provide services not found in suns Servlet API.

Version:
$Id: JamesServlet.java,v 1.40 2002/11/12 16:57:50 pierre Exp $
Author:
vpro
See Also:
Serialized Form

Field Summary
protected static Logger pageLog
           
 
Fields inherited from class org.mmbase.servlet.MMBaseServlet
mmbase
 
Constructor Summary
JamesServlet()
           
 
Method Summary
 java.lang.String getAddress(javax.servlet.http.HttpServletRequest req)
          Extract hostname from request, get address and determine the proxies between it.
 java.lang.String getAuthorization(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Try to get the default authorisation
 java.lang.String getAuthorization(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String server, java.lang.String level)
          Authenticates a user, If the user cannot be authenticated a login-popup will appear
 java.lang.String getCookie(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          This method retrieves the users' MMBase cookie name & value as 'name/value'.
protected  java.util.Hashtable getInitParameters()
          Retrieves all initialization parameters.
protected  java.lang.Object getModule(java.lang.String name)
          Retrieves a module.
 java.lang.String getParam(javax.servlet.http.HttpServletRequest req, int num)
          Get the parameter specified.
 java.util.Vector getParamVector(javax.servlet.http.HttpServletRequest req)
          Get the Vector containing all parameters
protected  java.util.Hashtable getProperties(java.lang.String name)
          Gets properties.
protected  java.lang.String getProperty(java.lang.String name, java.lang.String var)
          Gets a property out of the Environment.
 void init()
          Initializes the servlet.
 
Methods inherited from class org.mmbase.servlet.MMBaseServlet
associateMapping, decRefCount, destroy, doGet, getAssociations, getRequestURL, getServletByAssociation, getServletByMapping, getServletInfo, getServletMappings, getServletMappingsByAssociation, incRefCount, service
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pageLog

protected static Logger pageLog
Constructor Detail

JamesServlet

public JamesServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initializes the servlet.
Overrides:
init in class MMBaseServlet

getModule

protected final java.lang.Object getModule(java.lang.String name)
Retrieves a module. Creates the module if it hasn't been created yet (but does not initialize).
Parameters:
name - the name of the module to retrieve
Returns:
the Module, or null if it doesn't exist.

getInitParameters

protected final java.util.Hashtable getInitParameters()
Retrieves all initialization parameters. Note: overides the normal way to set init params in javax.

getProperties

protected final java.util.Hashtable getProperties(java.lang.String name)
Gets properties. If allowed.

getProperty

protected final java.lang.String getProperty(java.lang.String name,
                                             java.lang.String var)
Gets a property out of the Environment. If allowed

getAuthorization

public java.lang.String getAuthorization(javax.servlet.http.HttpServletRequest req,
                                         javax.servlet.http.HttpServletResponse res)
                                  throws AuthorizationException,
                                         NotLoggedInException
Try to get the default authorisation
Parameters:
req - The HttpServletRequest.
res - The HttpServletResponse.
Throws:
AuthorizationException - if the authorization fails.
NotLoggedInException - if the user hasn't logged in yet.

getAuthorization

public java.lang.String getAuthorization(javax.servlet.http.HttpServletRequest req,
                                         javax.servlet.http.HttpServletResponse res,
                                         java.lang.String server,
                                         java.lang.String level)
                                  throws AuthorizationException,
                                         NotLoggedInException
Authenticates a user, If the user cannot be authenticated a login-popup will appear
Parameters:
req - The HttpServletRequest.
res - The HttpServletResponse.
server - server-account. (for exameple 'film' or 'www')
level - loginlevel. (for example 'Basic' or 'MD5')
Throws:
AuthorizationException - if the authorization fails.
NotLoggedInException - if the user hasn't logged in yet.

getCookie

public java.lang.String getCookie(javax.servlet.http.HttpServletRequest req,
                                  javax.servlet.http.HttpServletResponse res)
This method retrieves the users' MMBase cookie name & value as 'name/value'. When the cookie can't be found, a new cookie will be added. The cookies domain will be implicit or explicit depending on the MMBASEROOT.properties value.
Parameters:
req - The HttpServletRequest.
res - The HttpServletResponse.
Returns:
A String with the users' MMBase cookie as 'name/value' or null when MMBase core module can't be found, or when the MMBase cookie is located but can't be retrieved from the cookies list.

getParam

public java.lang.String getParam(javax.servlet.http.HttpServletRequest req,
                                 int num)
Get the parameter specified.
Parameters:
req - The HttpServletRequest.

getParamVector

public java.util.Vector getParamVector(javax.servlet.http.HttpServletRequest req)
Get the Vector containing all parameters
Parameters:
req - The HttpServletRequest.

getAddress

public java.lang.String getAddress(javax.servlet.http.HttpServletRequest req)
Extract hostname from request, get address and determine the proxies between it. Needed to determine if user comes from an internal or external host, i.e. when using two streaming servers, one for external users and one for internal users.
Parameters:
req - The HTTP request, which contains hostname as ipaddress
Returns:
a string containing the proxy chain. in the format "clientproxy.clientside.com->dialin07.clientside.com"


MMBase build 1.6.5.20030923