Class HTTPClient


  • public class HTTPClient
    extends java.lang.Object
    This is a small wrapper for the commons http client to initialize the proxy settings and so on...
    Version:
    1.0, 02.09.2007
    Author:
    Thoralf Rickert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.commons.httpclient.HttpClient client
      The real client that makes everything
    • Constructor Summary

      Constructors 
      Constructor Description
      HTTPClient​(java.util.Properties properties)
      Creates a new HTTP Client to connect to remote HTTP servers.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      HTTPResult get​(java.lang.String uri)
      Macht einen GET Request.
      HTTPResult get​(java.net.URI uri)
      Macht einen GET Request.
      HTTPResult get​(java.net.URI uri, boolean async)
      Macht einen GET Request.
      org.apache.commons.httpclient.Cookie[] getCookies()
      Liefert die Cookies
      boolean isConnectionFailed()
      Liefert true genau dann, wenn keine verbindung hergestellt werden konnte
      HTTPResult post​(java.lang.String uri, java.lang.String content)
      Macht einen POST Request.
      HTTPResult post​(java.lang.String uri, java.lang.String key, java.lang.String content)
      Macht einen POST Request.
      HTTPResult post​(java.net.URI uri, java.lang.String content)
      Macht einen POST Request.
      HTTPResult post​(java.net.URI uri, java.lang.String key, java.lang.String content)
      Macht einen POST Request.
      protected HTTPResult post​(java.net.URI uri, java.lang.String content, org.apache.commons.httpclient.methods.multipart.Part[] parts)
      Macht einen POST Request.
      HTTPResult post​(java.net.URI uri, org.apache.commons.httpclient.methods.multipart.Part[] parts)
      Macht einen POST Request.
      HTTPResult post​(java.net.URI uri, org.apache.commons.httpclient.NameValuePair[] parameters)
      Macht einen POST Request.
      HTTPResult put​(java.lang.String uri, java.lang.String content)
      Makes a PUT request.
      HTTPResult put​(java.lang.String uri, java.lang.String content, org.apache.commons.httpclient.NameValuePair[] header)
      Makes a PUT request.
      HTTPResult put​(java.net.URI uri, java.lang.String content, java.lang.String contentType, java.lang.String charset, org.apache.commons.httpclient.NameValuePair[] header)
      Makes a PUT request.
      void setCookiePolicy​(boolean accept)
      Setzt die Cookie Policy
      void setProxy​(java.lang.String host, int port)
      Sets the Proxy server.
      void setProxy​(java.net.Proxy proxy)
      Sets the Proxy server.
      void setTimeOut​(int seconds)
      Setzt den Timeout des Clients auf einen sinnvollen Wert.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • client

        protected org.apache.commons.httpclient.HttpClient client
        The real client that makes everything
    • Constructor Detail

      • HTTPClient

        public HTTPClient​(java.util.Properties properties)
        Creates a new HTTP Client to connect to remote HTTP servers.
    • Method Detail

      • setProxy

        public void setProxy​(java.lang.String host,
                             int port)
        Sets the Proxy server.
      • setProxy

        public void setProxy​(java.net.Proxy proxy)
        Sets the Proxy server.
      • get

        public HTTPResult get​(java.lang.String uri)
        Macht einen GET Request.
      • get

        public HTTPResult get​(java.net.URI uri)
        Macht einen GET Request.
      • get

        public HTTPResult get​(java.net.URI uri,
                              boolean async)
        Macht einen GET Request.
      • post

        public HTTPResult post​(java.net.URI uri,
                               org.apache.commons.httpclient.NameValuePair[] parameters)
        Macht einen POST Request.
      • post

        public HTTPResult post​(java.net.URI uri,
                               java.lang.String content)
        Macht einen POST Request.
      • post

        public HTTPResult post​(java.lang.String uri,
                               java.lang.String content)
        Macht einen POST Request.
      • post

        public HTTPResult post​(java.net.URI uri,
                               org.apache.commons.httpclient.methods.multipart.Part[] parts)
        Macht einen POST Request.
      • post

        protected HTTPResult post​(java.net.URI uri,
                                  java.lang.String content,
                                  org.apache.commons.httpclient.methods.multipart.Part[] parts)
        Macht einen POST Request.
      • post

        public HTTPResult post​(java.lang.String uri,
                               java.lang.String key,
                               java.lang.String content)
        Macht einen POST Request.
      • post

        public HTTPResult post​(java.net.URI uri,
                               java.lang.String key,
                               java.lang.String content)
        Macht einen POST Request.
      • put

        public HTTPResult put​(java.lang.String uri,
                              java.lang.String content)
        Makes a PUT request.
      • put

        public HTTPResult put​(java.lang.String uri,
                              java.lang.String content,
                              org.apache.commons.httpclient.NameValuePair[] header)
        Makes a PUT request.
      • put

        public HTTPResult put​(java.net.URI uri,
                              java.lang.String content,
                              java.lang.String contentType,
                              java.lang.String charset,
                              org.apache.commons.httpclient.NameValuePair[] header)
        Makes a PUT request.
      • setTimeOut

        public void setTimeOut​(int seconds)
        Setzt den Timeout des Clients auf einen sinnvollen Wert.
      • setCookiePolicy

        public void setCookiePolicy​(boolean accept)
        Setzt die Cookie Policy
      • getCookies

        public org.apache.commons.httpclient.Cookie[] getCookies()
        Liefert die Cookies
      • isConnectionFailed

        public boolean isConnectionFailed()
        Liefert true genau dann, wenn keine verbindung hergestellt werden konnte