From cee53b021632c95f1b4882664a31ca639a9b0700 Mon Sep 17 00:00:00 2001 From: Matt Windsor Date: Sun, 20 Mar 2011 16:38:51 +0000 Subject: Rewrite of server to use HttpCore example code; beginning of code reformat from GNU style to Java conventions. Code now includes Apache license code. --- doc/uk/org/ury/server/Server.html | 425 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 425 insertions(+) create mode 100644 doc/uk/org/ury/server/Server.html (limited to 'doc/uk/org/ury/server/Server.html') diff --git a/doc/uk/org/ury/server/Server.html b/doc/uk/org/ury/server/Server.html new file mode 100644 index 0000000..abb6497 --- /dev/null +++ b/doc/uk/org/ury/server/Server.html @@ -0,0 +1,425 @@ + + + + + + +Server + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +uk.org.ury.server +
+Class Server

+
+java.lang.Object
+  extended by uk.org.ury.server.Server
+
+
+
+
public class Server
extends java.lang.Object
+ + +

+The unified URY server, accepting requests over HTTP. +

+ +

+

+
Author:
+
Matt Windsor
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
Server() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voiddoConnection(java.net.Socket clientSocket) + +
+           
+ DatabaseDrivergetDatabaseConnection(UserClass userClass) + +
+          Get a database connection using the given user class.
+ java.lang.StringgetVersion() + +
+           
+ org.apache.http.HttpResponsehandleGet(java.util.List<java.lang.String> buffer) + +
+          Handle a HTTP GET request.
+static voidmain(java.lang.String[] args) + +
+          The main method, which serves to create a server.
+ java.util.Map<java.lang.String,java.lang.String>parseQueryString(java.lang.String query) + +
+          Parse a query string, populating a key-value map of the + URL-unescaped results.
+ voidprocessBuffer(java.util.List<java.lang.String> buffer, + java.io.PrintWriter out) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Server

+
+public Server()
+
+
+ + + + + + + + +
+Method Detail
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
The main method, which serves to create a server. +

+

+
Parameters:
args - The argument vector.
+
+
+
+ +

+doConnection

+
+public void doConnection(java.net.Socket clientSocket)
+                  throws java.io.IOException
+
+
+ +
Throws: +
java.io.IOException
+
+
+
+ +

+processBuffer

+
+public void processBuffer(java.util.List<java.lang.String> buffer,
+                          java.io.PrintWriter out)
+
+
+
+
+
+
+ +

+handleGet

+
+public org.apache.http.HttpResponse handleGet(java.util.List<java.lang.String> buffer)
+                                       throws HandlerNotFoundException,
+                                              HandlerSetupFailureException,
+                                              HandleFailureException,
+                                              BadRequestException,
+                                              NotAHandlerException
+
+
Handle a HTTP GET request. +

+

+
Parameters:
buffer - The HTTP request as a list of strings. +
Returns:
The HTTP response. +
Throws: +
HandlerNotFoundException - if the client requested + a request handler that could not be found on the + class path. +
HandlerSetupFailureException - if the handler was + found but could not be set up (eg does not + implement appropriate interface or cannot be + instantiated). +
HandleFailureException - if an appropriate handler + was contacted, but it failed to process the + request. +
BadRequestException - if the request was malformed + or invalid. +
NotAHandlerException - if the class requested to + handle the request is not a handler.
+
+
+
+ +

+parseQueryString

+
+public java.util.Map<java.lang.String,java.lang.String> parseQueryString(java.lang.String query)
+                                                                  throws java.io.UnsupportedEncodingException
+
+
Parse a query string, populating a key-value map of the + URL-unescaped results. +

+

+
Parameters:
query - The query string to parse. +
Returns:
A map associating parameter keys and values. +
Throws: +
java.io.UnsupportedEncodingException - if the URL decoder + fails.
+
+
+
+ +

+getDatabaseConnection

+
+public DatabaseDriver getDatabaseConnection(UserClass userClass)
+                                     throws MissingCredentialsException,
+                                            ConnectionFailureException
+
+
Get a database connection using the given user class. +

+

+
Parameters:
userClass - The user class to get a connection for. +
Returns:
a database connection, which may or may not + have been created on this call. +
Throws: +
MissingCredentialsException - if the credentials + for the given userclass are missing. +
ConnectionFailureException - if the connection + failed.
+
+
+
+ +

+getVersion

+
+public java.lang.String getVersion()
+
+
+ +
Returns:
the version string of the server.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + -- cgit v1.2.3