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:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AttachmentServlet, ImageServlet

public class HandleServlet
extends BridgeServlet

As AttachmentServlet, but the mime-type is always application/x-binary, forcing the browser to download.

Since:
MMBase-1.6
Version:
$Id: HandleServlet.java,v 1.5.2.1 2002/12/02 17:40:23 michiel Exp $
Author:
Michiel Meeuwissen
See Also:
ImageServlet, AttachmentServlet, Serialized Form

Fields inherited from class org.mmbase.servlet.MMBaseServlet
mmbase
 
Constructor Summary
HandleServlet()
           
 
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 setContent(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.BridgeServlet
getCloud, getCloudName, getLastModified, getNode, readQuery
 
Methods inherited from class org.mmbase.servlet.MMBaseServlet
associateMapping, decRefCount, destroy, getRequestURL, getServletByAssociation, getServletByMapping, getServletInfo, getServletMappings, getServletMappingsByAssociation, incRefCount, service
 
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

HandleServlet

public HandleServlet()
Method Detail

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
Following copied from class: org.mmbase.servlet.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

getMimeType

protected java.lang.String getMimeType(Node node)

setContent

protected boolean setContent(javax.servlet.http.HttpServletResponse res,
                             Node node,
                             java.lang.String mimeType)
                      throws java.io.IOException
Sets the content disposition header.
Returns:
true on success

setExpires

protected boolean setExpires(javax.servlet.http.HttpServletResponse res,
                             Node node)
Sets the exires header.
Returns:
true on sucess

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

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.


MMBase build 1.6.5.20030923