org.problets.lib.comm
Class HttpCommunicator

java.lang.Object
  extended by org.problets.lib.comm.HttpCommunicator
Direct Known Subclasses:
UPittCommunicator

public class HttpCommunicator
extends java.lang.Object

Communicates using http protocol

Author:
Amruth Kumar, adapted from com.oreilly.servlet package written by Jason Hunter

Constructor Summary
HttpCommunicator(java.lang.String inBaseUrlString)
           
HttpCommunicator(java.net.URL inBaseUrl)
           
 
Method Summary
 void disable()
          Disable the communicator so that it does not update the server
 void enable()
          Enable the communicator so that it does update the server
 java.io.BufferedReader get(java.lang.String learnObj, boolean result)
          Uses get() method to send data to the UM server - to be implemented by all inheriting classes
static void main(java.lang.String[] args)
           
 java.io.BufferedReader post(java.lang.String learnObj, boolean result)
          Uses post() method to send data to the UM server - to be implemented by all inheriting classes
 java.io.InputStream sendGetMessage()
          Issues a GET request with no query string.
 java.io.InputStream sendGetMessage(java.util.Properties args)
          Issues a GET request with query string.
 java.io.InputStream sendPostMessage()
          Issues a POST request with no query string
 java.io.InputStream sendPostMessage(java.util.Properties args)
          Issues a POST request.
 java.io.InputStream sendPostMessage(java.io.Serializable obj)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpCommunicator

public HttpCommunicator(java.lang.String inBaseUrlString)

HttpCommunicator

public HttpCommunicator(java.net.URL inBaseUrl)
Method Detail

sendGetMessage

public java.io.InputStream sendGetMessage()
                                   throws java.io.IOException
Issues a GET request with no query string.

Throws:
java.io.IOException

sendGetMessage

public java.io.InputStream sendGetMessage(java.util.Properties args)
                                   throws java.io.IOException
Issues a GET request with query string. Builds a query string from the supplied Properties list.

Throws:
java.io.IOException

sendPostMessage

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

Throws:
java.io.IOException

sendPostMessage

public java.io.InputStream sendPostMessage(java.util.Properties args)
                                    throws java.io.IOException
Issues a POST request. Builds post data from the supplied Properties list.

Throws:
java.io.IOException

sendPostMessage

public java.io.InputStream sendPostMessage(java.io.Serializable obj)
                                    throws java.io.IOException
Throws:
java.io.IOException

disable

public void disable()
Disable the communicator so that it does not update the server


enable

public void enable()
Enable the communicator so that it does update the server


get

public java.io.BufferedReader get(java.lang.String learnObj,
                                  boolean result)
Uses get() method to send data to the UM server - to be implemented by all inheriting classes


post

public java.io.BufferedReader post(java.lang.String learnObj,
                                   boolean result)
Uses post() method to send data to the UM server - to be implemented by all inheriting classes


main

public static void main(java.lang.String[] args)