A SERVICE OF

logo

MediaScript Objects and Methods 31
The response object can be any of the following types: Media, XmlDocument, or
TextResponse. For more information about the setObject() method, see “setObject()”
on page 37.
Finally, the response contents can be set directly to the path of an existing file using the
response object's setPath() method. For example, to return a PDF file in the media
directory named response.pdf, you would write:
resp.setPath("response.pdf");
By default the file will be copied to the cache. You can also stream the contents back to the
client or just return the file path by setting the response type to one of the values listed in
the following section.
Response Types
There are three types of responses:
RespType.Cached - This is the default response type. The response object or file is
saved to the cache so that subsequent requests with the same parameters will be
returned immediately from the cache. The response in this case is the full path of the
new cached file.
RespType.Streamed - The response contents are set to the contents of the response
object or file. Since nothing is saved in the cache, subsequent requests will re-execute the
script.
RespType.Path - This type applies to response files only. The response is set to the full
path of the file. Again, nothing is saved in the cache so subsequent request will re-
execute the script.
The Response Object does not need to be constructed. A static global instance of each is
created for each MediaScript execution context. The resp object allows the user to set the
Media response.
HTTP Request Object Properties
This object has no properties.
HTTP Request Methods
The req object includes the following methods:
getParameter()
getParameterNames()
getHeader()
getFileParamNames()
getFileParamPath()
getHeaderNames()
getRequestURL()
getQueryString()
getScriptPath()