org.owasp.webscarab.plugin.proxy
Class ScriptableConnection

java.lang.Object
  extended by org.owasp.webscarab.plugin.proxy.ScriptableConnection

public class ScriptableConnection
extends java.lang.Object

This is a scriptable object, which represents a connection from a browser, the request that the browser submits, and the response that is returned.

Author:
rogan

Constructor Summary
ScriptableConnection(java.net.Socket socket)
          Creates a new instance of Connection
 
Method Summary
 void closeConnection()
          closes the connection to the browser
 java.net.InetAddress getAddress()
          This is the address of the remote host that is connected.
 Request getRequest()
          Can be called by a script to get the request that will be sent to the server
 Response getResponse()
          Gets the Response that was returned by the server
 void setRequest(Request request)
          Sets the Request object that will be sent to the server.
 void setResponse(Response response)
          Sets the Response that will be sent back to the browser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptableConnection

public ScriptableConnection(java.net.Socket socket)
Creates a new instance of Connection

Method Detail

getAddress

public java.net.InetAddress getAddress()
This is the address of the remote host that is connected. If the connection should not be allowed, call connection.closeConnection();

Returns:
the address of the remote host

closeConnection

public void closeConnection()
closes the connection to the browser


setRequest

public void setRequest(Request request)
Sets the Request object that will be sent to the server. Don't change this in a script that modifies the Response Set the Request to null to abort the request, and send an error back to the browser If you set the response as well, that response will be returned to the browser, and nothing will be added to the model

Parameters:
request - The request that should be sent to the server

getRequest

public Request getRequest()
Can be called by a script to get the request that will be sent to the server

Returns:
the Request that will be sent to the server

setResponse

public void setResponse(Response response)
Sets the Response that will be sent back to the browser. If this is called before the request has ben sent to the server, the request will be aborted, and the response will be sent back to the browser.

Parameters:
response - the response to send back to the browser

getResponse

public Response getResponse()
Gets the Response that was returned by the server

Returns:
the Response that was returned by the server