com.sun.jini.jeri.internal.http
Class Request

java.lang.Object
  extended by com.sun.jini.jeri.internal.http.Request
Direct Known Subclasses:
HttpClientConnection.OutboundRequestImpl, HttpServerConnection.InboundRequestImpl

abstract class Request
extends Object

Superclass for OutboundRequest, InboundRequest implementation classes.

Author:
Sun Microsystems, Inc.

Nested Class Summary
private  class Request.ContentInputStream
          Stream for reading inbound request/response data.
private  class Request.ContentOutputStream
          Stream for writing outbound request/response data.
 
Field Summary
private  boolean aborted
           
private static int CLOSED
           
private static int EOF
           
private  Request.ContentInputStream in
           
private  IOException inException
           
private  Object inLock
           
private  int inState
           
private static int INVALID
           
private static int OPEN
           
private  Request.ContentOutputStream out
           
private  IOException outException
           
private  Object outLock
           
private  int outState
           
private  Object stateLock
           
private static Executor systemThreadPool
           
private static int UNUSED
           
 
Constructor Summary
Request()
          Creates new Request, initializes content input/output streams.
 
Method Summary
 void abort()
          Terminates request.
(package private) abstract  void addAckListener(AcknowledgmentSource.Listener listener)
          Method called internally to register acknowledgment listener.
(package private)  boolean addAcknowledgmentListener(AcknowledgmentSource.Listener l)
          Method called internally to implement AcknowledgmentSource; checks state and delegates to addAckListener method.
(package private) abstract  int available()
          Method called internally to gauge available inbound data.
(package private) abstract  void done(boolean corrupt)
          Method called internally when request is finished.
(package private) abstract  void endInput()
          Method called internally when finished reading inbound data.
(package private) abstract  void endOutput()
          Method called internally to signal the end of outbound data.
(package private)  void finish()
          Finishes request, if not finished or aborted already.
 boolean getDeliveryStatus()
          Returns true if any data sent.
(package private)  InputStream getInputStream()
          Returns InputStream used for reading inbound request/response data.
(package private)  OutputStream getOutputStream()
          Returns OutputStream used for writing outbound request/response data.
(package private) abstract  int read(byte[] b, int off, int len)
          Method called internally to read inbound request/response data.
(package private) abstract  boolean startInput()
          Method called internally before any inbound data is read.
(package private) abstract  void startOutput()
          Method called internally before any outbound data is written.
(package private) abstract  void write(byte[] b, int off, int len)
          Method called internally to write outbound request/response data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemThreadPool

private static final Executor systemThreadPool

UNUSED

private static final int UNUSED
See Also:
Constant Field Values

OPEN

private static final int OPEN
See Also:
Constant Field Values

EOF

private static final int EOF
See Also:
Constant Field Values

CLOSED

private static final int CLOSED
See Also:
Constant Field Values

INVALID

private static final int INVALID
See Also:
Constant Field Values

stateLock

private final Object stateLock

outLock

private final Object outLock

inLock

private final Object inLock

out

private final Request.ContentOutputStream out

in

private final Request.ContentInputStream in

aborted

private boolean aborted

outState

private int outState

inState

private int inState

outException

private IOException outException

inException

private IOException inException
Constructor Detail

Request

Request()
Creates new Request, initializes content input/output streams.

Method Detail

getDeliveryStatus

public boolean getDeliveryStatus()
Returns true if any data sent.


abort

public void abort()
Terminates request.


finish

void finish()
Finishes request, if not finished or aborted already. Returns once request is finished.


getOutputStream

OutputStream getOutputStream()
Returns OutputStream used for writing outbound request/response data.


getInputStream

InputStream getInputStream()
Returns InputStream used for reading inbound request/response data.


startOutput

abstract void startOutput()
                   throws IOException
Method called internally before any outbound data is written.

Throws:
IOException

write

abstract void write(byte[] b,
                    int off,
                    int len)
             throws IOException
Method called internally to write outbound request/response data.

Throws:
IOException

endOutput

abstract void endOutput()
                 throws IOException
Method called internally to signal the end of outbound data.

Throws:
IOException

startInput

abstract boolean startInput()
                     throws IOException
Method called internally before any inbound data is read. Returns true if inbound data is valid, false otherwise (e.g., error message content).

Throws:
IOException

read

abstract int read(byte[] b,
                  int off,
                  int len)
           throws IOException
Method called internally to read inbound request/response data.

Throws:
IOException

available

abstract int available()
                throws IOException
Method called internally to gauge available inbound data.

Throws:
IOException

endInput

abstract void endInput()
                throws IOException
Method called internally when finished reading inbound data.

Throws:
IOException

addAckListener

abstract void addAckListener(AcknowledgmentSource.Listener listener)
Method called internally to register acknowledgment listener.


done

abstract void done(boolean corrupt)
Method called internally when request is finished. If corrupt is true, the underlying transport channel has been left in an unknown state.


addAcknowledgmentListener

final boolean addAcknowledgmentListener(AcknowledgmentSource.Listener l)
Method called internally to implement AcknowledgmentSource; checks state and delegates to addAckListener method.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.