com.sapportals.portal.pb.contentservice
Interface IHTTPRequest


public interface IHTTPRequest

provides a simple interface to open a connection and request some content from a server


Method Summary
 void closeConnection()
          Close the connection to the server.
 java.io.InputStream getInputStreamResponse()
          Get the response as an InputStream object.
 java.util.LinkedList getResponseCookies()
          Get the list of response cookies the remote server has sent
 java.lang.String getResponseHeader(java.lang.String name)
          Get a specific response header by name.
 java.util.Hashtable getResponseHeaders()
          Get the collection of response headers set by the remote server
 int getStatusCode()
          Get the response statuse code based on the HTTP RFC (200 - OK and so on)
 java.lang.String getTextResponseBody()
          Get the HTML response as a String object.
 int OpenConnection()
          Opens a connection according to the properties the object was initialized with.
 

Method Detail

OpenConnection

public int OpenConnection()
                   throws java.io.IOException,
                          java.lang.NullPointerException
Opens a connection according to the properties the object was initialized with. This method opens the connection and sends the request.
Returns:
int value of the status of the response: 200 - OK and so on. -1 is returned if the connection failed.

closeConnection

public void closeConnection()
Close the connection to the server. Use to clean up memory usage.

getStatusCode

public int getStatusCode()
                  throws java.io.IOException,
                         com.sapportals.portal.ivs.http.HttpClientException
Get the response statuse code based on the HTTP RFC (200 - OK and so on)
Returns:
int value of the status of the response, according to the HTTP spec

getTextResponseBody

public java.lang.String getTextResponseBody()
                                     throws java.io.IOException
Get the HTML response as a String object. The string was initialized in the same encoding of the response.
Returns:
String representation of the response body.

getInputStreamResponse

public java.io.InputStream getInputStreamResponse()
                                           throws com.sapportals.portal.ivs.http.HttpClientException,
                                                  java.io.IOException
Get the response as an InputStream object. Use this method to read the response directly from the stream, or if the response is of a binary type.
Returns:
InputStream representation of the response body

getResponseCookies

public java.util.LinkedList getResponseCookies()
                                        throws com.sapportals.portal.ivs.http.HttpClientException,
                                               java.io.IOException
Get the list of response cookies the remote server has sent
Returns:
LinkedList of all of the cookies in the response

getResponseHeaders

public java.util.Hashtable getResponseHeaders()
                                       throws com.sapportals.portal.ivs.http.HttpClientException,
                                              java.io.IOException
Get the collection of response headers set by the remote server
Returns:
Hashtable representation of the response headers

getResponseHeader

public java.lang.String getResponseHeader(java.lang.String name)
                                   throws com.sapportals.portal.ivs.http.HttpClientException,
                                          java.io.IOException
Get a specific response header by name.
Parameters:
name - header name to get
Returns:
String value of the response header with that name