Interface WebScriptResponse
- All Known Subinterfaces:
WrappingWebScriptResponse
- All Known Implementing Classes:
WebScriptResponseImpl,WebScriptServletResponse,WebScriptViewResponse
public interface WebScriptResponse
Web Script Response
- Author:
- davidc
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a response header with the given name and value.encodeResourceUrl(String url) Encode a resource URL Note: Some Web Script Runtime environments (e.g.encodeScriptUrl(String url) Encode a script URL Note: Some Web Script Runtime environments (e.g.Return a client side javascript function to build resource urls for this serviceReturn a client side javascript function to build urls to this serviceGets the Output StreamGets the initiating runtimeGets the Writervoidreset()Clears response buffer including status and headersvoidClears response including status and headers except the specified headers.voidSets the Cache controlvoidsetContentEncoding(String contentEncoding) Sets the Content EncodingvoidsetContentType(String contentType) Sets the Content TypevoidSet a response header with the given name and value.voidsetStatus(int status) Sets the Response Status
-
Field Details
-
HTML_FORMAT
- See Also:
-
ATOM_FORMAT
- See Also:
-
RSS_FORMAT
- See Also:
-
XML_FORMAT
- See Also:
-
JSON_FORMAT
- See Also:
-
OPENSEARCH_DESCRIPTION_FORMAT
- See Also:
-
HEADER_LOCATION
- See Also:
-
-
Method Details
-
setStatus
void setStatus(int status) Sets the Response Status- Parameters:
status- int
-
setHeader
Set a response header with the given name and value. If the header has already been set, the new value overwrites the previous one.- Parameters:
name- header namevalue- header value
-
addHeader
Adds a response header with the given name and value. This method allows a response header to have multiple values.- Parameters:
name- header namevalue- header value
-
setContentType
Sets the Content Type- Parameters:
contentType- String
-
setContentEncoding
Sets the Content Encoding- Parameters:
contentEncoding- String
-
setCache
Sets the Cache control- Parameters:
cache- cache control
-
getWriter
Gets the Writer- Returns:
- writer
- Throws:
IOException
-
getOutputStream
Gets the Output Stream- Returns:
- output stream
- Throws:
IOException
-
reset
void reset()Clears response buffer including status and headers -
reset
Clears response including status and headers except the specified headers. REPO-4388 allow certain headers not to be reset- Parameters:
preserveHeadersPattern- Headers which will not be reset with using a regex pattern.
-
encodeScriptUrl
Encode a script URL Note: Some Web Script Runtime environments (e.g. JSR-168, JSF) require urls to be re-written.- Parameters:
url- to encode- Returns:
- encoded url
-
encodeResourceUrl
Encode a resource URL Note: Some Web Script Runtime environments (e.g. JSR-268, Surf) require urls to be re-written.- Parameters:
url- to encode- Returns:
- encoded url
-
getEncodeScriptUrlFunction
Return a client side javascript function to build urls to this service- Parameters:
name- Generated function name- Returns:
- javascript function definition
-
getEncodeResourceUrlFunction
Return a client side javascript function to build resource urls for this service- Parameters:
name- Generated function name- Returns:
- javascript function definition
-
getRuntime
Runtime getRuntime()Gets the initiating runtime- Returns:
- runtime that constructed this response
-