org.mmbase.servlet
Class HandleServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.mmbase.servlet.MMBaseServlet
org.mmbase.servlet.BridgeServlet
org.mmbase.servlet.HandleServlet
- All Implemented Interfaces:
- MMBaseStarter, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
- Direct Known Subclasses:
- AttachmentServlet, ImageServlet
- public class HandleServlet
- extends BridgeServlet
Base servlet for nodes with a 'handle' field. It serves as a basic implementation for more
specialized servlets. The mime-type is always application/x-binary, forcing the browser to
download.
- Since:
- MMBase-1.6
- Version:
- $Id: HandleServlet.java,v 1.15.2.1 2005/08/15 16:39:12 michiel Exp $
- Author:
- Michiel Meeuwissen
- See Also:
ImageServlet,
AttachmentServlet,
Serialized Form
|
Method Summary |
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Serves a node with a byte[] handle field as an attachment. |
protected java.util.Map |
getAssociations()
On default, servlets are not associated with any function. |
protected java.lang.String |
getMimeType(Node node)
|
void |
init()
The init of an MMBaseServlet checks if MMBase is running. |
protected void |
sendBytes(javax.servlet.http.HttpServletResponse res,
byte[] bytes)
Utility function to send bytes at the end of doGet implementation. |
protected boolean |
setCacheControl(javax.servlet.http.HttpServletResponse res,
Node node)
Sets cache-controlling headers. |
protected boolean |
setContent(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
Node node,
java.lang.String mimeType)
Sets the content disposition header. |
protected boolean |
setExpires(javax.servlet.http.HttpServletResponse res,
Node node)
Sets the exires header. |
| Methods inherited from class org.mmbase.servlet.MMBaseServlet |
associateMapping, checkInited, decRefCount, destroy, 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 |
HandleServlet
public HandleServlet()
getAssociations
protected java.util.Map getAssociations()
- Description copied from class:
MMBaseServlet
- On default, servlets are not associated with any function.
This function is called in the init method.
- Overrides:
getAssociations in class MMBaseServlet
- Returns:
- A map of Strings (function) -> Integer (priority). Never null.
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 BridgeServlet
- Throws:
javax.servlet.ServletException
getMimeType
protected java.lang.String getMimeType(Node node)
setContent
protected boolean setContent(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
Node node,
java.lang.String mimeType)
throws java.io.IOException
- Sets the content disposition header.
- Returns:
- true on success
- Throws:
java.io.IOException
setExpires
protected boolean setExpires(javax.servlet.http.HttpServletResponse res,
Node node)
- Sets the exires header.
- Returns:
- true on sucess
setCacheControl
protected boolean setCacheControl(javax.servlet.http.HttpServletResponse res,
Node node)
- Sets cache-controlling headers. Only nodes which are to be served to 'anonymous' might be
(front proxy) cached. To other nodes there might be read restrictions, so they should not be
stored in front-proxy caches.
- Returns:
- true if cacheing is disabled.
- Since:
- MMBase-1.7
doGet
public void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws javax.servlet.ServletException,
java.io.IOException
- Serves a node with a byte[] handle field as an attachment.
- Overrides:
doGet in class MMBaseServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
sendBytes
protected final void sendBytes(javax.servlet.http.HttpServletResponse res,
byte[] bytes)
throws java.io.IOException
- Utility function to send bytes at the end of doGet implementation.
- Throws:
java.io.IOException
MMBase build 1.7.4.20050922