org.globus.wsrf.container
Class ServiceThread

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.globus.wsrf.container.ServiceThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
GSIServiceThread

public class ServiceThread
extends java.lang.Thread

This class is responsible for reading the request from the request queue, format it, and pass it through the Axis engine.


Field Summary
private static byte[] ACTION_HEADER
           
private  java.lang.String baseURL
           
private  byte[] buf
           
private static int BUFSIZ
           
private  boolean chunked
           
private static byte[] CHUNKED
           
private static byte[] CONNECTION_CLOSE
           
protected static byte[] CONTENT_LENGTH
           
protected static java.lang.String CONTENT_TYPE
           
private  ServiceDispatcher dispatcher
           
private static byte[] ENCODING_HEADER
           
private  org.apache.axis.AxisEngine engine
           
private static java.lang.String FILE_NOT_FOUND
           
private static byte[] FILE_NOT_FOUND_MSG
           
private  java.lang.StringBuffer fileName
           
private static byte[] GET_HEADER
           
private static byte[] HEAD_HEADER
           
private static byte[] HEADER_ENDER
           
protected static byte[] HTML_MIME_STUFF
           
protected static byte[] HTTP_10
           
protected static byte[] HTTP_11
           
private static byte[] HTTP_BASE_VERSION
           
private static int HTTP_GET
           
private static int HTTP_HEAD
           
private static int HTTP_POST
           
protected  boolean http11
           
private  int httpRequest
           
private static org.globus.util.I18n i18n
           
private  org.apache.axis.transport.http.NonBlockingBufferedInputStream is
           
private static byte[] ISE
           
protected static byte[] JAR_MIME_STUFF
           
protected static byte[] JNLP_MIME_STUFF
           
private static byte[] LENGTH_HEADER
           
private static org.apache.commons.logging.Log logger
           
protected  org.apache.axis.MessageContext msgContext
           
private static byte[] OK
           
(package private) static PerformanceLog performanceLogger
           
(package private) static PerformanceLog performanceProcessLogger
           
private static byte[] POST_HEADER
           
private  ServiceRequestQueue queue
           
private  org.apache.axis.Message responseMsg
           
static java.lang.String SEND_CONTENT_LENGTH
           
private  boolean sendContentLength
           
protected static byte[] SEPARATOR
           
private  java.lang.StringBuffer soapAction
           
private  ServiceThreadPool threadPool
           
private static byte[] toLower
           
private static byte[] TRANSFER_ENCODING_CHUNKED
           
protected static byte[] UNAUTH
           
private  boolean webStartEnabled
           
protected static byte[] XML_MIME_STUFF
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServiceThread(ServiceDispatcher dispatcher)
           
 
Method Summary
private  byte[] createHeaderReply(byte[] code, byte[] contentType, long length)
           
protected  byte[] doFault(java.lang.Exception e, org.apache.axis.MessageContext msgContext, java.lang.String filepart)
           
protected  void doGet(org.apache.axis.AxisEngine engine, org.apache.axis.MessageContext msgContext, java.io.OutputStream out, java.lang.String filePart, boolean returnContent)
           
protected  void doGetSub(org.apache.axis.AxisEngine engine, org.apache.axis.MessageContext msgContext, java.io.OutputStream out, java.lang.String filePart, boolean returnContent)
           
protected  void doPost(org.apache.axis.AxisEngine engine, org.apache.axis.MessageContext msgContext)
           
protected  void doWSDL(org.apache.axis.AxisEngine engine, org.apache.axis.MessageContext msgContext, java.io.OutputStream out, java.lang.String filePart)
           
static java.lang.String getConfigRootPath(org.apache.axis.AxisEngine engine)
           
private static java.lang.String getHost(org.apache.axis.AxisEngine engine)
           
protected  java.lang.String getProtocol()
           
static java.lang.String getWebRootPath(org.apache.axis.AxisEngine engine)
           
private  void handleOutOfMemoryError()
           
 boolean matches(byte[] buf, byte[] target)
          does tolower[buf] match the target byte array, up to the target's length?
 boolean matches(byte[] buf, int bufIdx, byte[] target)
          Case-insensitive match of a target byte [] to a source byte [], starting from a particular offset into the source.
private  int parseHeaders(java.io.InputStream is, java.lang.StringBuffer soapAction, java.lang.StringBuffer fileName)
          Read all mime headers, returning the value of Content-Length and SOAPAction.
private  void parseRequest(java.lang.StringBuffer fileName, byte[] buf, int n, int offset)
           
protected  void process(ServiceRequest request)
           
private  int readLine(java.io.InputStream is, byte[] b, int off, int len)
          Read a single line from the input stream
private  void reset()
           
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static org.apache.commons.logging.Log logger

i18n

private static org.globus.util.I18n i18n

dispatcher

private ServiceDispatcher dispatcher

queue

private ServiceRequestQueue queue

threadPool

private ServiceThreadPool threadPool

engine

private org.apache.axis.AxisEngine engine

msgContext

protected org.apache.axis.MessageContext msgContext

is

private org.apache.axis.transport.http.NonBlockingBufferedInputStream is

responseMsg

private org.apache.axis.Message responseMsg

soapAction

private java.lang.StringBuffer soapAction

fileName

private java.lang.StringBuffer fileName

httpRequest

private int httpRequest

sendContentLength

private boolean sendContentLength

http11

protected boolean http11

chunked

private boolean chunked

performanceLogger

static PerformanceLog performanceLogger

performanceProcessLogger

static PerformanceLog performanceProcessLogger

SEND_CONTENT_LENGTH

public static final java.lang.String SEND_CONTENT_LENGTH
See Also:
Constant Field Values

