Package com.saperion.ngc.servlet
Class AbstractStreamingServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- com.saperion.ngc.servlet.AbstractStreamingServlet
-
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
- Direct Known Subclasses:
SignedStreamingServlet
,StreamingServlet
,ViewDocumentServlet
,ViewTemporaryDocumentServlet
public abstract class AbstractStreamingServlet extends javax.servlet.http.HttpServlet
Abstract class with common methods for streaming servlets.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractStreamingServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
protected DocumentService
getDocService(javax.servlet.http.HttpSession session)
Returns an instance of theDocumentService
by the given session.void
init()
protected void
writeContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String hDoc, int element, java.lang.String filename, boolean currentRevision)
Writes the document's content to the request's output stream.protected void
writeContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String hDoc, int element, java.lang.String filename, boolean currentRevision, boolean forceInline)
Writes the document's content to the request's output stream.protected void
writeContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String hDoc, int element, java.lang.String filename, boolean currentRevision, long start, long size)
Writes the document's content to the request's output stream.protected void
writeInputStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.InputStream in, java.lang.String filename)
Writes the given input stream to the responses output stream.protected void
writeInputStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.InputStream in, java.lang.String filename, boolean forceInline)
Writes the given input stream to the responses output stream.-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
-
-
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletException
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
- See Also:
GenericServlet.init()
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Servlet
- Overrides:
destroy
in classjavax.servlet.GenericServlet
- See Also:
GenericServlet.destroy()
-
writeContent
protected void writeContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String hDoc, int element, java.lang.String filename, boolean currentRevision, boolean forceInline) throws java.io.IOException
Writes the document's content to the request's output stream.- Parameters:
request
- the requestresponse
- the responsehDoc
- the hdocelement
- the elementfilename
- the filenamecurrentRevision
- current revisionforceInline
- if true, the content-disposition header is always set to 'inline'.- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
-
writeContent
protected void writeContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String hDoc, int element, java.lang.String filename, boolean currentRevision) throws java.io.IOException
Writes the document's content to the request's output stream.- Parameters:
request
- the requestresponse
- the responsehDoc
- the hdocelement
- the elementfilename
- the filenamecurrentRevision
- current revision- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
-
writeContent
protected void writeContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String hDoc, int element, java.lang.String filename, boolean currentRevision, long start, long size) throws java.io.IOException
Writes the document's content to the request's output stream.- Parameters:
request
- the requestresponse
- the responsehDoc
- the hdocelement
- the elementfilename
- the filenamecurrentRevision
- current revisionstart
- position to start atsize
- amount of data to write- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
-
writeInputStream
protected void writeInputStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.InputStream in, java.lang.String filename, boolean forceInline) throws java.io.IOException
Writes the given input stream to the responses output stream.- Parameters:
request
- TheHttpServletRequest
.response
- TheHttpServletResponse
in
- TheInputStream
that holds the data to write to the output stream.filename
- The filename of the data.forceInline
- if true, the content-disposition header is always set to 'inline'.- Throws:
java.io.IOException
- if an exception occurs.
-
writeInputStream
protected void writeInputStream(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.io.InputStream in, java.lang.String filename) throws java.io.IOException
Writes the given input stream to the responses output stream.- Parameters:
request
- TheHttpServletRequest
.response
- TheHttpServletResponse
in
- TheInputStream
that holds the data to write to the output stream.filename
- The filename of the data.- Throws:
java.io.IOException
- if an exception occurs.
-
getDocService
protected DocumentService getDocService(javax.servlet.http.HttpSession session)
Returns an instance of theDocumentService
by the given session.- Parameters:
session
- The current session instance.- Returns:
- an instance of the
DocumentService
.
-
-