org.mmbase.servlet
Class BridgeServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.mmbase.servlet.MMBaseServlet
              extended byorg.mmbase.servlet.BridgeServlet
All Implemented Interfaces:
org.mmbase.servlet.MMBaseStarter, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
HandleServlet, performance

public abstract class BridgeServlet
extends MMBaseServlet

BridgeServlet is an MMBaseServlet with a bridge Cloud in it. Extending from this makes it easy to implement servlet implemented with the MMBase bridge interfaces. An advantage of this is that security is used, which means that you cannot unintentionly serve content to the whole world which should actually be protected by the security mechanism. Another advantage is that implementation using the bridge is easier/clearer. The query of a bridge servlet can possible start with session= in which case the cloud is taken from that session attribute with that name. Otherewise 'cloud_mmbase' is supposed. All this is only done if there was a session active at all. If not, or the session variable was not found, that an anonymous cloud is used.

Since:
MMBase-1.6
Version:
$Id: BridgeServlet.java,v 1.16 2004/02/11 20:43:23 keesj Exp $
Author:
Michiel Meeuwissen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mmbase.servlet.MMBaseServlet
mmbase
 
Constructor Summary
BridgeServlet()
           
 
Method Summary
protected  Cloud getAnonymousCloud()
           
protected  Cloud getCloud(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, org.mmbase.servlet.BridgeServlet.QueryParts qp)
           
protected  java.lang.String getCloudName()
           
protected  long getLastModified(javax.servlet.http.HttpServletRequest req)
          The idea is that a 'bridge servlet' on default serves 'nodes', and that there could be defined a 'last modified' time for nodes.
protected  Node getNode(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Servlets would often need a node.
 void init()
          The init of an MMBaseServlet checks if MMBase is running.
protected  org.mmbase.servlet.BridgeServlet.QueryParts readQuery(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Remove session information from query object, and returns session-name (or null)
 
Methods inherited from class org.mmbase.servlet.MMBaseServlet
associateMapping, decRefCount, destroy, doGet, getAssociations, getMMBase, getRequestURL, getServletByAssociation, getServletByMapping, getServletInfo, getServletMappings, getServletMappingsByAssociation, incRefCount, service, setInitException, setMMBase
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, 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
 

Constructor Detail

BridgeServlet

public BridgeServlet()
Method Detail

getCloudName

protected java.lang.String getCloudName()

readQuery

protected final org.mmbase.servlet.BridgeServlet.QueryParts readQuery(javax.servlet.http.HttpServletRequest req,
                                                                      javax.servlet.http.HttpServletResponse res)
                                                               throws java.io.IOException
Remove session information from query object, and returns session-name (or null)

Throws:
java.io.IOException

getCloud

protected final Cloud getCloud(javax.servlet.http.HttpServletRequest req,
                               javax.servlet.http.HttpServletResponse res,
                               org.mmbase.servlet.BridgeServlet.QueryParts qp)
                        throws java.io.IOException
Throws:
java.io.IOException

getAnonymousCloud

protected final Cloud getAnonymousCloud()

getNode

protected final Node getNode(javax.servlet.http.HttpServletRequest req,
                             javax.servlet.http.HttpServletResponse res)
                      throws java.io.IOException
Servlets would often need a node. This function will get one for you using the query string. This is convenient, and also ensures that all this kind of servlets work uniformely.

Throws:
java.io.IOException

getLastModified

protected long getLastModified(javax.servlet.http.HttpServletRequest req)
The idea is that a 'bridge servlet' on default serves 'nodes', and that there could be defined a 'last modified' time for nodes. This can't be determined right now, so 'now' is returned. This function is defined in HttpServlet


init

public void init()
          throws javax.servlet.ServletException
Description copied from class: MMBaseServlet
The init of an MMBaseServlet checks if MMBase is running. It not then it is started.

Overrides:
init in class MMBaseServlet
Throws:
javax.servlet.ServletException


MMBase build 1.7.1.20041002