org.infoglue.cms.util
Class HttpUtilities

java.lang.Object
  |
  +--org.infoglue.cms.util.HttpUtilities

public class HttpUtilities
extends java.lang.Object

URL utility class. Used for tasks involving getting url-contents from remote addresses within a program.

Since:
1999-10-05
Version:
1
Author:
Mattias Bogeblad

Method Summary
static java.lang.String getUrlContent(java.lang.String urlAddress)
           
static java.lang.String getUrlContent(java.lang.String urlAddress, java.util.Hashtable inHash)
           
static java.lang.String getUrlContent(java.lang.String urlAddress, java.util.Hashtable inHash, java.lang.String userName, java.lang.String password, boolean shouldEncode)
          This method gets information form an URL and returns a string.It throws an exception if anything goes wrong.
static java.lang.String getUrlContent(java.lang.String urlAddress, javax.servlet.http.HttpServletRequest request, boolean includeRequest)
           
static java.lang.String getUrlContent(java.lang.String urlAddress, java.lang.String data, java.lang.String userName, java.lang.String password)
           
static java.io.InputStream getURLStream(java.lang.String urlAddress, java.util.Hashtable inHash)
          This method gets information form an URL and returns an input stream.It throws an exception if anything goes wrong.
static java.lang.String postToUrl(java.lang.String urlAddress, java.util.Hashtable inHash)
          This method post information to an URL and returns a string.It throws an exception if anything goes wrong.
static java.lang.String postToUrl(java.lang.String urlAddress, java.util.Hashtable inHash, java.lang.String userName, java.lang.String password, boolean shouldEncode)
          This method post information to an URL and returns a string.It throws an exception if anything goes wrong.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

postToUrl

public static java.lang.String postToUrl(java.lang.String urlAddress,
                                         java.util.Hashtable inHash)
                                  throws java.lang.Exception
This method post information to an URL and returns a string.It throws an exception if anything goes wrong. (Works like most 'doPost' methods)

Parameters:
urlAddress - The address of the URL you would like to post to.
inHash - The parameters you would like to post to the URL.
Returns:
The result of the postToUrl method as a string.
Throws:
java.lang.Exception

postToUrl

public static java.lang.String postToUrl(java.lang.String urlAddress,
                                         java.util.Hashtable inHash,
                                         java.lang.String userName,
                                         java.lang.String password,
                                         boolean shouldEncode)
                                  throws java.lang.Exception
This method post information to an URL and returns a string.It throws an exception if anything goes wrong. (Works like most 'doPost' methods)

Parameters:
urlAddress - The address of the URL you would like to post to.
inHash - The parameters you would like to post to the URL.
Returns:
The result of the postToUrl method as a string.
Throws:
java.lang.Exception

getUrlContent

public static java.lang.String getUrlContent(java.lang.String urlAddress,
                                             javax.servlet.http.HttpServletRequest request,
                                             boolean includeRequest)
                                      throws java.lang.Exception
java.lang.Exception

getUrlContent

public static java.lang.String getUrlContent(java.lang.String urlAddress,
                                             java.util.Hashtable inHash)
                                      throws java.lang.Exception
java.lang.Exception

getUrlContent

public static java.lang.String getUrlContent(java.lang.String urlAddress)
                                      throws java.lang.Exception
java.lang.Exception

getUrlContent

public static java.lang.String getUrlContent(java.lang.String urlAddress,
                                             java.util.Hashtable inHash,
                                             java.lang.String userName,
                                             java.lang.String password,
                                             boolean shouldEncode)
                                      throws java.lang.Exception
This method gets information form an URL and returns a string.It throws an exception if anything goes wrong. (Works like most 'doGet' methods)

Parameters:
urlAddress - The address of the URL you would like to get information from.
inHash - The parameters you would like to get from the URL.
Returns:
The result of the getUrlContent method as a string.
Throws:
java.lang.Exception

getUrlContent

public static java.lang.String getUrlContent(java.lang.String urlAddress,
                                             java.lang.String data,
                                             java.lang.String userName,
                                             java.lang.String password)
                                      throws java.lang.Exception
java.lang.Exception

getURLStream

public static java.io.InputStream getURLStream(java.lang.String urlAddress,
                                               java.util.Hashtable inHash)
                                        throws java.lang.Exception
This method gets information form an URL and returns an input stream.It throws an exception if anything goes wrong. It returns a input stream so that you can return objects. (Works like most 'doGet' methods)

Parameters:
urlAddress - The address of the URL you would like to get information from.
inHash - The parameters you would like to get from the URL.
Returns:
A input stream.
Throws:
java.lang.Exception