oracle.stellent.ridc.protocol.intradoc
Class HdaProtocol

java.lang.Object
  extended by oracle.stellent.ridc.protocol.intradoc.HdaProtocol
All Implemented Interfaces:
Protocol

public class HdaProtocol
extends java.lang.Object
implements Protocol


Field Summary
static java.lang.String BEGIN_HDA
           
static java.lang.String BEGIN_HDA_NO_HEADER
           
static java.lang.String CONTENT_LENGTH
           
static java.lang.String END_HDA
           
static java.lang.String END_HEADER_LINE
           
static java.lang.String END_HEADERS
           
static java.lang.String END_MESSAGE
           
static java.lang.String END_SERVER_HEADERS
           
static java.lang.String HEADER_LINE
           
static java.lang.String HTTP_HOST
           
static java.lang.String IDC_FILE
           
static int RETRY_COUNT
           
static java.lang.String USER_AGENT
           
 
Constructor Summary
HdaProtocol(DataFactory dataFactory, ServiceRequest<SocketConnection> serviceRequest)
           
 
Method Summary
protected  void appendHeaderParameter(java.lang.StringBuffer headerBuffer, java.lang.String name, java.lang.String value)
          Append a header parameter onto the given buffer of parameters
protected  java.util.Map<java.lang.String,java.lang.String> getAdditionalHeaders(DataBinder binder)
          Returns a properties object with headers contained in binder.
 DataFactory getDataFactory()
           
 java.lang.String getEncoding()
           
 java.lang.String getHeaderCharset()
           
protected  java.util.Map<java.lang.String,java.lang.String> getHeaders()
           
protected  java.lang.String getHeaderString(java.lang.String idcUser, boolean isMultiPart, long contentLength, java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
           
 java.io.BufferedInputStream getInputStream()
           
 java.io.BufferedOutputStream getOutputStream()
           
 ServiceRequest<SocketConnection> getServiceRequest()
           
 SocketConnection getSocketConnection()
           
protected  java.io.InputStream readHdaStream()
          Creates a stream to the next HDA message.
protected  boolean readHeaders()
          Read the headers (Http format) from the content server
 ServiceResponse readResponse()
          Reads the next message, if a message is not completely received within the timeout specified an exception is thrown.
 void setHeaderCharset(java.lang.String headerCharset)
           
protected  void writeMultipartRequest(java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
          Special handling for the multipart message
 void writeRequest()
          Sends the specified message to the Content Server.
protected  void writeStandardRequest(java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_AGENT

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

END_HEADERS

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

HEADER_LINE

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

END_SERVER_HEADERS

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

END_MESSAGE

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

END_HEADER_LINE

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

BEGIN_HDA

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

BEGIN_HDA_NO_HEADER

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

END_HDA

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

HTTP_HOST

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

RETRY_COUNT

public static final int RETRY_COUNT
See Also:
Constant Field Values

CONTENT_LENGTH

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

IDC_FILE

public static final java.lang.String IDC_FILE
See Also:
Constant Field Values
Constructor Detail

HdaProtocol

public HdaProtocol(DataFactory dataFactory,
                   ServiceRequest<SocketConnection> serviceRequest)
Method Detail

getDataFactory

public DataFactory getDataFactory()

getServiceRequest

public ServiceRequest<SocketConnection> getServiceRequest()

getSocketConnection

public SocketConnection getSocketConnection()

getInputStream

public java.io.BufferedInputStream getInputStream()
                                           throws java.io.IOException
Throws:
java.io.IOException

getOutputStream

public java.io.BufferedOutputStream getOutputStream()
                                             throws java.io.IOException
Throws:
java.io.IOException

getHeaderCharset

public java.lang.String getHeaderCharset()
Returns:
charset used to decode the header

setHeaderCharset

public void setHeaderCharset(java.lang.String headerCharset)

getEncoding

public java.lang.String getEncoding()
Returns:
the encoding to use for the message

writeRequest

public void writeRequest()
                  throws ProtocolException
Sends the specified message to the Content Server.

Specified by:
writeRequest in interface Protocol
Throws:
ProtocolException - If an error occurs during the send.

readResponse

public ServiceResponse readResponse()
                             throws ProtocolException
Reads the next message, if a message is not completely received within the timeout specified an exception is thrown.

Specified by:
readResponse in interface Protocol
Returns:
The received message.
Throws:
ProtocolException - If an error occurs or timeout is reached.

writeStandardRequest

protected void writeStandardRequest(java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
                             throws java.io.IOException
Parameters:
additionalHeaders -
Throws:
java.io.IOException
java.text.ParseException

writeMultipartRequest

protected void writeMultipartRequest(java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
                              throws java.io.IOException
Special handling for the multipart message

Parameters:
additionalHeaders - additional headers to send
Throws:
java.io.IOException
java.text.ParseException

getAdditionalHeaders

protected java.util.Map<java.lang.String,java.lang.String> getAdditionalHeaders(DataBinder binder)
Returns a properties object with headers contained in binder.

Parameters:
binder - The binder to look for additional headers.
Returns:
The created properties object.

getHeaderString

protected java.lang.String getHeaderString(java.lang.String idcUser,
                                           boolean isMultiPart,
                                           long contentLength,
                                           java.util.Map<java.lang.String,java.lang.String> additionalHeaders)

appendHeaderParameter

protected void appendHeaderParameter(java.lang.StringBuffer headerBuffer,
                                     java.lang.String name,
                                     java.lang.String value)
Append a header parameter onto the given buffer of parameters

Parameters:
headerBuffer -
name -
value -

readHeaders

protected boolean readHeaders()
                       throws java.io.IOException
Read the headers (Http format) from the content server

Returns:
true if successful, false otherwise
Throws:
java.io.IOException

readHdaStream

protected java.io.InputStream readHdaStream()
                                     throws java.io.IOException
Creates a stream to the next HDA message. If no content length is set, the stream is read into memory until the HDA message is closed.

Returns:
the message to consume via a stream
Throws:
java.io.IOException - If an error occurs or timeout is reached.

getHeaders

protected java.util.Map<java.lang.String,java.lang.String> getHeaders()


Copyright © 2008-2009 Oracle Corporation. All Rights Reserved.