/** * Sends the result of a someWPVService.doService( request ) bacn to the client * * @param httpResponse the response object used to pipe the result * @param getViewResponse the actua result to be sent */ private void sendGetViewResponse( HttpServletResponse httpResponse, GetViewResponse getViewResponse) { LOG.entering(); String mime = MimeTypeMapper.toMimeType(getViewResponse.getOutputFormat()); httpResponse.setContentType(mime); // GetView response is, for the time being, always an image writeImage((Image) getViewResponse.getOutput(), httpResponse, mime); LOG.exiting(); }
// TODO common to WMS private void sendExceptionImage( HttpServletResponse httpResponse, OGCWebServiceException e, GetView request) { Dimension d = request.getImageDimension(); BufferedImage bi = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB); Graphics g = bi.getGraphics(); g.setColor(Color.WHITE); g.fillRect(0, 0, d.width, d.height); g.setColor(Color.BLUE); String s = e.getLocator(); String location = s != null ? s : "Unknown"; s = e.getMessage(); String message = s != null ? s : "Unknown reason!"; g.drawString(location, 5, 20); g.drawString(message, 15, 50); String mime = MimeTypeMapper.toMimeType(request.getOutputFormat()); g.dispose(); writeImage(bi, mime, httpResponse); }