com.ibm.maf.atp
Class AtpConnectionImpl
java.lang.Object
|
+--java.net.URLConnection
|
+--com.ibm.maf.atp.AtpConnectionImpl
- All Implemented Interfaces:
- AtpConstants
- public class AtpConnectionImpl
- extends java.net.URLConnection
- implements AtpConstants
An instance of this class creates a communication link between an
application and an atp server.
- Version:
- 1.10 $Date :$
- Author:
- Danny B. Lange, Mitsuru Oshima
Field Summary |
static int |
ATP_DEFAULT_PORT
Default port number to receive atp messages. |
protected static java.lang.String |
ATP_VERSION
|
protected static java.lang.String |
CRLF
|
Fields inherited from class java.net.URLConnection |
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches |
Fields inherited from interface com.ibm.atp.AtpConstants |
ATCI_REQUEST, ATCI_RESPONSE, AUTHENTICATION_MANNER_DIGEST, AUTHENTICATION_MANNER_SIGNATURE, BAD_GATEWAY, BAD_REQUEST, DISPATCH, EXCEPTION, FETCH, FORBIDDEN, FUTURE, HANDLED, ILLEGAL_REQUEST, INTERNAL_ERROR, MAX_REQUEST_TYPE, MESSAGE, MOVED, NO_AUTHENTICATION_MANNER, NOT_AUTHENTICATED, NOT_FOUND, NOT_HANDLED, NOT_IMPLEMENTED, OKAY, ONEWAY, PING, REPLY, REQUEST_TYPE_BASE, RETRACT, SERVICE_UNAVAILABLE, SYNC |
Constructor Summary |
AtpConnectionImpl(java.net.URL url)
Create a new instance of this class. |
Methods inherited from class java.net.URLConnection |
getAllowUserInteraction, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getIfModifiedSince, getLastModified, getPermission, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setUseCaches, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ATP_DEFAULT_PORT
public static final int ATP_DEFAULT_PORT
- Default port number to receive atp messages.
CRLF
protected static final java.lang.String CRLF
ATP_VERSION
protected static final java.lang.String ATP_VERSION
AtpConnectionImpl
public AtpConnectionImpl(java.net.URL url)
throws java.io.IOException
- Create a new instance of this class.
- Parameters:
url
- a destination URL to which the application connects.
The protocol is "atp".
close
public void close()
throws java.io.IOException
connect
public void connect()
throws java.io.IOException
- Make a comminucation link with the destination.
- Overrides:
connect
in class java.net.URLConnection
- Throws:
java.io.IOException
- if can not make a communication link.
getHeaderField
public java.lang.String getHeaderField(java.lang.String key)
- Overrides:
getHeaderField
in class java.net.URLConnection
getInputStream
public java.io.InputStream getInputStream()
throws java.io.IOException
- Get an input stream of the communication link.
- Overrides:
getInputStream
in class java.net.URLConnection
- Returns:
- an input stream.
- Throws:
java.io.IOException
- if the communication link has a problem.
getMIC
public byte[] getMIC()
getOutputStream
public java.io.OutputStream getOutputStream()
throws java.io.IOException
- Get an output stream of the communication link. If the destination is
out of firewall and a proxy is specified, an output stream connected
to the proxy will be returned, The stream will add the destination
atp address to top of an output data. The proxy reads the address,
takes it away and forewards the ramained data to the specified
destination.
- Overrides:
getOutputStream
in class java.net.URLConnection
- Returns:
- an output stream.
- Throws:
java.io.IOException
- if the communication link has a problem.
getProperty
public java.lang.String getProperty(java.lang.String key)
getReasonPhase
public java.lang.String getReasonPhase()
getStatusCode
public int getStatusCode()
guessRequestTypeFromURL
protected static int guessRequestTypeFromURL(java.net.URL url)
throws java.io.IOException
parseHeaders
public void parseHeaders()
throws java.io.IOException
parseHeaders
public static void parseHeaders(java.io.DataInputStream di,
java.util.Hashtable headers)
throws java.io.IOException
sendRequest
public void sendRequest()
throws java.io.IOException
sendRequestHeaders
protected void sendRequestHeaders(java.io.PrintStream p)
throws java.io.IOException
setAgentName
public void setAgentName(Name name)
setAgentProfile
public void setAgentProfile(AgentProfile profile)
setMIC
public void setMIC(byte[] bytes)
setRequestProperty
public void setRequestProperty(java.lang.String key,
java.lang.String value)
- Overrides:
setRequestProperty
in class java.net.URLConnection
setRequestType
public void setRequestType(int i)
setSender
public void setSender(java.lang.String address)