BEA Systems, Inc.

com.beasys.commerce.content
Class ShowDocServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.beasys.commerce.content.ShowDocServlet

public class ShowDocServlet
extends javax.servlet.http.HttpServlet

A servlet which will output a document to the client.

This understands 2 init parameters:

This understands 2 request parameters: This will also check the PATH_INFO for the contentId, if it's not found in the request parameters. This will put the contentHome from the request or init parameters in the session at "com.beasys.commerce.axiom.document.contentHome".

See Also:
Serialized Form

Field Summary
protected  boolean closeStreams
          Do we close the output stream when finished.
static java.lang.String CONTENT_HOME_SESSION_NAME
          The Session variable this will look for the contentHome in.
protected  java.lang.String contentHome
          The content home.
static java.lang.String DEF_MIME_TYPE
          The default mime type.
 
Constructor Summary
ShowDocServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Just calls doPost().
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Request entry point.
 void init()
          Initialize the servlet.
protected  void showError(java.lang.String error, java.lang.Throwable ex, javax.servlet.http.HttpServletResponse resp)
          Print an error message to the output stream.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_MIME_TYPE

public static final java.lang.String DEF_MIME_TYPE
The default mime type.

CONTENT_HOME_SESSION_NAME

public static final java.lang.String CONTENT_HOME_SESSION_NAME
The Session variable this will look for the contentHome in.

contentHome

protected java.lang.String contentHome
The content home.

closeStreams

protected boolean closeStreams
Do we close the output stream when finished.
Constructor Detail

ShowDocServlet

public ShowDocServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initialize the servlet.
Overrides:
init in class javax.servlet.GenericServlet

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse resp)
           throws javax.servlet.ServletException,
                  java.io.IOException
Just calls doPost().
Overrides:
doGet in class javax.servlet.http.HttpServlet

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws javax.servlet.ServletException,
                   java.io.IOException
Request entry point.

This method gets the contentId and contentHome. From that, it gets a Document object, from which, it outputs the document's content bytes to the output stream.

It will set the Content-Type, Content-Length, and Content-Disposition headers on the response to try to get the browser to do the correct thing.

Overrides:
doPost in class javax.servlet.http.HttpServlet

showError

protected void showError(java.lang.String error,
                         java.lang.Throwable ex,
                         javax.servlet.http.HttpServletResponse resp)
                  throws javax.servlet.ServletException,
                         java.io.IOException
Print an error message to the output stream.

This assumes that nothing has been put on the response yet.

Parameters:
error - the error message.
ex - a possible exception.
resp - the response to output to.

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved