com.slimpay
Class Resource

java.lang.Object
  extended by com.slimpay.Resource

public class Resource
extends Object


Field Summary
protected static org.apache.http.impl.client.CloseableHttpClient client
           
protected  String entityContent
           
protected  org.apache.http.client.methods.CloseableHttpResponse response
           
protected static Token token
           
 
Constructor Summary
protected Resource()
           
protected Resource(org.apache.http.client.methods.CloseableHttpResponse response)
           
 
Method Summary
static String entityToString(org.apache.http.HttpEntity entity)
           
protected  void finalize()
           
 Resource follow(RequestMethod method, String rel)
           
 Resource follow(RequestMethod method, String rel, org.apache.http.HttpEntity data, String format)
           
 Resource follow(RequestMethod method, String rel, org.json.JSONObject data)
           
 Resource follow(RequestMethod method, String rel, Map<String,String> data)
           
 Resource follow(RequestMethod method, String rel, String data)
           
 org.json.JSONObject getBodyAsJson()
           
 String getBodyAsString()
           
 Link getLink(String rel)
           
 Link getLink(String rel, boolean strict)
           
 org.json.JSONObject getLinks()
           
 org.apache.http.client.methods.CloseableHttpResponse getResponse()
           
static Resource getRoot()
           
static org.apache.http.entity.StringEntity jsonToEntity(org.json.JSONObject data)
           
static org.apache.http.client.entity.UrlEncodedFormEntity mapToEntity(Map<String,String> data)
           
protected static void oauth()
           
static Resource request(RequestMethod method, String url)
           
static Resource request(RequestMethod method, String url, org.apache.http.HttpEntity data, String format)
           
static Resource request(RequestMethod method, String url, org.json.JSONObject data)
           
static Resource request(RequestMethod method, String url, Map<String,String> data)
           
 void setResponse(org.apache.http.client.methods.CloseableHttpResponse response)
           
static org.apache.http.entity.StringEntity stringToEntity(String data)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

client

protected static org.apache.http.impl.client.CloseableHttpClient client

token

protected static Token token

response

protected org.apache.http.client.methods.CloseableHttpResponse response

entityContent

protected String entityContent
Constructor Detail

Resource

protected Resource()

Resource

protected Resource(org.apache.http.client.methods.CloseableHttpResponse response)
            throws Exception
Throws:
Exception
Method Detail

getResponse

public org.apache.http.client.methods.CloseableHttpResponse getResponse()

setResponse

public void setResponse(org.apache.http.client.methods.CloseableHttpResponse response)
                 throws Exception
Throws:
Exception

getBodyAsString

public String getBodyAsString()

getBodyAsJson

public org.json.JSONObject getBodyAsJson()

getLinks

public org.json.JSONObject getLinks()

getLink

public Link getLink(String rel)

getLink

public Link getLink(String rel,
                    boolean strict)

follow

public Resource follow(RequestMethod method,
                       String rel)
                throws Exception,
                       RequestDataException,
                       HttpException
Throws:
Exception
RequestDataException
HttpException

follow

public Resource follow(RequestMethod method,
                       String rel,
                       org.json.JSONObject data)
                throws Exception,
                       RequestDataException,
                       HttpException
Throws:
Exception
RequestDataException
HttpException

follow

public Resource follow(RequestMethod method,
                       String rel,
                       Map<String,String> data)
                throws Exception,
                       RequestDataException,
                       HttpException
Throws:
Exception
RequestDataException
HttpException

follow

public Resource follow(RequestMethod method,
                       String rel,
                       String data)
                throws Exception,
                       RequestDataException,
                       HttpException
Throws:
Exception
RequestDataException
HttpException

follow

public Resource follow(RequestMethod method,
                       String rel,
                       org.apache.http.HttpEntity data,
                       String format)
                throws Exception,
                       RequestDataException,
                       HttpException
Throws:
Exception
RequestDataException
HttpException

request

public static Resource request(RequestMethod method,
                               String url)
                        throws Exception,
                               RequestDataException,
                               HttpException
Throws:
Exception
RequestDataException
HttpException

request

public static Resource request(RequestMethod method,
                               String url,
                               org.json.JSONObject data)
                        throws Exception,
                               RequestDataException,
                               HttpException
Throws:
Exception
RequestDataException
HttpException

request

public static Resource request(RequestMethod method,
                               String url,
                               Map<String,String> data)
                        throws Exception,
                               RequestDataException,
                               HttpException
Throws:
Exception
RequestDataException
HttpException

request

public static Resource request(RequestMethod method,
                               String url,
                               org.apache.http.HttpEntity data,
                               String format)
                        throws Exception,
                               RequestDataException,
                               HttpException
Throws:
Exception
RequestDataException
HttpException

getRoot

public static Resource getRoot()
                        throws Exception,
                               RequestDataException,
                               HttpException
Throws:
Exception
RequestDataException
HttpException

oauth

protected static void oauth()
                     throws Exception,
                            RequestDataException,
                            HttpException
Throws:
Exception
RequestDataException
HttpException

mapToEntity

public static org.apache.http.client.entity.UrlEncodedFormEntity mapToEntity(Map<String,String> data)
                                                                      throws Exception,
                                                                             RequestDataException,
                                                                             HttpException
Throws:
Exception
RequestDataException
HttpException

stringToEntity

public static org.apache.http.entity.StringEntity stringToEntity(String data)
                                                          throws RequestDataException,
                                                                 HttpException
Throws:
RequestDataException
HttpException

jsonToEntity

public static org.apache.http.entity.StringEntity jsonToEntity(org.json.JSONObject data)
                                                        throws RequestDataException,
                                                               HttpException
Throws:
RequestDataException
HttpException

entityToString

public static String entityToString(org.apache.http.HttpEntity entity)
                             throws Exception
Throws:
Exception

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2015. All rights reserved.