use of org.teleal.cling.model.message.UpnpRequest in project openhab1-addons by openhab.
the class StreamClientImpl method sendRequest.
@Override
public StreamResponseMessage sendRequest(StreamRequestMessage requestMessage) {
final UpnpRequest requestOperation = requestMessage.getOperation();
log.fine("Preparing HTTP request message with method '" + requestOperation.getHttpMethodName() + "': " + requestMessage);
try {
// Create the right HTTP request
HttpUriRequest httpRequest = createHttpRequest(requestMessage, requestOperation);
// Set all the headers on the request
httpRequest.setParams(getRequestParams(requestMessage));
HeaderUtil.add(httpRequest, requestMessage.getHeaders());
log.fine("Sending HTTP request: " + httpRequest.getURI());
return httpClient.execute(httpRequest, createResponseHandler());
} catch (MethodNotSupportedException ex) {
log.warning("Request aborted: " + ex.toString());
return null;
} catch (ClientProtocolException ex) {
log.warning("HTTP protocol exception executing request: " + requestMessage);
log.warning("Cause: " + Exceptions.unwrap(ex));
return null;
} catch (IOException ex) {
// Don't log stacktrace
log.fine("Client connection was aborted: " + ex.getMessage());
return null;
}
}
Aggregations