public class RemoteBase extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
RemoteBase.HttpClientClosingInputStream
A stream wrapper that closes the http response when the stream is closed.
|
| Modifier and Type | Field and Description |
|---|---|
protected TrustedHttpClient |
client
The http client to use when connecting to remote servers
|
static Function<org.apache.http.HttpResponse,Option<List<MediaPackageElement>>> |
elementsFromHttpResponse |
protected ServiceRegistry |
remoteServiceManager
The http client
|
protected String |
serviceType
The service type, used to look up remote implementations
|
| Modifier | Constructor and Description |
|---|---|
protected |
RemoteBase(String type)
Creates a remote implementation for the given type of service.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeConnection(org.apache.http.HttpResponse response)
Closes any http connections kept open by this http response.
|
protected org.apache.http.HttpResponse |
getResponse(org.apache.http.client.methods.HttpRequestBase httpRequest)
Makes a request to all available remote services and returns the response as soon as the first of them returns the
HttpStatus.SC_OK as the status code. |
protected org.apache.http.HttpResponse |
getResponse(org.apache.http.client.methods.HttpRequestBase httpRequest,
Integer... expectedHttpStatus)
Makes a request to all available remote services and returns the response as soon as the first of them returns the
expected http status code.
|
protected <A> Option<A> |
runRequest(org.apache.http.client.methods.HttpRequestBase req,
Function<org.apache.http.HttpResponse,A> f) |
void |
setRemoteServiceManager(ServiceRegistry remoteServiceManager)
Sets the remote service manager.
|
void |
setTrustedHttpClient(TrustedHttpClient client)
Sets the trusted http client
|
protected String serviceType
protected TrustedHttpClient client
protected ServiceRegistry remoteServiceManager
public static final Function<org.apache.http.HttpResponse,Option<List<MediaPackageElement>>> elementsFromHttpResponse
protected RemoteBase(String type)
type - the service typepublic void setTrustedHttpClient(TrustedHttpClient client)
client - public void setRemoteServiceManager(ServiceRegistry remoteServiceManager)
remoteServiceManager - protected <A> Option<A> runRequest(org.apache.http.client.methods.HttpRequestBase req, Function<org.apache.http.HttpResponse,A> f)
protected org.apache.http.HttpResponse getResponse(org.apache.http.client.methods.HttpRequestBase httpRequest)
HttpStatus.SC_OK as the status code.httpRequest - the http request. If the URI is specified, it should include only the path beyond the service endpoint.
For example, a request intended for http://{host}/{service}/extra/path/info.xml should include the URI
"/extra/path/info.xml".protected org.apache.http.HttpResponse getResponse(org.apache.http.client.methods.HttpRequestBase httpRequest,
Integer... expectedHttpStatus)
httpRequest - the http request. If the URI is specified, it should include only the path beyond the service endpoint.
For example, a request intended for http://{host}/{service}/extra/path/info.xml should include the URI
"/extra/path/info.xml".expectedHttpStatus - any expected status codes to include in the return.protected void closeConnection(org.apache.http.HttpResponse response)
Copyright © 2009–2021 Opencast Project. All rights reserved.