Package org.h2.server.web
Class WebThread
- java.lang.Object
-
- org.h2.server.web.WebApp
-
- org.h2.server.web.WebThread
-
- All Implemented Interfaces:
java.lang.Runnable
class WebThread extends WebApp implements java.lang.Runnable
For each connection to a session, an object of this class is created. This class is used by the H2 Console.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.h2.server.web.WebApp
WebApp.IndexInfo
-
-
Field Summary
Fields Modifier and Type Field Description private intdataLengthprivate java.lang.Stringhostprivate java.lang.StringifModifiedSinceprivate java.io.InputStreaminputprotected java.io.OutputStreamoutputprivate static byte[]RNprivate static byte[]RNRNprotected java.net.Socketsocketprivate java.lang.Threadthread-
Fields inherited from class org.h2.server.web.WebApp
attributes, cache, headerLanguage, mimeType, server, session, stop
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringadminShutdown()Stop the application and the server.private booleanallow()private booleancheckHost(java.lang.String host)private java.lang.StringgetAllowedFile(java.lang.String requestedFile)private static java.lang.StringgetHeaderLineValue(java.lang.String line)(package private) voidjoin(int millis)Wait until the thread is stopped.private voidparseAttributes(java.lang.String s)private voidparseBodyAttributes()private booleanparseHeader()private booleanprocess()private java.lang.StringreadHeaderLine()voidrun()(package private) voidstart()Start the thread.(package private) voidstopNow()Close the connection now.private voidtrace(java.lang.String s)private voidwriteSimple(java.lang.String status, byte[] bytes)private voidwriteSimple(java.lang.String status, java.lang.String text)-
Methods inherited from class org.h2.server.web.WebApp
getCache, getMimeType, getSession, processRequest, query, setSession
-
-
-
-
Field Detail
-
RN
private static final byte[] RN
-
RNRN
private static final byte[] RNRN
-
output
protected java.io.OutputStream output
-
socket
protected final java.net.Socket socket
-
thread
private final java.lang.Thread thread
-
input
private java.io.InputStream input
-
host
private java.lang.String host
-
dataLength
private int dataLength
-
ifModifiedSince
private java.lang.String ifModifiedSince
-
-
Constructor Detail
-
WebThread
WebThread(java.net.Socket socket, WebServer server)
-
-
Method Detail
-
start
void start()
Start the thread.
-
join
void join(int millis) throws java.lang.InterruptedException
Wait until the thread is stopped.- Parameters:
millis- the maximum number of milliseconds to wait- Throws:
java.lang.InterruptedException- if interrupted
-
stopNow
void stopNow()
Close the connection now.
-
getAllowedFile
private java.lang.String getAllowedFile(java.lang.String requestedFile)
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
process
private boolean process() throws java.io.IOException- Throws:
java.io.IOException
-
writeSimple
private void writeSimple(java.lang.String status, java.lang.String text) throws java.io.IOException- Throws:
java.io.IOException
-
writeSimple
private void writeSimple(java.lang.String status, byte[] bytes) throws java.io.IOException- Throws:
java.io.IOException
-
checkHost
private boolean checkHost(java.lang.String host) throws java.io.IOException- Throws:
java.io.IOException
-
readHeaderLine
private java.lang.String readHeaderLine() throws java.io.IOException- Throws:
java.io.IOException
-
parseBodyAttributes
private void parseBodyAttributes() throws java.io.IOException- Throws:
java.io.IOException
-
parseAttributes
private void parseAttributes(java.lang.String s)
-
parseHeader
private boolean parseHeader() throws java.io.IOException- Throws:
java.io.IOException
-
getHeaderLineValue
private static java.lang.String getHeaderLineValue(java.lang.String line)
-
adminShutdown
protected java.lang.String adminShutdown()
Description copied from class:WebAppStop the application and the server.- Overrides:
adminShutdownin classWebApp- Returns:
- the page to display
-
allow
private boolean allow()
-
trace
private void trace(java.lang.String s)
-
-