org.infoglue.deliver.util
Class HttpUtilities

java.lang.Object
  extended by org.infoglue.deliver.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

Constructor Summary
HttpUtilities()
           
 
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 encoding)
           
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, javax.servlet.http.HttpServletRequest request, boolean includeRequest, java.lang.String encoding)
           
static java.lang.String getUrlContent(java.lang.String urlAddress, java.lang.String encoding)
           
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.
static java.util.Hashtable requestToHashtable(javax.servlet.http.HttpServletRequest request)
          This method converts the request-object to a hashtable instead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpUtilities

public HttpUtilities()
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
Throws:
java.lang.Exception

getUrlContent

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

getUrlContent

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

getUrlContent

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

getUrlContent

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

getUrlContent

public static java.lang.String getUrlContent(java.lang.String urlAddress,
                                             java.lang.String encoding)
                                      throws java.lang.Exception
Throws:
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
Throws:
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

requestToHashtable

public static java.util.Hashtable requestToHashtable(javax.servlet.http.HttpServletRequest request)
This method converts the request-object to a hashtable instead.



Copyright © 2005 InfoGlue.org All Rights Reserved.