© 2001 BEA Systems, Inc.

com.beasys.commerce.content
Class ShowDocServlet

com.beasys.commerce.content.ShowDocServlet

public class ShowDocServlet

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".


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.
 

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 com.beasys.commerce.content.ServletException
Initialize the servlet.

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse resp)
           throws com.beasys.commerce.content.ServletException,
                  java.io.IOException
Just calls doPost().

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws com.beasys.commerce.content.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.


showError

protected void showError(java.lang.String error,
                         java.lang.Throwable ex,
                         javax.servlet.http.HttpServletResponse resp)
                  throws com.beasys.commerce.content.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.

© 2001 BEA Systems, Inc.

Copyright © 2001 BEA Systems, Inc. All Rights Reserved