public class RepositoryHttpEndpointImpl extends java.lang.Object implements RepositoryHttpEndpoint
Constructor and Description |
---|
RepositoryHttpEndpointImpl(RepositoryItem repositoryItem,
java.lang.String sessionId,
java.lang.String url,
RepositoryHttpManager httpManager) |
Modifier and Type | Method and Description |
---|---|
void |
addSessionErrorListener(RepositoryHttpEventListener<HttpSessionErrorEvent> listener)
|
void |
addSessionStartedListener(RepositoryHttpEventListener<HttpSessionStartedEvent> listener)
|
void |
addSessionTerminatedListener(RepositoryHttpEventListener<HttpSessionTerminatedEvent> listener)
|
java.io.InputStream |
createRepoItemInputStream()
Returns a new
InputStream on each invocation. |
void |
fireSessionErrorEvent(java.lang.Exception ex) |
void |
fireSessionTerminatedEvent() |
void |
fireStartedEventIfFirstTime() |
void |
forceStopHttpManager(java.lang.String message) |
long |
getAutoTerminationTimeout()
Gets the current auto-termination timeout.
|
java.lang.String |
getDispatchURL()
Returns the URL to play (download) or record (upload) the content for the
RepositoryItem . |
java.io.OutputStream |
getRepoItemOutputStream()
Returns the
OutputStream associated with this RepositoryHttpEndpoint . |
RepositoryItem |
getRepositoryItem()
Returns the associated repository item of this
RepositoryHttpEndpoint . |
java.lang.String |
getSessionId() |
java.lang.String |
getURL()
Returns the URL to play (download) or record (upload) the content for the
RepositoryItem . |
long |
getWrittenBytes() |
void |
setAutoTerminationTimeout(long timeoutInMillis)
Sets the time of inactivity to auto-terminate this element.
|
void |
stop()
This method is called to finish the current session.
|
void |
stopCurrentTimer() |
void |
stopInTimeout() |
public RepositoryHttpEndpointImpl(RepositoryItem repositoryItem, java.lang.String sessionId, java.lang.String url, RepositoryHttpManager httpManager)
public java.lang.String getURL()
RepositoryHttpEndpoint
RepositoryItem
. When the first client connect to this URL, the
HttpSessionStartedEvent
will be fired to registered listeners.getURL
in interface RepositoryHttpEndpoint
public java.lang.String getDispatchURL()
RepositoryHttpEndpoint
RepositoryItem
. This URL is relative to the context URL of this app. The URL can be
used to dispatch a request with
getRequestDispatcher
. When the first client connect to this URL, the
HttpSessionStartedEvent
will be fired to registered listeners.getDispatchURL
in interface RepositoryHttpEndpoint
public void setAutoTerminationTimeout(long timeoutInMillis)
RepositoryHttpEndpoint
setAutoTerminationTimeout
in interface RepositoryHttpEndpoint
public long getAutoTerminationTimeout()
RepositoryHttpEndpoint
getAutoTerminationTimeout
in interface RepositoryHttpEndpoint
RepositoryHttpEndpoint.setAutoTerminationTimeout(long)
public void addSessionStartedListener(RepositoryHttpEventListener<HttpSessionStartedEvent> listener)
RepositoryHttpEndpoint
RepositoryHttpEventListener
< HttpSessionStartedEvent
> to this
RepositoryHttpEndpoint
. When the media is requested, a HttpSessionStartedEvent
will be fired to all registered listeners and the method
onEvent
will be
invoked.addSessionStartedListener
in interface RepositoryHttpEndpoint
listener
- the listenerpublic void addSessionTerminatedListener(RepositoryHttpEventListener<HttpSessionTerminatedEvent> listener)
RepositoryHttpEndpoint
RepositoryHttpEventListener
< HttpSessionTerminatedEvent
> to this
RepositoryHttpEndpoint
. When the RepositoryHttpEndpoint.stop()
method is
invoked or a configurable inactivity time is reached (configurable using
RepositoryHttpEndpoint.setAutoTerminationTimeout(long)
) a HttpSessionTerminatedEvent
will be fired to
all registered listeners and the method
onEvent
will be
invoked.addSessionTerminatedListener
in interface RepositoryHttpEndpoint
listener
- the listenerpublic void addSessionErrorListener(RepositoryHttpEventListener<HttpSessionErrorEvent> listener)
RepositoryHttpEndpoint
RepositoryHttpEventListener
< HttpSessionErrorEvent
> to this
RepositoryHttpEndpoint
. When an error is produced reading or writing the media from/to
repository a HttpSessionErrorEvent
will be fired to all registered listeners and the
method onEvent
will be
invoked.addSessionErrorListener
in interface RepositoryHttpEndpoint
listener
- the listenerpublic void fireStartedEventIfFirstTime()
public void fireSessionTerminatedEvent()
public RepositoryItem getRepositoryItem()
RepositoryHttpEndpoint
RepositoryHttpEndpoint
.getRepositoryItem
in interface RepositoryHttpEndpoint
public java.io.InputStream createRepoItemInputStream()
RepositoryHttpEndpoint
InputStream
on each invocation. It is legal to read from multiple threads
to the same repositoryItem. The returned InputStream
fully supports skip. The receiver
of the InputStream
is responsible for closing it after its use.createRepoItemInputStream
in interface RepositoryHttpEndpoint
public java.io.OutputStream getRepoItemOutputStream()
RepositoryHttpEndpoint
OutputStream
associated with this RepositoryHttpEndpoint
. The first
time, the OutputStream
is created and the next times the same OutputStream
is
returned. The returned OutputStream
is not designed to be used concurrently from
several threads. The OutputStream
is closed when the
RepositoryHttpEndpoint.stop()
is invoked or the timeout
RepositoryHttpEndpoint.getAutoTerminationTimeout()
is reached.getRepoItemOutputStream
in interface RepositoryHttpEndpoint
public long getWrittenBytes()
public void stopInTimeout()
public void stopCurrentTimer()
public java.lang.String getSessionId()
public void fireSessionErrorEvent(java.lang.Exception ex)
public void forceStopHttpManager(java.lang.String message)
public void stop()
RepositoryHttpEndpoint
HttpSessionTerminatedEvent
is fired to registered listeners.stop
in interface RepositoryHttpEndpoint