|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.servlet.util.StreamContent
public class StreamContent
The StreamContent is a utility class that allows easier use of the StreamContentServlet.
Example using img tag:
<%@page import="com.sas.servlet.util.StreamContent"%> <% byte [] b = //get your image bytes here StreamContent s1 = new StreamContent(request, response); s1.setContentKey("testgif"); s1.setContentType("image/gif"); s1.setContentDisposition("inline;filename=test.gif"); s1.setContentBytes(b); %> <img src="<%=s1.getURL()%>"/> Example using jsp:forward tag:
<%@page import="com.sas.servlet.util.StreamContent"%> <% byte [] b = //get your image bytes here StreamContent s1 = new StreamContent(request, response); s1.setContentKey("testgif"); s1.setContentType("image/gif"); s1.setContentDisposition("inline;filename=test.gif"); s1.setContentBytes(b); %> <jsp:forward page="<%=s1.getURL(false)%>" />
StreamContentServlet
Constructor Summary | |
---|---|
StreamContent(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Constructor |
Method Summary | |
---|---|
java.lang.String |
getAbsoluteURL()
Gets the absolute StreamContentServlet URL. |
byte[] |
getContentBytes()
Gets the current content bytes. |
java.lang.String |
getContentDisposition()
Gets the current content disposition. |
java.lang.String |
getContentKey()
Gets the current content key. |
java.lang.String |
getContentType()
Gets the current content type. |
javax.servlet.http.HttpServletRequest |
getRequest()
Gets the current request object. |
javax.servlet.http.HttpServletResponse |
getResponse()
Gets the current response object. |
java.lang.String |
getServletMapping()
Gets the current servlet mapping. |
java.lang.String |
getURL()
Gets the complete StreamContentServlet URL. |
java.lang.String |
getURL(boolean includeContext)
Gets the complete StreamContentServlet URL. |
boolean |
isDisposeContents()
Gets the disposeContents boolean value. |
boolean |
isNoop()
Gets the noop boolean value. |
boolean |
isPersistence()
Gets the persistence boolean value. |
void |
setContentBytes(byte[] contentBytes)
Sets the content bytes to be streamed back to the user. |
void |
setContentDisposition(java.lang.String contentDisposition)
Sets the content disposition. |
void |
setContentKey(java.lang.String contentKey)
Sets the content key that is used to define unique user parameters for request or session scope. |
void |
setContentType(java.lang.String contentType)
Sets the content mime type, such as image/gif. |
void |
setDisposeContent(boolean disposeContents)
Sets the disposeContents property. |
void |
setNoop(boolean noop)
Set to true if the servlet is to do no operation. |
void |
setPersistence(boolean persistence)
Set to true if the servlet is to send the content lenth (based on content bytes) back with the response. |
void |
setRequest(javax.servlet.http.HttpServletRequest request)
Sets the request object. |
void |
setResponse(javax.servlet.http.HttpServletResponse response)
Sets the response object. |
void |
setServletMapping(java.lang.String servletMapping)
Sets the servlet mapping for the StreamContentServlet as defined in the web.xml. |
Constructor Detail |
---|
public StreamContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- The HttpServletRequest passed to the servlet.response
- The HttpServletResponse passed to the servlet.Method Detail |
---|
public void setRequest(javax.servlet.http.HttpServletRequest request)
request
- The request objectpublic javax.servlet.http.HttpServletRequest getRequest()
public void setResponse(javax.servlet.http.HttpServletResponse response)
response
- The response objectpublic javax.servlet.http.HttpServletResponse getResponse()
public void setContentKey(java.lang.String contentKey)
contentKey
- The content key.public java.lang.String getContentKey()
public void setContentType(java.lang.String contentType)
contentType
- The content type.public java.lang.String getContentType()
public void setContentDisposition(java.lang.String contentDisposition)
contentDisposition
- The content disposition.public java.lang.String getContentDisposition()
public void setContentBytes(byte[] contentBytes)
contentBytes
- The content bytes.public byte[] getContentBytes()
public void setServletMapping(java.lang.String servletMapping)
servletMapping
- The servlet mapping.public java.lang.String getServletMapping()
public void setNoop(boolean noop)
noop
- The boolean no operation value for the servlet.public boolean isNoop()
public void setPersistence(boolean persistence)
persistence
- The boolean value for connection persistence.public boolean isPersistence()
public java.lang.String getAbsoluteURL()
public java.lang.String getURL()
public java.lang.String getURL(boolean includeContext)
includeContext
- Set to true if the webapp context is to be prepended to the URL.
public void setDisposeContent(boolean disposeContents)
disposeContents
- The content type.public boolean isDisposeContents()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |