public class CachedProxyWorker extends ProxyWorker implements StatusCodes, EORCodes
Usage example:
construct
setParameters
run
Modifier and Type | Field and Description |
---|---|
private ViewWindowField |
actualViewWindow |
private java.lang.Thread |
auxThread |
private int |
cacheDescriptorSubType |
private int |
cacheDescriptorType |
private static java.lang.String |
channelFieldPath |
private java.lang.String |
cid
Definition in
ChannelField.cid . |
private java.lang.String |
clientUserAgent
This attribute is only for debugging and experimental purposes.
|
private ProxyJPEG2KCodestream |
codestream |
private int |
EORReasonCode |
private java.lang.String |
EORReasonMessage |
private FetchTarget |
fetchTarget |
private boolean |
isStatelessRequest
Indicates whether the actual request is a stateles request or a request
with a session.
|
private JPIPMessageEncoder |
jpipMessageEncoder |
private JPIPRequestFields |
jpipRequestFields |
private ProxyClientSessions |
listOfClientSessions
Definition in
Scheduler.clientSessions . |
private java.lang.String |
predictiveModel
Definition in
Proxy.predictiveModel . |
private ProxyCacheModel |
proxyCacheModel |
private ProxyPrefSemaphore |
proxyMutex
Definition in
Proxy.proxyMutex |
private ProxyClientSession |
proxySession
Contains the session object where data about the actual session is
saved.
|
private ProxySessionTarget |
proxySessionTarget |
private ProxySessionTargets |
proxySessionTargets
Definition in
CADI.Proxy.Proxy#logicalTargetList . |
private java.lang.String |
proxyVia |
private ViewWindowField |
responseViewWindow |
private StopWatch |
stopWatch |
private boolean |
useExtendedHeaders |
(package private) java.lang.String |
userAgent |
busy, cumMessageBodiesLength, cumMessageHeadersLength, finish, httpRequest, httpResponse, httpResponseSender, independentMessageHeaders, jpipResponseFields, keepAliveTimeout, log, maxTxRate, os, requestQueue, socket, trafficShaping
ACCEPTED, BAD_REQUEST, NOT_FOUND, NOT_IMPLEMENTED, OK, SERVICE_UNAVAILABLE, UNSUPPORTED_MEDIA_TYPE
BYTE_LIMIT_REACHED, IMAGE_CHANGE, IMAGE_DONE, NON_ESPECIFIED_REASON, QUALITY_LIMIT_REACHED, RESPONSE_LIMIT_REACHED, SESSION_LIMIT_REACHED, WINDOW_DONE
Constructor and Description |
---|
CachedProxyWorker(java.lang.String threadName,
RequestQueue requestQueue,
ProxySessionTargets proxySessionTargets,
ProxyClientSessions listOfClientSessions,
ProxyPrefSemaphore proxyMutex,
CADILog log)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private void |
addMetadaBin0(HTTPResponseSender httpResponseSender,
JPIPMessageEncoder jpipMessageEncoder)
Adds the metadata bin 0 to the response.
|
private void |
checkJPIPParameters()
This method tests several JPIP restrictions of the parameters
|
void |
list(java.io.PrintStream out)
Prints this Transparent Proxy Worker out to the specified output stream.
|
private void |
logicalTargetsManager(java.lang.String target,
java.lang.String tid)
This method is used to manage the list of loaded targets.
|
private void |
processRequest() |
private void |
processViewWindow(ViewWindowField viewWindow) |
void |
run() |
private void |
sendData(java.util.ArrayList<SendDataInfo> cacheDescriptor) |
private void |
sendDataNew(java.util.ArrayList<RelevantPrecinct> relevantPrecincts) |
private void |
sendEndOfResponse(HTTPResponseSender httpResponseSender,
JPIPMessageEncoder jpipMessageEncoder)
This method is used to send the End of Response of a JPIP message.
|
void |
sessionsManager()
This method is used to manage the client sessions.
|
void |
setClientUserAgent(java.lang.String clientUserAgent)
Sets the
clientUserAgent attribute. |
void |
setPredictiveModel(java.lang.String predModel) |
java.lang.String |
toString() |
private void |
updateCache(JPIPMessageHeader jpipMessageHeader)
This method is used to update the cache with the data that has been sent
to the client.
|
finish, getState, isBusy, listenNewRequest, sendHTTPResponseError, sendHTTPResponseHeader, setIndependentMessageHeaders, setKeepAliveTimeout, setMaxTxRate, setTrafficShaping
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
private ProxySessionTargets proxySessionTargets
CADI.Proxy.Proxy#logicalTargetList
.private ProxyClientSessions listOfClientSessions
Scheduler.clientSessions
.private ProxyPrefSemaphore proxyMutex
Proxy.proxyMutex
private java.lang.String clientUserAgent
private ProxySessionTarget proxySessionTarget
private ProxyClientSession proxySession
private java.lang.String cid
ChannelField.cid
.private ProxyCacheModel proxyCacheModel
private boolean isStatelessRequest
private JPIPRequestFields jpipRequestFields
private ViewWindowField responseViewWindow
private ViewWindowField actualViewWindow
private ProxyJPEG2KCodestream codestream
private JPIPMessageEncoder jpipMessageEncoder
private int cacheDescriptorType
private int cacheDescriptorSubType
private java.lang.String predictiveModel
Proxy.predictiveModel
.private FetchTarget fetchTarget
private java.lang.Thread auxThread
private static java.lang.String channelFieldPath
private StopWatch stopWatch
private int EORReasonCode
private java.lang.String EORReasonMessage
private boolean useExtendedHeaders
private java.lang.String proxyVia
java.lang.String userAgent
public CachedProxyWorker(java.lang.String threadName, RequestQueue requestQueue, ProxySessionTargets proxySessionTargets, ProxyClientSessions listOfClientSessions, ProxyPrefSemaphore proxyMutex, CADILog log)
threadName
- requestQueue
- proxyCacheLogicalTargets
- proxyRequestedWOIs
- proxyMutex
- log
- public void setClientUserAgent(java.lang.String clientUserAgent)
clientUserAgent
attribute.clientUserAgent
- definition in clientUserAgent
.public void setPredictiveModel(java.lang.String predModel)
predModel
- public void run()
run
in interface java.lang.Runnable
run
in class ProxyWorker
public java.lang.String toString()
toString
in class ProxyWorker
public void list(java.io.PrintStream out)
list
in class ProxyWorker
out
- an output stream.private void processRequest() throws ErrorException, WarningException, java.io.IOException
ErrorException
WarningException
java.io.IOException
private void checkJPIPParameters() throws WarningException
WarningException
public void sessionsManager() throws WarningException
Tests if it is a stateless request, if it is a request which belongs to
a previous session, or it is a request for a new session. When a
stateless request is used, a temporary session is created and it must be
removed when the request process finishes. When the request is for a new
session, a new entry in the
listOfClientSessions
is created
with the client preferences and capabilities. And if the request belongs
to a previous session, then, client data (logical target, image return
type, cache, preferences, capabilites, etc. ) are read from the
listOfClientSessions
.
When an error in the request is found (p.e. session identifier does not
exist or are wrong, logical target does not exist, etc.), an error
message is sent to the client and a
WarningException
is
thrown.
WarningException
- when something anomalous (p.e. session identifier
does not exist or are wrong, logical target does not exist, etc.) this
exception will be thrown.private void logicalTargetsManager(java.lang.String target, java.lang.String tid) throws WarningException
target
field, the jpip
tid
field, or both.
If the requested target has been loaded in a previous request, it will be in the list of loaded targets. So, its parameters will be recovered from that list.
Otherwise, target will be searched in disk. And if it is in disk, it will be loaded to the list.
target
- definition in TargetField.target
tid
- definition in TargetField.tid
WarningException
private void processViewWindow(ViewWindowField viewWindow) throws ErrorException
viewWindow
- ErrorException
private void addMetadaBin0(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder) throws java.io.IOException
It is a temporal method while metadata are not supported.
java.io.IOException
private void sendDataNew(java.util.ArrayList<RelevantPrecinct> relevantPrecincts) throws java.io.IOException
java.io.IOException
private void sendData(java.util.ArrayList<SendDataInfo> cacheDescriptor) throws java.io.IOException
java.io.IOException
private void sendEndOfResponse(HTTPResponseSender httpResponseSender, JPIPMessageEncoder jpipMessageEncoder) throws java.io.IOException
httpResponseSender
- jpipMessageEncoder
- java.io.IOException
private void updateCache(JPIPMessageHeader jpipMessageHeader)
jpipMessageData
- an array list with the data that has been sent.
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)