de.grogra.http
Class Server
java.lang.Object
de.grogra.http.Server
- All Implemented Interfaces:
- java.lang.Runnable
- Direct Known Subclasses:
- HttpServer
public abstract class Server
- extends java.lang.Object
- implements java.lang.Runnable
Constructor Summary |
Server(java.net.ServerSocket socket,
java.util.logging.Logger logger,
java.util.logging.Level infoLevel,
java.util.logging.Level warningLevel)
|
Method Summary |
protected void |
accept(java.net.Socket client)
|
void |
close()
|
java.util.logging.Level |
getInfoLevel()
|
java.util.logging.Logger |
getLogger()
|
java.util.logging.Level |
getWarningLevel()
|
protected abstract boolean |
handleRequest(Request request,
java.net.Socket client)
|
boolean |
isClosed()
|
void |
run()
|
static void |
writeResponse(int code,
java.lang.String reason,
java.lang.String mimeType,
byte[] content,
boolean closeConnection,
java.io.OutputStream os)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CONTENT_LENGTH
public static final java.lang.String CONTENT_LENGTH
- See Also:
- Constant Field Values
CONTENT_TYPE
public static final java.lang.String CONTENT_TYPE
- See Also:
- Constant Field Values
CRLF
public static final java.lang.String CRLF
- See Also:
- Constant Field Values
Server
public Server(java.net.ServerSocket socket,
java.util.logging.Logger logger,
java.util.logging.Level infoLevel,
java.util.logging.Level warningLevel)
accept
protected void accept(java.net.Socket client)
close
public void close()
throws java.io.IOException
- Throws:
java.io.IOException
getInfoLevel
public java.util.logging.Level getInfoLevel()
getLogger
public java.util.logging.Logger getLogger()
getWarningLevel
public java.util.logging.Level getWarningLevel()
handleRequest
protected abstract boolean handleRequest(Request request,
java.net.Socket client)
throws java.io.IOException
- Throws:
java.io.IOException
isClosed
public boolean isClosed()
run
public void run()
- Specified by:
run
in interface java.lang.Runnable
writeResponse
public static void writeResponse(int code,
java.lang.String reason,
java.lang.String mimeType,
byte[] content,
boolean closeConnection,
java.io.OutputStream os)
throws java.io.IOException
- Throws:
java.io.IOException