}
return false;
}
protected void handleResponseInternal() throws IOException {
Exchange exchange = outMessage.getExchange();
int responseCode = getResponseCode();
if (responseCode == -1) {
LOG.warning("HTTP Response code appears to be corrupted");
}
if (exchange != null) {
exchange.put(Message.RESPONSE_CODE, responseCode);
}
// This property should be set in case the exceptions should not be handled here
// For example jax rs uses this
boolean noExceptions = MessageUtils.isTrue(outMessage.getContextualProperty(
"org.apache.cxf.transport.no_io_exceptions"));
if (responseCode >= 400 && responseCode != 500 && !noExceptions) {
if (responseCode == 404 || responseCode == 503) {
exchange.put("org.apache.cxf.transport.service_not_available", true);
}
throw new HTTPException(responseCode, getResponseMessage(), url.toURL());
}
InputStream in = null;
// oneway or decoupled twoway calls may expect HTTP 202 with no content
Message inMessage = new MessageImpl();
inMessage.setExchange(exchange);
updateResponseHeaders(inMessage);
inMessage.put(Message.RESPONSE_CODE, responseCode);
if (!doProcessResponse(outMessage, responseCode)
|| HttpURLConnection.HTTP_ACCEPTED == responseCode) {
in = getPartialResponse();
if (in == null
|| !MessageUtils.getContextualBoolean(outMessage, Message.PROCESS_ONEWAY_RESPONSE, false)) {
// oneway operation or decoupled MEP without
// partial response
closeInputStream();
if (isOneway(exchange) && responseCode > 300) {
throw new HTTPException(responseCode, getResponseMessage(), url.toURL());
}
ClientCallback cc = exchange.get(ClientCallback.class);
if (null != cc) {
//REVISIT move the decoupled destination property name into api
Endpoint ep = exchange.getEndpoint();
if (null != ep && null != ep.getEndpointInfo() && null == ep.getEndpointInfo().
getProperty("org.apache.cxf.ws.addressing.MAPAggregator.decoupledDestination")) {
cc.handleResponse(null, null);
}
}
exchange.setInMessage(inMessage);
return;
}
} else {
//not going to be resending or anything, clear out the stuff in the out message
//to free memory