edu.ucsb.nceas.morpho.framework
Class HttpMessage

java.lang.Object
  extended byedu.ucsb.nceas.morpho.framework.HttpMessage

public class HttpMessage
extends java.lang.Object

This class includes code to handle 'cookies' by looking at request and response headers. If the Sun url handlers are used, this code is used However, if the HttpClient class is used as the url handler, that class handles cookies internally and strips the information out of the headers before this class looks at them. This the cookie handler included here will never be called! DFH - October 2003


Constructor Summary
HttpMessage(java.net.URL servlet)
           
 
Method Summary
static java.lang.String getCookie()
          return the cookie that this message object contains
 java.io.InputStream sendGetMessage()
          Performs a GET request to the previously given servlet with no query string
 java.io.InputStream sendGetMessage(java.util.Properties args)
          Performs a GET request to the previously given servlet Builds a query string from the supplied Properties list.
 java.io.InputStream sendPostData(java.util.Properties args)
          Sends post data using url encoding.
 java.io.InputStream sendPostData(java.util.Properties args, java.util.Properties fileNames)
          Sends post data using multipart/form-data encoding.
 java.io.InputStream sendPostMessage()
          Performs a POST request with no query parameters
 java.io.InputStream sendPostMessage(java.util.Properties args)
          Deprecated. Replaced by #sendPostData(Properties args)
static void setCookie(java.lang.String newCookie)
          return the cookie that this message object contains
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpMessage

public HttpMessage(java.net.URL servlet)
Method Detail

sendGetMessage

public java.io.InputStream sendGetMessage()
                                   throws java.io.IOException
Performs a GET request to the previously given servlet with no query string

Throws:
java.io.IOException

sendGetMessage

public java.io.InputStream sendGetMessage(java.util.Properties args)
                                   throws java.io.IOException
Performs a GET request to the previously given servlet Builds a query string from the supplied Properties list.

Throws:
java.io.IOException

sendPostData

public java.io.InputStream sendPostData(java.util.Properties args,
                                        java.util.Properties fileNames)
                                 throws java.io.IOException
Sends post data using multipart/form-data encoding. This method can send large data files because the files are streamed directly from disk to the HttpURLConnection. Assuming that we are using the HTTClient or another similar library that provides a streaming HttpURLConnection, then the data is sent to the connection as it is read from disk (in contrast to the default Sun HttpURLConnection that reads the whole data stream into memory before sending it.

Parameters:
args - a property file containing the name-value pairs that are to be sent to the server
fileNames - a property file containing the name for a formfield that represents a file and the filename (as the property value)
Returns:
the response stream that comes from the server
Throws:
java.io.IOException - If any file operation fails.

sendPostData

public java.io.InputStream sendPostData(java.util.Properties args)
                                 throws java.io.IOException
Sends post data using url encoding. This method is used most of the time and is for typical paramameter lists where the data is not extensive.

Parameters:
args - a property file containing the name-value pairs that are to be sent to the server
Returns:
the response stream that comes from the server
Throws:
java.io.IOException - If any file operation fails.

sendPostMessage

public java.io.InputStream sendPostMessage()
                                    throws java.io.IOException
Performs a POST request with no query parameters

Throws:
java.io.IOException

sendPostMessage

public java.io.InputStream sendPostMessage(java.util.Properties args)
                                    throws java.io.IOException
Deprecated. Replaced by #sendPostData(Properties args)

Sends post data using url encoding. This method is used most of the time and is for typical paramameter lists where the data is not extensive.

Parameters:
args - a property file containing the name-value pairs that are to be sent to the server
Returns:
the response stream that comes from the server
Throws:
java.io.IOException - If any file operation fails.
See Also:
sendPostData(Properties args)

getCookie

public static java.lang.String getCookie()
return the cookie that this message object contains


setCookie

public static void setCookie(java.lang.String newCookie)
return the cookie that this message object contains



Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.