HttpRequest
Date: 2012-07-11

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.gcube.contentmanagement.graphtools.utils
Class HttpRequest

    java.lang.Object
      org.gcube.contentmanagement.graphtools.utils.HttpRequest

    public class HttpRequest

extends java.lang.Object

Constructor Summary
`HttpRequest()`

Method Summary
`static java.lang.String` | `AddCDATA(java.lang.String phrase)`
`static int` | `checkUrl(java.lang.String url, java.lang.String username, java.lang.String password)`
`static java.lang.Object` | `getJSonData(java.lang.String endpoint, java.lang.String requestParameters, java.lang.reflect.Type outputClass)`
`static void` | `main(java.lang.String[] args)`
`static java.lang.String` | `ManageCDATA(java.lang.String phrase)`
`static void` | `postData(java.io.Reader data, java.net.URL endpoint, java.io.Writer output)` Reads data from the data reader and posts it to a server via POST request.
`static java.lang.Object` | `postJSonData(java.lang.String endpoint, java.lang.Object obj, java.lang.reflect.Type outputClass)`
`static java.lang.String` | `sendGetRequest(java.lang.String endpoint, java.lang.String requestParameters)` Sends an HTTP GET request to a url
`static java.lang.String` | `sendPostRequest(java.lang.String endpoint, java.lang.String requestParameters)`
`static java.lang.String` | `toJSon(java.lang.Object obj)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HttpRequest

    public HttpRequest()

Method Detail

### sendGetRequest

    public static java.lang.String sendGetRequest(java.lang.String endpoint,
                                                  java.lang.String requestParameters)

  Sends an HTTP GET request to a url

  Parameters:
    `endpoint` - - The URL of the server. (Example: " http://www.yahoo.com/search")
    `requestParameters` - - all the request parameters (Example: "param1=val1¶m2=val2"). Note: This method will add the question mark (?) to the request - DO NOT add it yourself
  Returns:
    - The response from the end point

### postData

    public static void postData(java.io.Reader data,
                                java.net.URL endpoint,
                                java.io.Writer output)
                         throws java.lang.Exception

  Reads data from the data reader and posts it to a server via POST request. data - The data you want to send endpoint - The server's address output - writes the server's response to output

  Throws:
    `java.lang.Exception`

### getJSonData

    public static java.lang.Object getJSonData(java.lang.String endpoint,
                                               java.lang.String requestParameters,
                                               java.lang.reflect.Type outputClass)
                                        throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### toJSon

    public static java.lang.String toJSon(java.lang.Object obj)

### postJSonData

    public static java.lang.Object postJSonData(java.lang.String endpoint,
                                                java.lang.Object obj,
                                                java.lang.reflect.Type outputClass)
                                         throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### sendPostRequest

    public static java.lang.String sendPostRequest(java.lang.String endpoint,
                                                   java.lang.String requestParameters)

### ManageCDATA

    public static java.lang.String ManageCDATA(java.lang.String phrase)

### AddCDATA

    public static java.lang.String AddCDATA(java.lang.String phrase)

### checkUrl

    public static int checkUrl(java.lang.String url,
                               java.lang.String username,
                               java.lang.String password)

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD