DEPRECATED

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

public class ShowDocServlet
extends `com.bea.content.manager.servlets.ShowBinaryServlet`

A servlet which will output a document to the client.

This will act like the ShowBinaryServlet. If the Node is not found in the repository, then this will perform the old behavior of using a DocumentManager

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

Hierarchy
  `Object`
  `GenericServlet`
  `HttpServlet`
  `com.bea.content.manager.servlets.ShowPropertyServlet`
  `com.bea.content.manager.servlets.ShowBinaryServlet`
  `ShowDocServlet`

All Implemented Interfaces
  `Serializable`, `Servlet`, `ServletConfig`

## Field Summary

`public static final `String`` | `CONTENT_HOME_SESSION_NAME` The Session variable this will look for the contentHome in.
`protected `String`` | `contentHome` The content home.
`public static final `String`` | `DEF_MIME_TYPE` The default mime type.

Fields from com.bea.content.manager.servlets`.`com.bea.content.manager.servlets.ShowPropertyServlet``
``closeStreams`, `DEFAULT_MIME_TYPE`, `TEXT_MIME_TYPE``

## Constructor Summary

ShowDocServlet()

## Method Summary

`public void` | `doPost`(`HttpServletRequest` req, `HttpServletResponse` resp) Request entry point.
`public void` | `init`() Initialize the servlet.
`protected void` | `showError`(`String` error, `Throwable` ex, `HttpServletResponse` resp) Print an error message to the output stream.

Methods from `com.bea.content.manager.servlets.`com.bea.content.manager.servlets.ShowPropertyServlet``
``doGet`, `ioReadWrite`, `nioRead`, `printNode`,`

Methods from `javax.servlet.http.`HttpServlet``
`doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service`

Methods from `javax.servlet.`GenericServlet``
`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log, service`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.servlet.`Servlet``
`destroy, getServletConfig, getServletInfo, init, service`

Methods from interface `javax.servlet.`ServletConfig``
`getInitParameter, getInitParameterNames, getServletContext, getServletName`

## Field Detail

### CONTENT_HOME_SESSION_NAME

    public static final String CONTENT_HOME_SESSION_NAME

  The Session variable this will look for the contentHome in.

### contentHome

    protected String contentHome

  The content home.

### DEF_MIME_TYPE

    public static final String DEF_MIME_TYPE

  The default mime type.

## Constructor Detail

### ShowDocServlet

    public ShowDocServlet()

## Method Detail

### doPost(HttpServletRequest, HttpServletResponse) Method

    public void doPost(HttpServletRequest req,
                       HttpServletResponse resp)
         throws ServletException, IOException

Request entry point.

Override to first try the ShowBinaryServlet method to access the new content repository first. If that fails to find the Node, then this will access a ContentManager.

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
  `ShowPropertyServlet.doPost(HttpServletRequest, HttpServletResponse)`

#### Exceptions

``ServletException``
``IOException``

### init() Method

    public void init()
         throws ServletException

Initialize the servlet.

Overrides
  `ShowPropertyServlet.init()`

#### Exceptions

``ServletException``

### showError(String, Throwable, HttpServletResponse) Method

    protected void showError(String error,
                             Throwable ex,
                             HttpServletResponse resp)
         throws ServletException, IOException

Print an error message to the output stream.

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

Overrides
  `ShowPropertyServlet.showError(String, Throwable, HttpServletResponse)`

#### Parameters

error
  the error message.

ex
  a possible exception.

resp
  the response to output to.

#### Exceptions

``ServletException``
``IOException``