Example usage for org.springframework.web.servlet ModelAndView toString

List of usage examples for org.springframework.web.servlet ModelAndView toString

Introduction

In this page you can find the example usage for org.springframework.web.servlet ModelAndView toString.

Prototype

@Override
public String toString() 

Source Link

Document

Return diagnostic information about this model and view.

Usage

From source file:org.n52.sps.control.xml.XmlController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView handleGETRequest(@RequestParam Map<String, String> parameters,
        HttpServletResponse response) {//  w  w w  . jav  a 2  s  . co  m
    ModelAndView mav = new ModelAndView("xmlview", "response", null);
    OwsExceptionReport exceptionReport = new OwsExceptionReport();
    try {
        KeyValuePairsWrapper kvpParser = new KeyValuePairsWrapper(parameters);
        RequestDelegationHandler handler = new KeyValuePairsDelegate(service, kvpParser);
        mav.addObject(handler.delegate());
        response.setStatus(HttpStatus.OK.value());
    } catch (OwsException e) {
        // REQ 2: http://www.opengis.net/spec/SPS/2.0/req/exceptions
        LOGGER.info("Could not handle KVP request.", e);
        exceptionReport.addOwsException(e);
    } catch (OwsExceptionReport e) {
        LOGGER.info("Could not handle KVP request.", e);
        exceptionReport = e;
    } catch (Throwable e) {
        // TODO extract to Spring ExceptionHandler
        LOGGER.error("Internal exception occured!", e);
        exceptionReport.addOwsException(new NoApplicableCodeException(OwsException.INTERNAL_SERVER_ERROR));
    }
    handleServiceExceptionReport(response, mav, exceptionReport);
    LOGGER.debug(mav.toString());
    return mav;
}

From source file:org.n52.sps.control.xml.XmlController.java

@RequestMapping(method = RequestMethod.POST /*, headers = "content-type=application/xml; text/xml"*/)
public ModelAndView handlePOSTRequest(InputStream payload, HttpServletResponse response,
        HttpServletRequest request) throws OwsException {
    ModelAndView mav = new ModelAndView("xmlview", "response", null);
    OwsExceptionReport exceptionReport = new OwsExceptionReport();
    try {//from   w  w  w . ja  v a2  s .  co m
        XmlObject xmlPayload = parseIncomingXmlObject(payload);
        RequestDelegationHandler requestHandler = createRequestHandler(xmlPayload);
        mav.addObject(requestHandler.delegate());
        response.setStatus(HttpStatus.OK.value());
    } catch (XmlException e) {
        LOGGER.error("Could not parse request.", e);
        exceptionReport.addOwsException(new InvalidRequestException(e.getMessage()));
    } catch (IOException e) {
        LOGGER.error("Could not read request.", e);
        int code = HttpStatus.INTERNAL_SERVER_ERROR.value();
        exceptionReport.addOwsException(new NoApplicableCodeException(code));
    } catch (OwsException e) {
        // REQ 2: http://www.opengis.net/spec/SPS/2.0/req/exceptions
        LOGGER.info("Could not handle POST request.", e);
        exceptionReport.addOwsException(e);
    } catch (OwsExceptionReport e) {
        LOGGER.info("Could not handle POST request.", e);
        exceptionReport = e;
    } catch (Throwable e) {
        // TODO extract to Spring ExceptionHandler
        LOGGER.error("Unknown exception occured!", e);
        exceptionReport.addOwsException(new NoApplicableCodeException(OwsException.INTERNAL_SERVER_ERROR));
    }
    handleServiceExceptionReport(response, mav, exceptionReport);
    LOGGER.debug(mav.toString());
    return mav;
}