Package com.atlassian.confluence.it.web
Class HttpRequest
- java.lang.Object
-
- com.atlassian.confluence.it.web.HttpRequest
-
- All Implemented Interfaces:
AutoCloseable
public class HttpRequest extends Object implements AutoCloseable
Provides authenticated raw HTTP access to Confluence URLs for testing.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static intexecute(User user, org.apache.commons.httpclient.HttpMethod method)Executes the provided request.static HttpRequestget(User user, String url)Executes a GET on the provided URL.StringgetResponseBody()InputStreamgetResponseBodyAsStream()StringgetResponseHeader(String headerName)Map<String,List<String>>getResponseHeaders()intgetStatusCode()
-
-
-
Method Detail
-
execute
public static int execute(User user, org.apache.commons.httpclient.HttpMethod method) throws IOException
Executes the provided request. The method parameter will then contain information about the response.- Throws:
IOException- as documented byHttpClient.executeMethod(HttpMethod)
-
get
public static HttpRequest get(User user, String url)
Executes a GET on the provided URL. The returned HttpRequest object can be used to query information about the result.- Throws:
RuntimeException- if any problem occurs with the request, where the cause is any exception thrown byHttpClient.executeMethod(HttpMethod)
-
getStatusCode
public int getStatusCode()
-
getResponseBodyAsStream
public InputStream getResponseBodyAsStream() throws IOException
- Throws:
IOException
-
getResponseBody
public String getResponseBody() throws IOException
- Throws:
IOException
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-