Package ca.uhn.hl7v2.protocol.impl
Class URLTransport
java.lang.Object
ca.uhn.hl7v2.protocol.impl.AbstractTransport
ca.uhn.hl7v2.protocol.impl.URLTransport
- All Implemented Interfaces:
TransportLayer
A
TransportLayer that reads and writes from an URL (for example
over HTTP).- Version:
- $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:26 $ by $Author: jamesagnew $
- Author:
- Bryan Tripp, Alexei Guevara
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intstatic final StringKey in Transportable metadata map under which URL is stored. -
Constructor Summary
ConstructorsConstructorDescriptionURLTransport(URL theURL, boolean connectOnSend, boolean connectOnReceive, boolean connectOnConnect) The boolean configuration flags determine when new connections are made. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalls openConnection() on the underlying URL and configures the connection, if this transport is configured to connect when connect() is called (see constructor params).voidPerforms disconnection as described in TransportLayer.disconnect().Called by receive(), which then adds common metadata.voiddoSend(Transportable theMessage) Writes the given message to the URL.voidsetContentType(String theContentType) Methods inherited from class ca.uhn.hl7v2.protocol.impl.AbstractTransport
connect, disconnect, getCommonMetadata, isConnected, receive, sendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ca.uhn.hl7v2.protocol.TransportLayer
connect, disconnect, getCommonMetadata, isConnected, receive, send
-
Field Details
-
URL_KEY
Key in Transportable metadata map under which URL is stored.- See Also:
-
myBufferSize
- See Also:
-
-
Constructor Details
-
URLTransport
public URLTransport(URL theURL, boolean connectOnSend, boolean connectOnReceive, boolean connectOnConnect) The boolean configuration flags determine when new connections are made. For example if this transport is being used for query/response, you might set connectOnSend to true and the others to false, so that each query/response is done over a fresh connection. If you are using a transport just to read data from a URL, you might set connectOnReceive to true and the others to false.- Parameters:
theURL- the URL at which messages are to be read and writtenconnectOnSend- makes a new connection before each sendconnectOnReceive- makes a new connection before each receiveconnectOnConnect- makes a new connection when connect() is called
-
-
Method Details
-
doSend
Writes the given message to the URL.- Specified by:
doSendin classAbstractTransport- Parameters:
theMessage- the message to send- Throws:
TransportException
-
doReceive
Description copied from class:AbstractTransportCalled by receive(), which then adds common metadata.- Specified by:
doReceivein classAbstractTransport- Returns:
- Transportable the next available message
- Throws:
TransportException
-
doConnect
Calls openConnection() on the underlying URL and configures the connection, if this transport is configured to connect when connect() is called (see constructor params).- Specified by:
doConnectin classAbstractTransport- Throws:
TransportException
-
getContentType
- Returns:
- the string used in the request property "Content-Type" (defaults to "application/hl7+doc+xml")
-
setContentType
- Parameters:
theContentType- the string to be used in the request property "Content-Type" (defaults to "application/hl7+doc+xml")
-
doDisconnect
Description copied from class:AbstractTransportPerforms disconnection as described in TransportLayer.disconnect(). The disconnect() method of this class delegates to doDisconnect() after some internal housekeeping.- Specified by:
doDisconnectin classAbstractTransport- See Also:
-