public class HttpConnection extends org.apache.http.entity.AbstractHttpEntity implements CloseableDataOutput
Constructor and Description |
---|
HttpConnection(java.util.concurrent.ExecutorService executor,
java.net.URI uri,
java.lang.String login,
java.lang.String password,
org.apache.http.impl.client.CloseableHttpClient httpClient) |
Modifier and Type | Method and Description |
---|---|
HttpSender.CnxState |
awaitStateChange(long time,
java.util.concurrent.TimeUnit unit,
HttpSender.CnxState expected) |
void |
close()
Do not actually close the connection but mark it as available (aka return it the the pool).
|
java.io.InputStream |
getContent() |
long |
getContentLength() |
java.lang.Throwable |
getError() |
StateDuration |
getState() |
boolean |
isRepeatable() |
boolean |
isStreaming() |
HttpConnection |
open(PAPI_COMMAND cmd)
Indicate on the output stream that more data is available.
|
void |
terminateSession(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(java.lang.String s) |
void |
writeChar(int v) |
void |
writeChars(java.lang.String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeTo(java.io.OutputStream outs) |
void |
writeUTF(java.lang.String s) |
public HttpConnection(java.util.concurrent.ExecutorService executor, java.net.URI uri, java.lang.String login, java.lang.String password, org.apache.http.impl.client.CloseableHttpClient httpClient) throws java.io.IOException
executor
- The executor within which the Http connection is being runuri
- The URI to connect to.login
- The login of the user. May be empty of null
. If none Authorization
HTTP header is sent. Only basic authorization is supported.password
- the password for the authorization.httpClient
- The HTTP client to have the Http connection executed into.java.io.IOException
public HttpConnection open(PAPI_COMMAND cmd) throws PushAPIException
cmd
- The command to be sentPushAPIException
- If it could not write on the stream that more data is availablepublic void close() throws java.io.IOException
#terminateSession()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void terminateSession(long timeout, java.util.concurrent.TimeUnit unit) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException
public java.lang.Throwable getError()
public HttpSender.CnxState awaitStateChange(long time, java.util.concurrent.TimeUnit unit, HttpSender.CnxState expected) throws java.lang.InterruptedException
java.lang.InterruptedException
public StateDuration getState()
public void writeTo(java.io.OutputStream outs) throws java.io.IOException
writeTo
in interface org.apache.http.HttpEntity
java.io.IOException
public boolean isRepeatable()
isRepeatable
in interface org.apache.http.HttpEntity
public boolean isStreaming()
isStreaming
in interface org.apache.http.HttpEntity
public long getContentLength()
getContentLength
in interface org.apache.http.HttpEntity
public java.io.InputStream getContent() throws java.io.IOException, java.lang.UnsupportedOperationException
getContent
in interface org.apache.http.HttpEntity
java.io.IOException
java.lang.UnsupportedOperationException
public void write(int b) throws java.io.IOException
write
in interface java.io.DataOutput
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in interface java.io.DataOutput
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in interface java.io.DataOutput
java.io.IOException
public void writeBoolean(boolean v) throws java.io.IOException
writeBoolean
in interface java.io.DataOutput
java.io.IOException
public void writeByte(int v) throws java.io.IOException
writeByte
in interface java.io.DataOutput
java.io.IOException
public void writeShort(int v) throws java.io.IOException
writeShort
in interface java.io.DataOutput
java.io.IOException
public void writeChar(int v) throws java.io.IOException
writeChar
in interface java.io.DataOutput
java.io.IOException
public void writeInt(int v) throws java.io.IOException
writeInt
in interface java.io.DataOutput
java.io.IOException
public void writeLong(long v) throws java.io.IOException
writeLong
in interface java.io.DataOutput
java.io.IOException
public void writeFloat(float v) throws java.io.IOException
writeFloat
in interface java.io.DataOutput
java.io.IOException
public void writeDouble(double v) throws java.io.IOException
writeDouble
in interface java.io.DataOutput
java.io.IOException
public void writeBytes(java.lang.String s) throws java.io.IOException
writeBytes
in interface java.io.DataOutput
java.io.IOException
public void writeChars(java.lang.String s) throws java.io.IOException
writeChars
in interface java.io.DataOutput
java.io.IOException
public void writeUTF(java.lang.String s) throws java.io.IOException
writeUTF
in interface java.io.DataOutput
java.io.IOException
Copyright © 2013 Dassault Systèmes, All Rights Reserved.