|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.ma2.web.util.WebMediaResponse
public class WebMediaResponse
Web implementation of MediaResponse
.
Constructor Summary | |
---|---|
WebMediaResponse()
Default constructor. |
|
WebMediaResponse(javax.servlet.http.HttpServletResponse webResponse,
boolean download)
Construct from an HttpServletResponse . |
|
WebMediaResponse(javax.servlet.http.HttpServletResponse webResponse,
java.lang.String filename)
Construct from an HttpServletResponse . |
Method Summary | |
---|---|
java.io.OutputStream |
getOutputStream()
Get the output stream. |
void |
setItem(MediaItem item)
Set the media item used in the response. |
void |
setMediaLength(long length)
Set the length of the media of the response. |
void |
setMimeType(java.lang.String mime)
Set the MIME type of a response. |
void |
setModifiedDate(long date)
Set the modification date of the response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebMediaResponse()
public WebMediaResponse(javax.servlet.http.HttpServletResponse webResponse, java.lang.String filename)
HttpServletResponse
.
webResponse
- the HttpServletResponse to respond withfilename
- a filename to set on the response via a
HTTP Content-Disposition headerpublic WebMediaResponse(javax.servlet.http.HttpServletResponse webResponse, boolean download)
HttpServletResponse
.
webResponse
- the HttpServletResponse to respond withdownload
- true if should generate a download
HTTP Content-Disposition headerMethod Detail |
---|
public void setMimeType(java.lang.String mime)
MediaResponse
The MIME type of the response might be different from the MIME type
of the MediaItem
in the request. For example a request for
an MP3 resource might actually return a JPG image extracted from the
metadata of that MP3 file.
setMimeType
in interface MediaResponse
mime
- the MIME type of the responsepublic void setMediaLength(long length)
MediaResponse
This should be the lenght, in bytes, if the data representing the result of the media request processing.
setMediaLength
in interface MediaResponse
length
- the length of the contentpublic void setItem(MediaItem item)
MediaResponse
The MediaRequest
object only contains the ID of the
MediaItem
to process. This method should be called with
the actual MediaItem
for that ID.
setItem
in interface MediaResponse
item
- the media itempublic java.io.OutputStream getOutputStream()
MediaResponse
This is the OutputStream
that the result of processing the
request should be written to. During request processing, the
MediaHandler
doing the processing should
write the resulting media item data to this stream.
getOutputStream
in interface MediaResponse
public void setModifiedDate(long date)
MediaResponse
If possible, this method should be called and set with the last modification date of the result of processing this media request. This is to aid client caching, for clients that request media items with a "if modified since" directive, such as HTTP clients.
setModifiedDate
in interface MediaResponse
date
- the modification date
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |