org.jboss.test.util.web
Class HttpUtils

java.lang.Object
  extended byorg.jboss.test.util.web.HttpUtils

public class HttpUtils
extends java.lang.Object

Utilities for client http requests


Field Summary
static int DELETE
           
static int GET
           
static int HEAD
           
static int OPTIONS
           
static int POST
           
static int PUT
           
static int TRACE
           
 
Constructor Summary
HttpUtils()
           
 
Method Summary
static HttpMethodBase accessURL(java.net.URL url)
          Perform a get on the indicated URL and assert an HTTP_OK response code
static HttpMethodBase accessURL(java.net.URL url, java.lang.String realm, int expectedHttpCode)
          Perform a get on the indicated URL and assert that the response code matches the expectedHttpCode argument.
static HttpMethodBase accessURL(java.net.URL url, java.lang.String realm, int expectedHttpCode, Header[] hdrs)
           
static HttpMethodBase accessURL(java.net.URL url, java.lang.String realm, int expectedHttpCode, Header[] hdrs, int type)
           
static HttpMethodBase accessURL(java.net.URL url, java.lang.String realm, int expectedHttpCode, int type)
           
static HttpMethodBase createMethod(java.net.URL url, int type)
           
static java.lang.String getBaseURL()
           
static java.lang.String getBaseURL(java.lang.String username, java.lang.String password)
           
static java.lang.String getBaseURLNoAuth()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET

public static final int GET
See Also:
Constant Field Values (src)

POST

public static final int POST
See Also:
Constant Field Values (src)

HEAD

public static final int HEAD
See Also:
Constant Field Values (src)

OPTIONS

public static final int OPTIONS
See Also:
Constant Field Values (src)

PUT

public static final int PUT
See Also:
Constant Field Values (src)

DELETE

public static final int DELETE
See Also:
Constant Field Values (src)

TRACE

public static final int TRACE
See Also:
Constant Field Values (src)
Constructor Detail

HttpUtils

public HttpUtils()
Method Detail

getBaseURL

public static java.lang.String getBaseURL()

getBaseURL

public static java.lang.String getBaseURL(java.lang.String username,
                                          java.lang.String password)

getBaseURLNoAuth

public static java.lang.String getBaseURLNoAuth()

accessURL

public static HttpMethodBase accessURL(java.net.URL url)
                                throws java.lang.Exception
Perform a get on the indicated URL and assert an HTTP_OK response code

Parameters:
url -
Returns:
The commons HttpClient used to perform the get
Throws:
java.lang.Exception - on any failure

accessURL

public static HttpMethodBase accessURL(java.net.URL url,
                                       java.lang.String realm,
                                       int expectedHttpCode)
                                throws java.lang.Exception
Perform a get on the indicated URL and assert that the response code matches the expectedHttpCode argument.

Parameters:
url -
expectedHttpCode - the http response code expected
Returns:
The commons HttpClient used to perform the get
Throws:
java.lang.Exception - on any failure

accessURL

public static HttpMethodBase accessURL(java.net.URL url,
                                       java.lang.String realm,
                                       int expectedHttpCode,
                                       int type)
                                throws java.lang.Exception
Throws:
java.lang.Exception

accessURL

public static HttpMethodBase accessURL(java.net.URL url,
                                       java.lang.String realm,
                                       int expectedHttpCode,
                                       Header[] hdrs)
                                throws java.lang.Exception
Throws:
java.lang.Exception

accessURL

public static HttpMethodBase accessURL(java.net.URL url,
                                       java.lang.String realm,
                                       int expectedHttpCode,
                                       Header[] hdrs,
                                       int type)
                                throws java.lang.Exception
Throws:
java.lang.Exception

createMethod

public static HttpMethodBase createMethod(java.net.URL url,
                                          int type)