backend
Class ServerConnector

java.lang.Object
  extended by backend.ServerConnector

public class ServerConnector
extends java.lang.Object

Author:
John Van Enk

Constructor Summary
ServerConnector()
           
 
Method Summary
 java.io.InputStreamReader queryServer(java.lang.String data)
          This method is a wrapper method for sendQueryPost.
 java.io.InputStreamReader sendQueryPost(java.lang.String url, java.lang.String data)
          Sends a query to the server.
 java.io.InputStreamReader simpleQuery(java.lang.String query)
          This is a simplified version of the other query functions in this class which serves to make the query process easier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerConnector

public ServerConnector()
Method Detail

queryServer

public java.io.InputStreamReader queryServer(java.lang.String data)
This method is a wrapper method for sendQueryPost. It does the job of specifying the url provided in this class and passing the correct data to the wrapped method. This returns any information returned by sendQueryPost.

Parameters:
data - -- The data to send to the server.
Returns:
Null if error. InputStreamReader if it worked.

sendQueryPost

public java.io.InputStreamReader sendQueryPost(java.lang.String url,
                                               java.lang.String data)
                                        throws java.io.IOException
Sends a query to the server. The only information which needs to be passed to the data segment of this method is the information contained in the query, not the query variable. This returns any information generated by the server after the query is complete.

Parameters:
url - -- The URL of the script to query.
data - -- The data to send to the server.
Returns:
An InputStreamReader for use in the KXMLParser.
Throws:
java.io.IOException

simpleQuery

public java.io.InputStreamReader simpleQuery(java.lang.String query)
This is a simplified version of the other query functions in this class which serves to make the query process easier. It takes care of one try/catch block that I HATE implementing code.

Parameters:
query - -- The data to send to the server.
Returns:
InputStreamReader if it worked out. Null if error.