Search in sources :

Example 1 with OwsServiceResponse

use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.

the class SimpleBinding method writeResponse.

protected void writeResponse(HttpServletRequest request, HttpServletResponse response, OwsServiceResponse serviceResponse) throws HTTPException, IOException {
    try {
        MediaType contentType = chooseResponseContentType(serviceResponse, HTTPHeaders.getAcceptHeader(request), getDefaultContentType());
        if (!serviceResponse.isSetContentType()) {
            serviceResponse.setContentType(contentType);
        }
        httpUtils.writeObject(request, response, contentType, serviceResponse, this);
    } finally {
        serviceResponse.close();
    }
}
Also used : MediaType(org.n52.janmayen.http.MediaType)

Example 2 with OwsServiceResponse

use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.

the class EXIBinding method doPostOperation.

@Override
public void doPostOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
    OwsServiceRequest sosRequest = null;
    try {
        sosRequest = parseRequest(req);
        OwsServiceResponse sosResponse = getServiceOperator(sosRequest).receiveRequest(sosRequest);
        writeResponse(req, res, sosResponse);
    } catch (OwsExceptionReport oer) {
        oer.setVersion(sosRequest != null ? sosRequest.getVersion() : null);
        writeOwsExceptionReport(req, res, oer);
    }
}
Also used : OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport)

Example 3 with OwsServiceResponse

use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.

the class PoxBinding method doPostOperation.

@Override
public void doPostOperation(HttpServletRequest req, HttpServletResponse res) throws HTTPException, IOException {
    OwsServiceRequest request = null;
    try {
        request = parseRequest(req);
        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);
    }
}
Also used : OwsServiceRequest(org.n52.shetland.ogc.ows.service.OwsServiceRequest) OwsServiceResponse(org.n52.shetland.ogc.ows.service.OwsServiceResponse) OwsExceptionReport(org.n52.shetland.ogc.ows.exception.OwsExceptionReport)

Example 4 with OwsServiceResponse

use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.

the class GenericRequestOperator method checkForModifierAndProcess.

private void checkForModifierAndProcess(OwsServiceRequest request, OwsServiceResponse response) throws OwsExceptionReport {
    if (!this.modifierRepository.hasRequestResponseModifier(request, response)) {
        return;
    }
    List<RequestResponseModifier> defaultModifier = new LinkedList<>();
    List<RequestResponseModifier> remover = new LinkedList<>();
    List<RequestResponseModifier> merger = new LinkedList<>();
    this.modifierRepository.getRequestResponseModifier(request, response).stream().forEach(modifier -> {
        if (modifier.getFacilitator().isMerger()) {
            merger.add(modifier);
        } else if (modifier.getFacilitator().isAdderRemover()) {
            remover.add(modifier);
        } else {
            defaultModifier.add(modifier);
        }
    });
    // execute merger
    for (RequestResponseModifier modifier : merger) {
        modifier.modifyResponse(request, response);
    }
    // execute default
    for (RequestResponseModifier modifier : defaultModifier) {
        modifier.modifyResponse(request, response);
    }
    // execute adder/remover
    for (RequestResponseModifier modifier : remover) {
        modifier.modifyResponse(request, response);
    }
}
Also used : RequestResponseModifier(org.n52.iceland.convert.RequestResponseModifier) LinkedList(java.util.LinkedList)

Example 5 with OwsServiceResponse

use of org.n52.shetland.ogc.ows.service.OwsServiceResponse in project arctic-sea by 52North.

the class SosDecoderv20 method parseGetResultResponse.

private OwsServiceResponse parseGetResultResponse(final GetResultResponseDocument getResultResponseDoc) throws DecodingException {
    final GetResultResponse sosGetResultResponse = new GetResultResponse();
    final GetResultResponseType getResultResponse = getResultResponseDoc.getGetResultResponse();
    final String resultValues = parseResultValues(getResultResponse.getResultValues());
    sosGetResultResponse.setResultValues(resultValues);
    return sosGetResultResponse;
}
Also used : GetResultResponseType(net.opengis.sos.x20.GetResultResponseType) GetResultResponse(org.n52.shetland.ogc.sos.response.GetResultResponse) XmlString(org.apache.xmlbeans.XmlString)

Aggregations

OwsServiceResponse (org.n52.shetland.ogc.ows.service.OwsServiceResponse)11 XmlObject (org.apache.xmlbeans.XmlObject)5 OwsExceptionReport (org.n52.shetland.ogc.ows.exception.OwsExceptionReport)4 OwsOperationKey (org.n52.shetland.ogc.ows.service.OwsOperationKey)4 OwsServiceRequest (org.n52.shetland.ogc.ows.service.OwsServiceRequest)4 NoEncoderForKeyException (org.n52.svalbard.encode.exception.NoEncoderForKeyException)3 OperationNotSupportedException (org.n52.shetland.ogc.ows.exception.OperationNotSupportedException)2 OperationResponseEncoderKey (org.n52.svalbard.encode.OperationResponseEncoderKey)2 EncodingException (org.n52.svalbard.encode.exception.EncodingException)2 IOException (java.io.IOException)1 LinkedList (java.util.LinkedList)1 GetResultResponseType (net.opengis.sos.x20.GetResultResponseType)1 GetResultTemplateResponseType (net.opengis.sos.x20.GetResultTemplateResponseType)1 XmlOptions (org.apache.xmlbeans.XmlOptions)1 XmlString (org.apache.xmlbeans.XmlString)1 OwsEncodingException (org.n52.iceland.coding.encode.OwsEncodingException)1 RequestResponseModifier (org.n52.iceland.convert.RequestResponseModifier)1 RequestEvent (org.n52.iceland.event.events.RequestEvent)1 ResponseEvent (org.n52.iceland.event.events.ResponseEvent)1 RequestOperator (org.n52.iceland.request.operator.RequestOperator)1