org.activemath.author.toc
Class ActiveMathAuthenticatedConnection

java.lang.Object
  extended by org.activemath.author.toc.ActiveMathAuthenticatedConnection

public class ActiveMathAuthenticatedConnection
extends Object

This class is responsible to ensure that an authenticated connection is preformed to the server using cookies and possibly opening a pop-up to request user-names and password.


Constructor Summary
ActiveMathAuthenticatedConnection()
          Simple constructor: a pop-up will appear.
ActiveMathAuthenticatedConnection(Map cookies, URL cookiesPath)
          Initializes the connection to contain exactly the indicated cookies for the given URL
ActiveMathAuthenticatedConnection(Subconfiguration config)
          Constructs a connection using the properties cookies.
 
Method Summary
 org.apache.commons.httpclient.methods.PostMethod createFormPostMethod(String url)
           
 org.apache.commons.httpclient.methods.GetMethod createGetMethod(String url)
           
 org.apache.commons.httpclient.methods.PostMethod createRawPostMethod(String url, byte[] postContent)
           
 int executeMethod(org.apache.commons.httpclient.HttpMethod method)
           
 org.apache.commons.httpclient.HttpClient getClient()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveMathAuthenticatedConnection

public ActiveMathAuthenticatedConnection()
Simple constructor: a pop-up will appear. NOTE: re-login detection hasn't been done yet.


ActiveMathAuthenticatedConnection

public ActiveMathAuthenticatedConnection(Subconfiguration config)
Constructs a connection using the properties cookies.<name>.


ActiveMathAuthenticatedConnection

public ActiveMathAuthenticatedConnection(Map cookies,
                                         URL cookiesPath)
Initializes the connection to contain exactly the indicated cookies for the given URL

Parameters:
cookies - The table associating cookie-names to cookie-values
cookiesPath - The path of the cookies.
Method Detail

getClient

public org.apache.commons.httpclient.HttpClient getClient()
Returns:
The HttpState describing the current state of the connection..

executeMethod

public int executeMethod(org.apache.commons.httpclient.HttpMethod method)
                  throws IOException,
                         org.apache.commons.httpclient.HttpException
Throws:
IOException
org.apache.commons.httpclient.HttpException

createGetMethod

public org.apache.commons.httpclient.methods.GetMethod createGetMethod(String url)
Parameters:
url - The URL to set the request to
Returns:
A get-method prepared for the given URL For this method to be run with appropriate cookies, please use executeMethod(org.apache.commons.httpclient.HttpMethod).

createRawPostMethod

public org.apache.commons.httpclient.methods.PostMethod createRawPostMethod(String url,
                                                                            byte[] postContent)
Parameters:
url - the url to ost to
postContent - The bytes that will be sent over
Returns:
A post-method prepared for the given URL that will post the indicated byte-array. For this method to be run with appropriate cookies please use executeMethod(org.apache.commons.httpclient.HttpMethod).

createFormPostMethod

public org.apache.commons.httpclient.methods.PostMethod createFormPostMethod(String url)
Parameters:
url - the url to ost to
Returns:
A post-method prepared for the given URL the name-value-pairs provided to it using the x-www-url-form-encoded. For this method to be run with appropriate cookies please use executeMethod(org.apache.commons.httpclient.HttpMethod).