Websphere MQ Everyplace

com.ibm.mqe.adapters
Class MQeMidpHttpAdapter

java.lang.Object
  |
  +--com.ibm.mqe.adapters.MQeCommunicationsAdapter
        |
        +--com.ibm.mqe.adapters.MQeMidpHttpAdapter

public class MQeMidpHttpAdapter
extends MQeCommunicationsAdapter

MQeMidpHttpAdapter extends the MQeAdapter to provide communication support for the HTTP 1.1 protocol.

The adapter provides read and write calls using the MIDP HttpConnector.

See Also:
MQeAdapter

Field Summary
 
Fields inherited from class com.ibm.mqe.adapters.MQeCommunicationsAdapter
COMMS_ADAPTER_ADDRESS, COMMS_ADAPTER_CLASS, COMMS_ADAPTER_GROUP_SIZE, COMMS_ADAPTER_HTTP_VERSION, COMMS_ADAPTER_LISTEN, COMMS_ADAPTER_NONBLOCKING_TIMEOUT, COMMS_ADAPTER_NOPERSIST, COMMS_ADAPTER_PERSIST, COMMS_ADAPTER_PKTSIZE, COMMS_ADAPTER_PORT, COMMS_ADAPTER_RETRIES, COMMS_ADAPTER_SERVLET, COMMS_ADAPTER_TIMEOUT, COMMS_ADAPTER_VARIANCE, listeningAdapter, persistentAdapter, responderAdapter
 
Constructor Summary
MQeMidpHttpAdapter()
           
 
Method Summary
 void activate(MQePropertyProvider info)
          Initialises a new MQeMidpHttpAdapter object.
 void close()
          Close the adapter.
 void open()
          Opens a socket for use.
 byte[] read()
          Reads incoming data from the HTTP stream.
 void temporaryClose()
          Close the adapter if the adapter is non persistent.
 MQeCommunicationsAdapter waitForContact(MQePropertyProvider info)
          Wait for an incoming request then return an adapter instance that can cope with the conversation.
 void writeData(byte[] data)
          Writes bytes to the HTTP stream.
 void writeResponse(byte[] data)
          The writeResponse() method should not be called for this adapter.
 
Methods inherited from class com.ibm.mqe.adapters.MQeCommunicationsAdapter
createNewAdapter, isStopDemanded, isStopRequested
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MQeMidpHttpAdapter

public MQeMidpHttpAdapter()
Method Detail

activate

public void activate(MQePropertyProvider info)
              throws java.lang.Exception
Initialises a new MQeMidpHttpAdapter object. While the MQeMidpHttpAdapter is not intended for use by MQe, this method should be called inside the activate method all the adapters that extend this class.

Specified by:
activate in class MQeCommunicationsAdapter
Parameters:
info - Contains the parameters required to activate the adapter.
Returns:
void
Throws:
java.lang.Exception - Does not create exceptions, only throws exceptions created by the methods that activate calls.
See Also:
MQeCommunicationsAdapter.COMMS_ADAPTER_TIMEOUT, MQeCommunicationsAdapter.COMMS_ADAPTER_PKTSIZE, MQeCommunicationsAdapter.COMMS_ADAPTER_RETRIES, MQeCommunicationsAdapter.COMMS_ADAPTER_SERVLET, MQeCommunicationsAdapter.COMMS_ADAPTER_PORT, MQeCommunicationsAdapter.COMMS_ADAPTER_ADDRESS

close

public void close()
           throws java.lang.Exception
Close the adapter.

Specified by:
close in class MQeCommunicationsAdapter
Returns:
void
Throws:
java.lang.Exception - Always succeeds, unless an underlying call fails before us.

temporaryClose

public void temporaryClose()
                    throws java.lang.Exception
Close the adapter if the adapter is non persistent.

Specified by:
temporaryClose in class MQeCommunicationsAdapter
Returns:
void
Throws:
java.lang.Exception

waitForContact

public MQeCommunicationsAdapter waitForContact(MQePropertyProvider info)
                                        throws java.lang.Exception
Wait for an incoming request then return an adapter instance that can cope with the conversation. Unfortunately due to the limiations of J2ME the MQeMidpHttpAdapter is unable to listen for connections. Therefore this method on this adapter throws and exception if called. Throws an MQe.Except_BadRequest MQeException

Specified by:
waitForContact in class MQeCommunicationsAdapter
Parameters:
info - unused
Returns:
MQeCommunicationsAdapter object
Throws:
java.lang.Exception

open

public void open()
          throws java.lang.Exception
Opens a socket for use.

If this is a listening adapter then create a new server socket. Otherwise create a new socket.

Specified by:
open in class MQeCommunicationsAdapter
Returns:
void
Throws:
java.lang.Exception

read

public byte[] read()
            throws java.lang.Exception
Reads incoming data from the HTTP stream.

Specified by:
read in class MQeCommunicationsAdapter
Returns:
A Byte Array that was read
Throws:
java.lang.Exception

writeData

public void writeData(byte[] data)
               throws java.lang.Exception
Writes bytes to the HTTP stream.

Specified by:
writeData in class MQeCommunicationsAdapter
Parameters:
data - byte[] containing the data to be written.
Returns:
void
Throws:
java.lang.Exception

writeResponse

public void writeResponse(byte[] data)
                   throws java.lang.Exception
The writeResponse() method should not be called for this adapter. Throws an MQe.Except_BadRequest MQeException

Specified by:
writeResponse in class MQeCommunicationsAdapter
Parameters:
data - Byte array containing the data to be written.
Returns:
void
Throws:
java.lang.Exception

Websphere MQ Everyplace