Package org.jupnp.transport.spi
Klasse AbstractStreamClient<C extends StreamClientConfiguration,REQUEST>
java.lang.Object
org.jupnp.transport.spi.AbstractStreamClient<C,REQUEST>
- Alle implementierten Schnittstellen:
StreamClient<C>
- Bekannte direkte Unterklassen:
JettyStreamClientImpl
public abstract class AbstractStreamClient<C extends StreamClientConfiguration,REQUEST>
extends Object
implements StreamClient<C>
Implements the timeout/callback processing and unifies exception handling.
- Autor:
- Christian Bauer
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected abstract voidCancel and abort the request immediately, with the proprietary API.protected abstract Callable<StreamResponseMessage> createCallable(StreamRequestMessage requestMessage, REQUEST request) Create a callable procedure that will execute the request.protected abstract REQUESTcreateRequest(StreamRequestMessage requestMessage) Create a proprietary representation of this request, log warnings and returnnullif creation fails.protected abstract booleanprotected voidsendRequest(StreamRequestMessage requestMessage) Sends the given request via TCP (HTTP) and returns the response.Von Klasse geerbte Methoden java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitVon Schnittstelle geerbte Methoden org.jupnp.transport.spi.StreamClient
getConfiguration, stop
-
Konstruktordetails
-
AbstractStreamClient
public AbstractStreamClient()
-
-
Methodendetails
-
sendRequest
public StreamResponseMessage sendRequest(StreamRequestMessage requestMessage) throws InterruptedException Beschreibung aus Schnittstelle kopiert:StreamClientSends the given request via TCP (HTTP) and returns the response.This method must implement expiration of timed out requests using the
StreamClientConfigurationsettings. When a request expires, anullresponse will be returned.This method will always try to complete execution without throwing an exception. It will return
nullif an error occurs, and optionally log any exception messages.The rules for logging are:
- If the caller interrupts the calling thread, log at
TRACE. - If the request expires because the timeout has been reached, log at
INFOlevel. - If another error occurs, log at
WARNINGlevel
This method is required to add a
HostHTTP header to the outgoing HTTP request, even if the givenStreamRequestMessagedoes not contain such a header.This method will add the
User-AgentHTTP header to the outgoing HTTP request if the given message did not already contain such a header. You can set this default value in yourStreamClientConfiguration.- Angegeben von:
sendRequestin SchnittstelleStreamClient<C extends StreamClientConfiguration>- Parameter:
requestMessage- The message to send.- Gibt zurück:
- The response or
nullif no response has been received or an error occurred. - Löst aus:
InterruptedException- if you interrupt the calling thread.
- If the caller interrupts the calling thread, log at
-
createRequest
Create a proprietary representation of this request, log warnings and returnnullif creation fails. -
createCallable
protected abstract Callable<StreamResponseMessage> createCallable(StreamRequestMessage requestMessage, REQUEST request) Create a callable procedure that will execute the request. -
abort
Cancel and abort the request immediately, with the proprietary API. -
logExecutionException
- Gibt zurück:
trueif no more logging of this exception should be done.
-
onFinally
-