response
The response class provides you with a means for editing the responses received by the proxy server.
Scripts run in the scraping engine us the scrapeable file to manipulate server responses.
addHTTPHeader
void response.addHTTPHeader ( String key, String value )
Description
Add HTTP header to response.
Parameters
- key Name of the header, as a string.
- value Value associated with the header, as a string.
Return Values
Returns void.
Change Log
Version |
Description |
4.5 |
Available for all editions. |
Examples
Add HTTP Header
// Adds the HTTP Header Set-Cookie with a value
// of someCookieValue
response.addHTTPHeader( "Set-Cookie" , "someCookieValue");
See Also
getContentAsString
String response.getContentAsString ( )
Description
Retrieve the content of the response.
Parameters
This method does not receive any parameters.
Return Values
Returns the content of the response, as a string.
Change Log
Version |
Description |
4.5 |
Available for all editions. |
Examples
Get the Response Text
// Retrieve the contents of the response
content = response.getContentAsString();
See Also
getStatusLine
String response.getStatusLine ( )
Description
Retrieve the status line of the response.
Parameters
This method does not receive any parameters.
Return Values
Returns the status line of the response, as a string.
Change Log
Version |
Description |
4.5 |
Available for all editions. |
Examples
Get the Status Line Text
// Retrieve the status line of the response
statusLine = response.getStatusLine();
See Also
removeHTTPHeader
void response.removeHTTPHeader ( String key, String value )
Description
Remove HTTP header from response.
Parameters
- key Name of the header, as a string.
- value Value associated with the header, as a string.
Return Values
Returns void.
Change Log
Version |
Description |
4.5 |
Available for all editions. |
Examples
Remove HTTP Header
// Remove the HTTP Header Set-Cookie that has a
// value of someCookieValue
response.removeHTTPHeader( "Set-Cookie" , "someCookieValue");
See Also
setContentAsString
void response.setContentAsString ( String content )
Description
Manually set the response content.
Parameters
- content Response text, as a string.
Return Values
Returns void.
Change Log
Version |
Description |
4.5 |
Available for all editions. |
Examples
Change the Response Text
// Supply your own content to the response
response.setContentAsString( "<html> ... </html>");
See Also
setStatusLine
void response.setStatusLine ( String statusLine )
Description
Manually set the status line.
Parameters
- statusLine New status line declaration, as a string.
Return Values
Returns void.
Change Log
Version |
Description |
4.5 |
Available for all editions. |
Examples
Set Status Line
// Set the status line to HTTP/1.1 200 OK
response.setStatusLine( "HTTP/1.1 200 OK" );
See Also