Errai 3.0.1-SNAPSHOT

org.jboss.errai.tools.proxy
Class HttpClient

java.lang.Object
  extended by org.jboss.errai.tools.proxy.HttpClient

public class HttpClient
extends Object

Author:
Yutaka Yoshida, Greg Murray, Heiko Braun

Minimum set of HTTPclient supporting both http and https. It's aslo capable of POST, but it doesn't provide doGet because the caller can just read the inputstream.


Constructor Summary
HttpClient(String phost, int pport, String url, Map headers, String method, String userName, String password, XmlHttpProxy.CookieCallback callback)
           
HttpClient(String phost, int pport, String url, Map headers, String method, XmlHttpProxy.CookieCallback callback)
           
 
Method Summary
 InputStream doPost(String postData, String contentType)
          posts data to the inputstream and returns the InputStream.
 String getContentEncoding()
           
 int getContentLength()
           
 String getContentType()
           
 long getDate()
           
 String getHeader(String name)
           
 long getIfModifiedSince()
           
 InputStream getInputStream()
          returns the inputstream from URLConnection
static Logger getLogger()
           
 OutputStream getOutputStream()
          return the OutputStream from URLConnection
 String getSetCookieHeader()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpClient

public HttpClient(String phost,
                  int pport,
                  String url,
                  Map headers,
                  String method,
                  XmlHttpProxy.CookieCallback callback)
           throws MalformedURLException
Parameters:
phost - PROXY host name
pport - PROXY port string
url - URL string
headers - Map
Throws:
MalformedURLException

HttpClient

public HttpClient(String phost,
                  int pport,
                  String url,
                  Map headers,
                  String method,
                  String userName,
                  String password,
                  XmlHttpProxy.CookieCallback callback)
           throws MalformedURLException
Parameters:
phost - PROXY host name
pport - PROXY port string
url - URL string
headers - Map
userName - string
password - string
Throws:
MalformedURLException
Method Detail

getSetCookieHeader

public String getSetCookieHeader()

getInputStream

public InputStream getInputStream()
returns the inputstream from URLConnection

Returns:
InputStream

getOutputStream

public OutputStream getOutputStream()
return the OutputStream from URLConnection

Returns:
OutputStream

doPost

public InputStream doPost(String postData,
                          String contentType)
posts data to the inputstream and returns the InputStream.

Parameters:
postData - data to be posted. must be url-encoded already.
contentType - allows you to set the contentType of the request.
Returns:
InputStream input stream from URLConnection

getContentEncoding

public String getContentEncoding()

getContentLength

public int getContentLength()

getContentType

public String getContentType()

getDate

public long getDate()

getHeader

public String getHeader(String name)

getIfModifiedSince

public long getIfModifiedSince()

getLogger

public static Logger getLogger()

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.