private <T> String logResponseContent(HTTPResponseAdapter<T> response, InputStream input) { try { input.reset(); input = new ContentEncodingStreamFactory().createFor(input, response.getHeaderValue(HTTPHeader.CONTENT_ENCODING.getName())); String body = new StringHTTPContentReader().readRawResponse(response, input); LOG.warn("error [{}] during reading http content of url ({}): <{}>", response.getStatus() != null ? response.getStatus().getCode() : -1, response.getEndpoint(), body); return body; } catch (Exception ex) { // ignore return ""; } }
lRes.addAttribute(new SimpleTransferAttribute(TransferAttribute.RESPONSE_STATUS_CODE, String.valueOf(httpResponse.getStatus().getCode())));
responseTransferable.addAttribute(new SimpleTransferAttribute(TransferAttribute.RESPONSE_STATUS_CODE, String.valueOf(statusCode.getCode())));
/** * Performs the service request "CloseSession". * * @throws ClientException if something went wrong during the request * @throws org.n52.security.common.artifact.ServiceException if the response is of MIME type * <code>application/vnd.ogc.se_xml */ public void closeSession(String version, String sessionID) throws ClientException, ServiceException { HTTPRequest httpRequest = httpClientFactory.create(getWssURLString()).get(); httpRequest.parameter("VERSION", version, "SESSIONID", sessionID, "SERVICE", "WSS", "REQUEST", "CloseSession"); HTTPResponse<InputStream> httpResponse = httpRequest.asStream().start(); if (httpResponse.isError()) { LOG.error("", httpResponse.getError()); throw new ClientException("I/O exception during CLOSESESSION request to Security Service:\n" + httpResponse.getStatus().getCode() + ": " + ((httpResponse.getError() != null) ? httpResponse.getError().getMessage() : " no exception available")); } }
public Document build() throws WebServiceDescriptionException { requestParameters = requestParameters == null ? new String[0] : requestParameters; HTTPRequest httpRequest = httpClientFactory.create(url).get(); HTTPResponse<InputStream> responseStream = httpRequest.parameter(requestParameters).asStream().start(); if (isInvalidResponse(responseStream)) { LOG.warn("Could not read capabilities from {}" + url); LOG.warn("Http response status code is {}", responseStream.getStatus().getCode()); throw new WebServiceDescriptionException("Could not read capabilities from " + url); } try { response = DOMUtil.createFromStream(responseStream.getContent(), DOMParserOptions.getDefault().expandEntityReferences()); } catch(Exception e) { throw new WebServiceDescriptionException("Could not parse capabilities document: " + e.getMessage()); }finally { requestParameters = null; // reset parameters } if (asIsoDocument) { return buildIsoDocument(); } return response; }
throw new DecisionProcessingException("PDP Service returned fault (httpcode:" + httpResponse.getStatus().getCode() + " msg:" + msg);
LOG.error("Cannot resolve session id <" + domainCookie.getSessionId() + ">", exc); if (exc.getCause() instanceof HTTPException){ LOG.error("Remote session server responded with HTTP status code "+((HTTPException)exc.getCause()).getStatusCode().getCode());