electric.util.mime
Class MIMEHeaders

java.lang.Object
  extended byelectric.util.mime.MIMEHeaders
All Implemented Interfaces:
IHTTPConstants

public final class MIMEHeaders
extends java.lang.Object
implements IHTTPConstants

MIMEHeaders.

Author:
webMethods

Field Summary
 java.lang.String[][] headers
           
 
Fields inherited from interface electric.util.http.IHTTPConstants
ACCEPT_LANGUAGE, ACCEPT_RANGES, APPLICATION_BINARY, APPLICATION_OCTET_STREAM, ASCII, AUTHORIZATION, BASIC, BOUNDARY, CHARSET_EQUALS, CHUNKED, CLOSE, COLON_SLASH_SLASH, CONNECT, CONNECTION, CONTENT_ID, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, CONTINUATION_STATUS, CONTINUE_EXPECTATION, COOKIE, COOKIE_LISTENER, DATE, DEFAULT_CONTENT_TYPE, DEFAULT_HTTP_CHARSET, DEFAULT_HTTPS_PORT, DEFAULT_MIME_TYPE, DEFAULT_PROXY_PORT, DIGEST, EOL, EXPECT, EXPECT_HEADER, FORM_URLENCODED, GET, GLUE_SESSION, HEAD, HOST, HTTP_1_0, HTTP_1_1, HTTP_PROTOCOL, HTTPS_PROTOCOL, IF_MODIFIED_SINCE, KEEP_ALIVE, LAST_MODIFIED, LOCATION, MD5_HASH, MIME_BOUNDARY, MIME_VERSION, MULTIPART_CONTENT_TYPE, OK, POST, PROXY_AUTHORIZATION, RANGE, SC_CONTINUE, SC_MOVED, SC_MOVED_PERMANENTLY, SC_OK, SC_PROXY_AUTHENTICATION_REQUIRED, SC_UNAUTHORIZED, SEPARATOR, SERVER, SERVER_PREFIX, SERVER_TYPE, SET_COOKIE_0, SET_COOKIE_1, SLASH, START, TEXT_HTML, TEXT_PLAIN, TEXT_XML, TEXT_XML_UTF_8, TRANSFER_ENCODING, USER_AGENT, WWW_AUTHENTICATE
 
Constructor Summary
MIMEHeaders()
           
 
Method Summary
 void addDateHeader(java.lang.String name, long date)
          Add a header with the specified name and date.
 void addHeader(java.lang.String name, java.lang.String value)
          Add a header with the specified name and value.
 void addHeaders(MIMEHeaders mimeHeaders)
           
 void addIntHeader(java.lang.String name, int value)
          Add a header with the specified name and value.
 void clearHeaders()
           
 boolean containsHeader(java.lang.String name)
          Return true if there is at least one header with the specified name.
 int getContentLength()
          Return my content length, or -1 if none is defined.
 java.lang.String getContentType()
          Return my content type, or null if none is defined.
 long getDateHeader(java.lang.String name)
          Return the value of the header with the specified name, or -1 if none is defined.
 java.lang.String getHeader(java.lang.String name)
          Return the header with the specified name.
 java.util.Enumeration getHeaderNames()
          Return an enumeration over all the header names.
 java.util.Enumeration getHeaders(java.lang.String name)
          Return an enumeration over all the headers with the specified name.
 int getIntHeader(java.lang.String name)
          Return the value of the header with the specified name, or -1 if none is defined.
 void readHeaders(java.io.InputStream inputStream)
          Parse the http headers and return a hashtable mapping header names to the assigned values.
 java.lang.String removeHeader(java.lang.String name)
           
 void removeHeaders(java.lang.String name)
           
 void setContentLength(int length)
          Set my content length.
 void setContentType(java.lang.String type)
          Set my context type.
 void setDateHeader(java.lang.String name, long date)
          Set a header with the specified name and date.
 void setHeader(java.lang.String name, java.lang.String value)
          Set a header with the specified name and value.
 void setIntHeader(java.lang.String name, int value)
          Set a header with the specified name and value.
 java.lang.String toString()
           
 void writeHeaders(java.io.OutputStream output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

headers

public java.lang.String[][] headers
Constructor Detail

MIMEHeaders

public MIMEHeaders()
Method Detail

toString

public java.lang.String toString()

readHeaders

public void readHeaders(java.io.InputStream inputStream)
                 throws java.io.IOException
Parse the http headers and return a hashtable mapping header names to the assigned values.

Parameters:
inputStream -
Throws:
java.io.IOException

writeHeaders

public void writeHeaders(java.io.OutputStream output)
                  throws java.io.IOException
Parameters:
output -
Throws:
java.io.IOException

clearHeaders

public void clearHeaders()

getHeader

public java.lang.String getHeader(java.lang.String name)
Return the header with the specified name. If there is more than one header with this name, return the first one.

Parameters:
name - The name.

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Return an enumeration over all the headers with the specified name.

Parameters:
name - The name.

containsHeader

public boolean containsHeader(java.lang.String name)
Return true if there is at least one header with the specified name.

Parameters:
name - The name.

getHeaderNames

public java.util.Enumeration getHeaderNames()
Return an enumeration over all the header names.


setHeader

public void setHeader(java.lang.String name,
                      java.lang.String value)
Set a header with the specified name and value. If at least one header already exists with the name, replace the value of the first matching header, otherwise add a new header.

Parameters:
name - The name.
value - The value.

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Add a header with the specified name and value.

Parameters:
name - The name.
value - The value.

addHeaders

public void addHeaders(MIMEHeaders mimeHeaders)
Parameters:
mimeHeaders -

removeHeader

public java.lang.String removeHeader(java.lang.String name)
Parameters:
name -

removeHeaders

public void removeHeaders(java.lang.String name)
Parameters:
name -

getIntHeader

public int getIntHeader(java.lang.String name)
Return the value of the header with the specified name, or -1 if none is defined.

Parameters:
name - The name.

setIntHeader

public void setIntHeader(java.lang.String name,
                         int value)
Set a header with the specified name and value. If at least one header already exists with the name, replace the value of the first matching header, otherwise add a new header.

Parameters:
name - The name.
value - The value.

addIntHeader

public void addIntHeader(java.lang.String name,
                         int value)
Add a header with the specified name and value.

Parameters:
name - The name.
value - The value.

getContentLength

public int getContentLength()
Return my content length, or -1 if none is defined.


setContentLength

public void setContentLength(int length)
Set my content length.

Parameters:
length - The new value.

getContentType

public java.lang.String getContentType()
Return my content type, or null if none is defined.


setContentType

public void setContentType(java.lang.String type)
Set my context type.

Parameters:
type - The new value.

getDateHeader

public long getDateHeader(java.lang.String name)
Return the value of the header with the specified name, or -1 if none is defined.

Parameters:
name - The name.

setDateHeader

public void setDateHeader(java.lang.String name,
                          long date)
Set a header with the specified name and date. If at least one header already exists with the name, replace the date of the first matching header, otherwise add a new header.

Parameters:
name - The name.
date - The date.

addDateHeader

public void addDateHeader(java.lang.String name,
                          long date)
Add a header with the specified name and date.

Parameters:
name - The name.
date - The date.


copyright© 2001-2004 by webMethods All Rights Reserved.