
MediaScript Objects and Methods 37
•
•
•
•
•
getSaveParameters()
•
setMimeType()
•
getMimeType()
•
setHeader()
•
getHeader()
•
setStatusCode()
•
getStatusCode()
•
write()
•
writeLine()
setObject()
Sets the response object. Optional parameters can set the response type and save
parameters for the specified object.
Syntax
resp.setObject(
[obj]
[respType]
[saveParams{}]
);
Parameters
obj - specifies the response object.
RespType - optional parameter that sets the response type:
•
RespType.Cached (the default) saves the response object or file to the MediaResults
cache directory so that future requests are returned directly by the filter.
•
RespType.Streamed bypasses the cache and returns the response data directly to the
filter.
•
RespType.Path returns the full native path of a file to the filter but does not copy the file
to the cache.
For more information, see setResponseType().
saveParams - optional parameter that saves response parameters as an object. The object
must be pre-existing or a temporary object using the {} syntax.
Example
var img = new Media();
img.load(name @ "foo.jpg");
resp.setObject(img, RespType.Streamed, {type: "png"});
getObject()
Returns the object previously set by either setObject(), setMedia(), or a
Media::save() call with no name.
NOTE: If no response object is set, the function returns null.