HTTP_10

protected static final byte[] HTTP_10

HTTP_11

protected static final byte[] HTTP_11

OK

private static final byte[] OK

UNAUTH

protected static final byte[] UNAUTH

ISE

private static final byte[] ISE

FILE_NOT_FOUND

private static final java.lang.String FILE_NOT_FOUND
See Also:
Constant Field Values

FILE_NOT_FOUND_MSG

private static final byte[] FILE_NOT_FOUND_MSG

XML_MIME_STUFF

protected static final byte[] XML_MIME_STUFF

HTML_MIME_STUFF

protected static final byte[] HTML_MIME_STUFF

JNLP_MIME_STUFF

protected static final byte[] JNLP_MIME_STUFF

JAR_MIME_STUFF

protected static final byte[] JAR_MIME_STUFF

CONTENT_TYPE

protected static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

CONTENT_LENGTH

protected static final byte[] CONTENT_LENGTH

CONNECTION_CLOSE

private static final byte[] CONNECTION_CLOSE

TRANSFER_ENCODING_CHUNKED

private static final byte[] TRANSFER_ENCODING_CHUNKED

SEPARATOR

protected static final byte[] SEPARATOR

toLower

private static final byte[] toLower

LENGTH_HEADER

private static final byte[] LENGTH_HEADER

ACTION_HEADER

private static final byte[] ACTION_HEADER

GET_HEADER

private static final byte[] GET_HEADER

HEAD_HEADER

private static final byte[] HEAD_HEADER

POST_HEADER

private static final byte[] POST_HEADER

HEADER_ENDER

private static final byte[] HEADER_ENDER

ENCODING_HEADER

private static final byte[] ENCODING_HEADER

CHUNKED

private static final byte[] CHUNKED

HTTP_BASE_VERSION

private static final byte[] HTTP_BASE_VERSION

HTTP_GET

private static final int HTTP_GET
See Also:
Constant Field Values

HTTP_HEAD

private static final int HTTP_HEAD
See Also:
Constant Field Values

HTTP_POST

private static final int HTTP_POST
See Also:
Constant Field Values

BUFSIZ

private static final int BUFSIZ
See Also:
Constant Field Values

buf

private byte[] buf

webStartEnabled

private boolean webStartEnabled

baseURL

private java.lang.String baseURL
Constructor Detail

ServiceThread

public ServiceThread(ServiceDispatcher dispatcher)
Method Detail

getHost

private static java.lang.String getHost(org.apache.axis.AxisEngine engine)
                                 throws java.io.IOException
Throws:
java.io.IOException

getWebRootPath

public static java.lang.String getWebRootPath(org.apache.axis.AxisEngine engine)
                                       throws java.io.IOException
Throws:
java.io.IOException

getConfigRootPath

public static java.lang.String getConfigRootPath(org.apache.axis.AxisEngine engine)

reset

private void reset()

handleOutOfMemoryError

private void handleOutOfMemoryError()

run

public void run()

getProtocol

protected java.lang.String getProtocol()

process

protected void process(ServiceRequest request)

createHeaderReply

private byte[] createHeaderReply(byte[] code,
                                 byte[] contentType,
                                 long length)
                          throws java.io.IOException
Throws:
java.io.IOException

doWSDL

protected void doWSDL(org.apache.axis.AxisEngine engine,
                      org.apache.axis.MessageContext msgContext,
                      java.io.OutputStream out,
                      java.lang.String filePart)
               throws java.io.IOException
Throws:
java.io.IOException

doGet

protected void doGet(org.apache.axis.AxisEngine engine,
                     org.apache.axis.MessageContext msgContext,
                     java.io.OutputStream out,
                     java.lang.String filePart,
                     boolean returnContent)

doGetSub

protected void doGetSub(org.apache.axis.AxisEngine engine,
                        org.apache.axis.MessageContext msgContext,
                        java.io.OutputStream out,
                        java.lang.String filePart,
                        boolean returnContent)
                 throws java.io.IOException
Throws:
java.io.IOException

doPost

protected void doPost(org.apache.axis.AxisEngine engine,
                      org.apache.axis.MessageContext msgContext)
               throws org.apache.axis.AxisFault
Throws:
org.apache.axis.AxisFault

doFault

protected byte[] doFault(java.lang.Exception e,
                         org.apache.axis.MessageContext msgContext,
                         java.lang.String filepart)

readLine

private int readLine(java.io.InputStream is,
                     byte[] b,
                     int off,
                     int len)
              throws java.io.IOException
Read a single line from the input stream

Parameters:
is - inputstream to read from
b - byte array to read into
off - starting offset into the byte array
len - maximum number of bytes to read
Throws:
java.io.IOException

parseRequest

private void parseRequest(java.lang.StringBuffer fileName,
                          byte[] buf,
                          int n,
                          int offset)
                   throws java.io.IOException
Throws:
java.io.IOException

parseHeaders

private int parseHeaders(java.io.InputStream is,
                         java.lang.StringBuffer soapAction,
                         java.lang.StringBuffer fileName)
                  throws java.io.IOException
Read all mime headers, returning the value of Content-Length and SOAPAction.

Parameters:
is - InputStream to read from
soapAction - StringBuffer to return the soapAction into
Returns:
Content-Length
Throws:
java.io.IOException

matches

public boolean matches(byte[] buf,
                       byte[] target)
does tolower[buf] match the target byte array, up to the target's length?


matches

public boolean matches(byte[] buf,
                       int bufIdx,
                       byte[] target)
Case-insensitive match of a target byte [] to a source byte [], starting from a particular offset into the source.