org.deegree.services
Class OWSResponse

java.lang.Object
  extended by org.deegree.services.OWSResponse

public class OWSResponse
extends Object

Sink for producing the HTTP response to an OWS request.

This is similar to HttpServletResponse, but reduces potential pitfalls and offers specific functionality that's common for OWS implementations.

Special functionality:

Version:
$Revision: 31688 $, $Date: 2011-08-30 15:05:12 +0200 (Tue, 30 Aug 2011) $
Author:
Rutger Bezema, Oliver Tonnhofer, Markus Schneider, last edited by: $Author: mschneider $

Constructor Summary
OWSResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Creates a new OWSResponse instance.
 
Method Summary
 void commit()
          Commits the response so it gets sent to the client.
 void disableBuffering()
          Disables buffering of the output.
 OutputStream getOutputStream(String contentType)
          Returns an OutputStream for writing a response.
 XMLStreamWriter getXMLWriter(String contentType)
          Returns an XMLStreamWriter for writing an XML response.
<T extends OWSException>
void
sendException(String contentType, Map<String,String> additionalHeaders, int httpStatusCode, ExceptionSerializer<T> serializer, T exception)
          Sends an OWSException to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OWSResponse

public OWSResponse(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws IOException
Creates a new OWSResponse instance.

Parameters:
request -
response -
Throws:
IOException
Method Detail

disableBuffering

public void disableBuffering()
Disables buffering of the output.

This method may only be called, if neither #getOutputStream(String)) nor #getXMLStream(String)) has been called before.


getOutputStream

public OutputStream getOutputStream(String contentType)
                             throws IOException
Returns an OutputStream for writing a response.

Parameters:
contentType - mime type of the response content, can be null
Returns:
Throws:
IOException
IllegalStateException

getXMLWriter

public XMLStreamWriter getXMLWriter(String contentType)
                             throws IOException,
                                    XMLStreamException
Returns an XMLStreamWriter for writing an XML response.

Parameters:
contentType - mime type of the response content, can be null
Returns:
Throws:
IOException
XMLStreamException
IllegalStateException

commit

public void commit()
            throws IOException
Commits the response so it gets sent to the client.

OWS implementation should never call this, as it is called by the OGCFrontController.

Throws:
IOException

sendException

public <T extends OWSException> void sendException(String contentType,
                                                   Map<String,String> additionalHeaders,
                                                   int httpStatusCode,
                                                   ExceptionSerializer<T> serializer,
                                                   T exception)
Sends an OWSException to the client.

Type Parameters:
T -
Parameters:
contentType -
encoding -
additionalHeaders -
httpStatusCode -
serializer -
exception -


Copyright © 2011. All Rights Reserved.