com.atlassian.confluence.it
Class RestHelper

java.lang.Object
  extended by com.atlassian.confluence.it.RestHelper

public class RestHelper
extends java.lang.Object

Provides methods for creating REST WebResource objects and processing REST calls.


Field Summary
static java.lang.String BASE_URL
           
static java.lang.String REST_PATH
           
 
Constructor Summary
RestHelper()
           
 
Method Summary
static void doDeleteJson(java.lang.String url, User user)
           
static
<T> T
doGet(com.sun.jersey.api.client.WebResource resource, java.lang.Class<T> entityClass)
           
static
<T> T
doGet(com.sun.jersey.api.client.WebResource resource, java.lang.Class<T> entityClass, java.lang.String requestType)
           
static com.sun.jersey.api.client.ClientResponse doGetRequest(com.sun.jersey.api.client.WebResource resource, java.lang.String requestType)
           
static java.net.URI doPost(com.sun.jersey.api.client.WebResource resource, java.lang.Object entity)
           
static
<T> T
doPut(com.sun.jersey.api.client.WebResource resource, T entity)
           
static
<T> T
doPut(com.sun.jersey.api.client.WebResource resource, T entity, java.lang.String requestType)
           
static
<T> T
doRawGet(com.sun.jersey.api.client.WebResource resource, java.lang.Class<T> entityClass)
          Do a get without asserting success
static
<T> T
doRawGet(com.sun.jersey.api.client.WebResource resource, java.lang.Class<T> entityClass, java.lang.String requestType)
          Do a get without asserting success, specifying the request type.
static com.sun.jersey.api.client.WebResource expand(com.sun.jersey.api.client.WebResource webResource, java.lang.String... values)
           
static com.sun.jersey.api.client.WebResource expandWithIndexes(com.sun.jersey.api.client.WebResource webResource, java.lang.String value, int start, int end)
           
static org.codehaus.jackson.JsonNode fetchJsonResponse(com.sun.jersey.api.client.WebResource resource)
          Send a GET request to the provided WebResource and return the response as a JSON object.
static java.lang.String getFullRestPath()
           
static com.sun.jersey.api.client.ClientResponse getGETResponse(java.lang.String relativePath, User user, java.util.Map<java.lang.String,java.lang.String> params)
           
static JSONObject getJsonResponse(com.sun.jersey.api.client.WebResource resource)
          Deprecated. Since 5.4 Use fetchJsonResponse(com.sun.jersey.api.client.WebResource)
static java.lang.String getJsonResponseString(com.sun.jersey.api.client.WebResource resource)
          Send a GET request to the provided WebResource and return the response as a JSON string.
static com.sun.jersey.api.client.WebResource getRootResource(User user)
           
static com.sun.jersey.api.client.WebResource.Builder newJsonResource(java.lang.String url, User user)
          Returns a new web resource accepting JSON, with OS credentials for the passed user.
static com.sun.jersey.api.client.WebResource newResource(java.lang.String url, User user)
          Returns a new web resource with OS credentials for the passed user.
static com.sun.jersey.api.client.WebResource newResource(User user)
           
static org.codehaus.jackson.JsonNode postJson(java.lang.String url, java.lang.String jsonPayload, User user)
           
static void postJsonWithNoResponse(java.lang.String url, java.lang.String jsonPayload, User user)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_URL

public static final java.lang.String BASE_URL

REST_PATH

public static final java.lang.String REST_PATH
See Also:
Constant Field Values
Constructor Detail

RestHelper

public RestHelper()
Method Detail

newResource

public static com.sun.jersey.api.client.WebResource newResource(User user)

getRootResource

public static com.sun.jersey.api.client.WebResource getRootResource(User user)

newResource

public static com.sun.jersey.api.client.WebResource newResource(java.lang.String url,
                                                                User user)
Returns a new web resource with OS credentials for the passed user.


newJsonResource

public static com.sun.jersey.api.client.WebResource.Builder newJsonResource(java.lang.String url,
                                                                            User user)
Returns a new web resource accepting JSON, with OS credentials for the passed user.


getJsonResponse

@Deprecated
public static JSONObject getJsonResponse(com.sun.jersey.api.client.WebResource resource)
                                  throws JSONException
Deprecated. Since 5.4 Use fetchJsonResponse(com.sun.jersey.api.client.WebResource)

Send a GET request to the provided WebResource and return the response as a JSON object.

Throws:
JSONException

fetchJsonResponse

public static org.codehaus.jackson.JsonNode fetchJsonResponse(com.sun.jersey.api.client.WebResource resource)
                                                       throws java.io.IOException
Send a GET request to the provided WebResource and return the response as a JSON object.

Throws:
java.io.IOException

getJsonResponseString

public static java.lang.String getJsonResponseString(com.sun.jersey.api.client.WebResource resource)
Send a GET request to the provided WebResource and return the response as a JSON string.


postJson

public static org.codehaus.jackson.JsonNode postJson(java.lang.String url,
                                                     java.lang.String jsonPayload,
                                                     User user)
                                              throws java.io.IOException
Throws:
java.io.IOException

postJsonWithNoResponse

public static void postJsonWithNoResponse(java.lang.String url,
                                          java.lang.String jsonPayload,
                                          User user)

doDeleteJson

public static void doDeleteJson(java.lang.String url,
                                User user)

doGet

public static <T> T doGet(com.sun.jersey.api.client.WebResource resource,
                          java.lang.Class<T> entityClass)

doGet

public static <T> T doGet(com.sun.jersey.api.client.WebResource resource,
                          java.lang.Class<T> entityClass,
                          java.lang.String requestType)

getFullRestPath

public static java.lang.String getFullRestPath()

getGETResponse

public static com.sun.jersey.api.client.ClientResponse getGETResponse(java.lang.String relativePath,
                                                                      User user,
                                                                      java.util.Map<java.lang.String,java.lang.String> params)

doRawGet

public static <T> T doRawGet(com.sun.jersey.api.client.WebResource resource,
                             java.lang.Class<T> entityClass)
Do a get without asserting success


doRawGet

public static <T> T doRawGet(com.sun.jersey.api.client.WebResource resource,
                             java.lang.Class<T> entityClass,
                             java.lang.String requestType)
Do a get without asserting success, specifying the request type.


doGetRequest

public static com.sun.jersey.api.client.ClientResponse doGetRequest(com.sun.jersey.api.client.WebResource resource,
                                                                    java.lang.String requestType)

doPut

public static <T> T doPut(com.sun.jersey.api.client.WebResource resource,
                          T entity)

doPut

public static <T> T doPut(com.sun.jersey.api.client.WebResource resource,
                          T entity,
                          java.lang.String requestType)

doPost

public static java.net.URI doPost(com.sun.jersey.api.client.WebResource resource,
                                  java.lang.Object entity)

expand

public static com.sun.jersey.api.client.WebResource expand(com.sun.jersey.api.client.WebResource webResource,
                                                           java.lang.String... values)

expandWithIndexes

public static com.sun.jersey.api.client.WebResource expandWithIndexes(com.sun.jersey.api.client.WebResource webResource,
                                                                      java.lang.String value,
                                                                      int start,
                                                                      int end)


Copyright © 2003-2013 Atlassian. All Rights Reserved.