Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.content.servlets
Class ShowDocServlet

    java.lang.Object
      |
      +--javax.servlet.GenericServlet
            |
            +--javax.servlet.http.HttpServlet
                  |
                  +--com.bea.p13n.content.servlets.ShowDocServlet

public class ShowDocServlet
extends javax.servlet.http.HttpServlet

A servlet which will output a document to the client.

This understands 2 init parameters:

- `contentHome`: Specifies the default JNDI content home name. If this is specified, then all contentHome request parameters will be ignored. If contentHome is not specified as either an init or request parameter, the default DocumentManager home will be used (which is "java:comp/env/ejb/DocumentManager").
- `closeStreams`: true to have the servlet close output streams when done, false to not. This defaults to false.

This understands 2 request parameters:

- `contentHome`: Specifies the JNDI content manager home name to look for the document at, if the contentHome init parameters isn't specified.
- `contentId`: Specifies the identifier of the document to display. If not specified, an error message is displayed instead.

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 parameter in the session at "com.bea.p13n.content.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.
`protected boolean` | `showErrorToClient` Do we show error to browser.

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, doHead, 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.

### showErrorToClient

    protected boolean showErrorToClient

  Do we show error to browser.

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.

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved