org.infoglue.deliver.util
Class HttpHelper

java.lang.Object
  extended by org.infoglue.deliver.util.HttpHelper

public class HttpHelper
extends java.lang.Object

Author:
Mattias Bogeblad Various methods to fetch url-contents

Constructor Summary
HttpHelper()
           
 
Method Summary
 java.lang.String getCookie(javax.servlet.http.HttpServletRequest request, java.lang.String cookieName)
          This method gets a cookie.
 java.lang.String getUrlContent(java.lang.String urlAddress)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, java.util.Hashtable inHash)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, java.util.Hashtable inHash, java.lang.String encoding)
           
 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.
 java.lang.String getUrlContent(java.lang.String urlAddress, javax.servlet.http.HttpServletRequest request, boolean includeRequest)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, javax.servlet.http.HttpServletRequest request, boolean includeRequest, java.lang.String encoding)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, java.util.Map requestParameters)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, java.util.Map requestParameters, int timeout)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, java.util.Map requestParameters, java.lang.String encoding, int timeout)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, java.lang.String encoding)
           
 java.lang.String getUrlContent(java.lang.String urlAddress, java.lang.String data, java.lang.String userName, java.lang.String password)
           
 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.
 java.lang.String postToUrl(java.lang.String urlAddress, java.util.Hashtable inHash, java.lang.String encoding)
          This method post information to an URL and returns a string.It throws an exception if anything goes wrong.
 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.
 java.lang.String postToUrl(java.lang.String urlAddress, javax.servlet.http.HttpServletRequest request, boolean includeRequest)
           
 java.lang.String postToUrl(java.lang.String urlAddress, javax.servlet.http.HttpServletRequest request, boolean includeRequest, java.lang.String encoding)
           
 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

HttpHelper

public HttpHelper()
Method Detail

postToUrl

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

postToUrl

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

postToUrl

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

getUrlContent

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

getUrlContent

public java.lang.String getUrlContent(java.lang.String urlAddress,
                                      java.util.Map requestParameters)
                               throws java.lang.Exception
Throws:
java.lang.Exception

getUrlContent

public java.lang.String getUrlContent(java.lang.String urlAddress,
                                      java.util.Map requestParameters,
                                      int timeout)
                               throws java.lang.Exception
Throws:
java.lang.Exception

getUrlContent

public java.lang.String getUrlContent(java.lang.String urlAddress,
                                      java.util.Map requestParameters,
                                      java.lang.String encoding,
                                      int timeout)
                               throws java.lang.Exception
Throws:
java.lang.Exception

getUrlContent

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

getUrlContent

public 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 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 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

getCookie

public java.lang.String getCookie(javax.servlet.http.HttpServletRequest request,
                                  java.lang.String cookieName)
This method gets a cookie.

Parameters:
cookieName -

requestToHashtable

public 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.