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 int
dataLength
private java.lang.String
host
private java.lang.String
ifModifiedSince
private java.io.InputStream
input
protected java.io.OutputStream
output
private static byte[]
RN
private static byte[]
RNRN
protected java.net.Socket
socket
private java.lang.Thread
thread
-
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.String
adminShutdown()
Stop the application and the server.private boolean
allow()
private boolean
checkHost(java.lang.String host)
private java.lang.String
getAllowedFile(java.lang.String requestedFile)
private static java.lang.String
getHeaderLineValue(java.lang.String line)
(package private) void
join(int millis)
Wait until the thread is stopped.private void
parseAttributes(java.lang.String s)
private void
parseBodyAttributes()
private boolean
parseHeader()
private boolean
process()
private java.lang.String
readHeaderLine()
void
run()
(package private) void
start()
Start the thread.(package private) void
stopNow()
Close the connection now.private void
trace(java.lang.String s)
private void
writeSimple(java.lang.String status, byte[] bytes)
private void
writeSimple(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:
run
in 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:WebApp
Stop the application and the server.- Overrides:
adminShutdown
in classWebApp
- Returns:
- the page to display
-
allow
private boolean allow()
-
trace
private void trace(java.lang.String s)
-
-