com.atlassian.confluence.it
Class RestHelper

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

public class RestHelper
extends Object

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


Field Summary
static String BASE_URL
           
static String REST_PATH
           
 
Constructor Summary
RestHelper()
           
 
Method Summary
static
<T> T
doGet(com.sun.jersey.api.client.WebResource resource, Class<T> entityClass)
           
static
<T> T
doGet(com.sun.jersey.api.client.WebResource resource, Class<T> entityClass, String requestType)
           
static
<T> T
doRawGet(com.sun.jersey.api.client.WebResource resource, Class<T> entityClass)
          Do a get without asserting success
static String getFullRestPath()
           
static com.sun.jersey.api.client.ClientResponse getGETResponse(String relativePath, User user, Map<String,String> params)
           
static JSONObject getJsonResponse(com.sun.jersey.api.client.WebResource resource)
          Send a GET request to the provided WebResource and return the response as a JSON object.
static com.sun.jersey.api.client.WebResource.Builder newJsonResource(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(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 JSONObject postJson(String url, String jsonPayload, User user)
           
static void postJsonWithNoResponse(String url, 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 String BASE_URL

REST_PATH

public static final 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)

newResource

public static com.sun.jersey.api.client.WebResource newResource(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(String url,
                                                                            User user)
Returns a new web resource accepting JSON, with OS credentials for the passed user.


getJsonResponse

public static JSONObject getJsonResponse(com.sun.jersey.api.client.WebResource resource)
                                  throws JSONException
Send a GET request to the provided WebResource and return the response as a JSON object.

Throws:
JSONException

postJson

public static JSONObject postJson(String url,
                                  String jsonPayload,
                                  User user)
                           throws JSONException
Throws:
JSONException

postJsonWithNoResponse

public static void postJsonWithNoResponse(String url,
                                          String jsonPayload,
                                          User user)
                                   throws JSONException
Throws:
JSONException

doGet

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

doGet

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

getFullRestPath

public static String getFullRestPath()

getGETResponse

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

doRawGet

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



Copyright © 2003-2013 Atlassian. All Rights Reserved.