use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.
the class GenericRequestOperator method receiveRequest.
@Override
public OwsServiceResponse receiveRequest(final OwsServiceRequest abstractRequest) throws OwsExceptionReport {
this.eventBus.submit(new RequestEvent(abstractRequest));
if (requestType.isAssignableFrom(abstractRequest.getClass())) {
Q request = requestType.cast(abstractRequest);
checkForModifierAndProcess(request);
this.validator.validate(request);
A response = receive(request);
this.eventBus.submit(new ResponseEvent(response));
checkForModifierAndProcess(request, response);
return response;
} else {
throw new OperationNotSupportedException(abstractRequest.getOperationName());
}
}
use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.
the class SimpleBinding method encodeResponse.
protected Object encodeResponse(OwsServiceResponse response, MediaType contentType) throws OwsExceptionReport {
try {
OperationResponseEncoderKey key = new OperationResponseEncoderKey(new OwsOperationKey(response), contentType);
Encoder<Object, OwsServiceResponse> encoder = getEncoder(key);
if (encoder == null) {
throw new NoEncoderForKeyException(key);
}
return encoder.encode(response);
} catch (EncodingException ex) {
throw new NoApplicableCodeException().withMessage(ex.getMessage()).causedBy(ex);
}
}
use of org.n52.shetland.ogc.ows.service.OwsServiceResponse 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.shetland.ogc.ows.service.OwsServiceResponse 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);
}
}
use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.
the class AbstractSoapEncoder method getBodyContent.
/**
* Get the content for the SOAPBody as {@link XmlObject}
*
* @param response SOAP response
*
* @return SOAPBody content as {@link XmlObject}
*
* @throws EncodingException If no encoder is available, the object to encode is not supported or an error occurs
* during the encoding
*/
protected XmlObject getBodyContent(SoapResponse response) throws EncodingException {
OperationResponseEncoderKey key = new OperationResponseEncoderKey(new OwsOperationKey(response.getBodyContent()), MediaTypes.APPLICATION_XML);
Encoder<Object, OwsServiceResponse> encoder = getEncoder(key);
if (encoder == null) {
throw new NoEncoderForKeyException(key);
}
return (XmlObject) encoder.encode(response.getBodyContent());
}
Aggregations