Class GoTournaments

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by GoTournaments
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class GoTournaments
extends javax.servlet.http.HttpServlet

See Also:
Serialized Form

Nested Class Summary
private  class GoTournaments.AdminException
          An exception thrown when the user isn't logged in but the request requires administrator privileges.
private  class GoTournaments.GoHttpRequest
          A class to provide a simple interface for the HttpServletRequest.
private  class GoTournaments.IncorrectPasswordException
          An exception thrown when an incorrect password is given.
 
Field Summary
private  java.lang.Exception init_exception
           
private  java.lang.String password
           
private static long serialVersionUID
          UID for serialization
private static int SESSION_TIME
           
 
Constructor Summary
GoTournaments()
           
 
Method Summary
 void init()
          Servlet initialization method, invoked right after construction.
private  GoResponse produceResponse(GoTournaments.GoHttpRequest req)
          Produces a response to a Go HTTP request.
private  GoResponse serveRequest(GoTournaments.GoHttpRequest http_request)
          Extracts and performs a request described by a GoHttpRequest object, produces a response and returns it.
protected  void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Dispatches all HTTP requests received by the system to the request handler and sends the response generated by the handler to the user.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
UID for serialization

See Also:
Constant Field Values

SESSION_TIME

private static final int SESSION_TIME
See Also:
Constant Field Values

init_exception

private transient java.lang.Exception init_exception

password

private transient java.lang.String password
Constructor Detail

GoTournaments

public GoTournaments()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Servlet initialization method, invoked right after construction. Sets up application root path and the administrator password as well as redirects the standard output stream to the system log file. If an exception occurs, it will be stored and displayed on each user request.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

serveRequest

private GoResponse serveRequest(GoTournaments.GoHttpRequest http_request)
                         throws java.lang.Exception
Extracts and performs a request described by a GoHttpRequest object, produces a response and returns it.

Throws:
GoException - if a normal use error occurs, should be caught and reported to the user.
GoTournaments.AdminException - if the request requires admin privileges and the user isn't logged in.
java.lang.Exception - in case of an internal system error, which should be treated as a bug.

produceResponse

private GoResponse produceResponse(GoTournaments.GoHttpRequest req)
Produces a response to a Go HTTP request. If a fatal exception was thrown during system initialization, the user request is ignored and an appropriate error message is returned. Otherwise the request is passed on to serverRequest(), which will perform the transactions and return the view requested. Exceptions thrown during the request handling are caught and a corresponding error page is returned.

Parameters:
req - Go HTTP request

service

protected void service(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse res)
                throws java.io.IOException
Dispatches all HTTP requests received by the system to the request handler and sends the response generated by the handler to the user. The response is either an HTML document or a redirection to a new request. If a general exception occurs during the request handling, an error page is sent to the user. An IOException, which prevents data from being sent to the user is propagated and will be handled by the environment.

Overrides:
service in class javax.servlet.http.HttpServlet
Parameters:
req - the HTTP request received from the user
res - the HTTP response sent back to the user
Throws:
java.io.IOException