|
© 2002 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--com.bea.p13n.content.servlets.ShowDocServlet
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.
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.
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 |
public static final java.lang.String DEF_MIME_TYPE
public static final java.lang.String CONTENT_HOME_SESSION_NAME
protected java.lang.String contentHome
protected boolean closeStreams
protected boolean showErrorToClient
Constructor Detail |
public ShowDocServlet()
Method Detail |
public void init() throws javax.servlet.ServletException
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
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.
protected void showError(java.lang.String error, java.lang.Throwable ex, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
This assumes that nothing has been put on the response yet.
error
- the error message.ex
- a possible exception.resp
- the response to output to.
|
© 2002 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |