public class HTTPChannel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<java.lang.String> |
accept |
private long |
bytesJPIPMessageBody
Is used to save the amount of received bytes in the JPIP message body.
|
private long |
bytesJPIPMessageHeader
Is used to save the amount of received bytes in the JPIP message header.
|
private CacheManagement |
cache |
private java.lang.String |
clientHostName
Contains the local host name.
|
private long[] |
histBytes
An one-dimensional array which tracks last amount of data downloaded.
|
private long[] |
histTimes
An one-dimensional array which contains a time-stamp regarding to data
recorded at
#downloadedBytes . |
private HTTPClient |
httpClient
An object to send the request and receive the server response.
|
private int |
iterator
An iterator to simulate a circular queue.
|
private JPIPMessageDecoder |
jpipMessageDecoder
Object used to decode the JPIP response messages.
|
private JPIPResponseFields |
jpipResponseFields |
private CADILog |
log |
private int |
MAX_HIST_RECORDS
Is the maximum number of records to be saved in the historic.
|
private int |
port |
private int |
proxyPort |
private java.lang.String |
proxyServer
Is the proxy server used to connect to the server.
|
private java.lang.String |
server
Is the server name where logical targets are located.
|
private StopWatch |
stopWatch |
private long |
totalDownloadedBytes
Contains the downloaded total bytes for the actual logical target.
|
Constructor and Description |
---|
HTTPChannel(java.lang.String server,
int port,
java.lang.String proxyServer,
int proxyPort,
CacheManagement cache,
CADILog log) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getBytesJPIPMessageBody()
Returns the
bytesJPIPMessageBody attribute. |
long |
getBytesJPIPMessageHeader()
Returns the
bytesJPIPMessageHeader attribute. |
long |
getDownloadedBytes()
Returns the total bytes downloaded for the actual logical target.
|
JPIPResponseFields |
getJPIPResponseFields() |
void |
getRequest(java.lang.String requestURI)
Get the target which is identified by the URI
requestURI |
java.lang.String |
getRequestedURI() |
boolean |
isKeepAlive()
Returns whether the HTTP keep alive feature is or not set.
|
void |
list(java.io.PrintStream out)
Prints this HTTP Channel out to the specified output stream.
|
void |
resetJPIPMessagesCounters()
Sets the JPIP message counter to 0.
|
void |
setAccept(java.util.ArrayList<java.lang.String> accept) |
void |
setClientHostName(java.lang.String clientHostName) |
void |
setDebug(java.lang.String debug)
Definition in
HTTPClient.setDebug(java.lang.String) . |
void |
setKeepAlive(boolean keepAlive) |
void |
setUserAgent(java.lang.String userAgent) |
void |
setVia(java.lang.String via) |
java.lang.String |
toString() |
private void |
updateStatistics(long bytes,
long time)
This method updates the
#downloadedBytes and
#downloadsTimes attributes with new new values which are parsed
as input parameters. |
private java.lang.String server
private int port
private java.lang.String proxyServer
private int proxyPort
private HTTPClient httpClient
private JPIPMessageDecoder jpipMessageDecoder
private StopWatch stopWatch
private CADILog log
private JPIPResponseFields jpipResponseFields
private CacheManagement cache
private java.lang.String clientHostName
private java.util.ArrayList<java.lang.String> accept
private volatile long totalDownloadedBytes
private long bytesJPIPMessageBody
private long bytesJPIPMessageHeader
private final int MAX_HIST_RECORDS
private long[] histBytes
This attribute is related to histTimes
attribute.
private long[] histTimes
#downloadedBytes
. Both attributes are used
to estimate the download read.private int iterator
public HTTPChannel(java.lang.String server, int port, java.lang.String proxyServer, int proxyPort, CacheManagement cache, CADILog log)
server
- port
- proxyServer
- proxyPort
- cache
- log
- public void close()
public void setClientHostName(java.lang.String clientHostName)
public void setKeepAlive(boolean keepAlive)
public boolean isKeepAlive()
public void setUserAgent(java.lang.String userAgent)
public void setDebug(java.lang.String debug)
HTTPClient.setDebug(java.lang.String)
.debug
- public void setVia(java.lang.String via)
via
- public void setAccept(java.util.ArrayList<java.lang.String> accept)
public JPIPResponseFields getJPIPResponseFields()
public java.lang.String getRequestedURI()
public void getRequest(java.lang.String requestURI) throws WarningException
requestURI
requestURI
- the URI to locate the logical target.
throws WarningException if an error occurs fetching the target or
received data cannot be decompressedWarningException
public long getDownloadedBytes()
public void resetJPIPMessagesCounters()
public long getBytesJPIPMessageHeader()
bytesJPIPMessageHeader
attribute.bytesJPIPMessageHeader
attribute.public long getBytesJPIPMessageBody()
bytesJPIPMessageBody
attribute.bytesJPIPMessageBody
attribute.public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.private void updateStatistics(long bytes, long time)
#downloadedBytes
and
#downloadsTimes
attributes with new new values which are parsed
as input parameters.bytes
- the new value to be added in the #downloadedBytes
attribute.time
- the new value to be added in the #downloadsTimes
attribute.
CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Group on Interactive Coding of Images (GICI) (contact)