use of org.n52.iceland.exception.HTTPException in project arctic-sea by 52North.
the class SimpleBinding method writeOwsExceptionReport.
protected void writeOwsExceptionReport(HttpServletRequest request, HttpServletResponse response, OwsExceptionReport oer) throws HTTPException {
try {
this.eventBus.submit(new ExceptionEvent(oer));
MediaType contentType = chooseResponseContentTypeForExceptionReport(HTTPHeaders.getAcceptHeader(request), getDefaultContentType());
Object encoded = encodeOwsExceptionReport(oer, contentType);
if (isUseHttpResponseCodes() && oer.hasStatus()) {
response.setStatus(oer.getStatus().getCode());
}
httpUtils.writeObject(request, response, contentType, encoded, this);
} catch (IOException | OwsExceptionReport e) {
throw new HTTPException(HTTPStatus.INTERNAL_SERVER_ERROR, e);
}
}
use of org.n52.iceland.exception.HTTPException in project arctic-sea by 52North.
the class JSONBinding method doPostOperation.
@Override
public void doPostOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
OwsServiceRequest request = null;
try {
request = parseRequest(req);
checkServiceOperatorKeyTypes(request);
OwsServiceResponse response = getServiceOperator(request).receiveRequest(request);
writeResponse(req, res, response);
} catch (OwsExceptionReport oer) {
oer.setVersion(request != null ? request.getVersion() : null);
LOG.warn("Unexpected error", oer);
writeOwsExceptionReport(req, res, oer);
}
}
use of org.n52.iceland.exception.HTTPException in project arctic-sea by 52North.
the class KvpBinding method doGetOperation.
@Override
public void doGetOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
LOGGER.debug("KVP-REQUEST: {}", req.getQueryString());
OwsServiceRequest serviceRequest = null;
try {
serviceRequest = parseRequest(req);
// add request context information
serviceRequest.setRequestContext(getRequestContext(req));
OwsServiceResponse response = getServiceOperator(serviceRequest).receiveRequest(serviceRequest);
writeResponse(req, res, response);
} catch (OwsExceptionReport oer) {
oer.setVersion(serviceRequest != null ? serviceRequest.getVersion() : null);
writeOwsExceptionReport(req, res, oer);
}
}
Aggregations