Java Doc for Response.java in  » GIS » GeoServer » org » vfny » geoserver » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoServer » org.vfny.geoserver 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.vfny.geoserver.Response

All known Subclasses:   org.vfny.geoserver.wms.responses.GetLegendGraphicResponse,  org.vfny.geoserver.wms.responses.featureInfo.GetFeatureInfoDelegate,  org.vfny.geoserver.wms.responses.GetMapResponse,  org.vfny.geoserver.wcs.responses.WCSCapabilitiesResponse,  org.vfny.geoserver.sld.responses.PutStylesResponse,  org.vfny.geoserver.wms.responses.DescribeLayerResponse,  org.vfny.geoserver.wms.responses.WMSCapabilitiesResponse,  org.vfny.geoserver.wcs.responses.CoverageResponse,  org.vfny.geoserver.wms.responses.GetFeatureInfoResponse,  org.vfny.geoserver.wcs.responses.DescribeResponse,
Response
public interface Response (Code)
The Response interface serves as a common denominator for all service operations that generates content.

The work flow for this kind of objects is divided in two parts: the first is executing a request and the second writing the result to an OuputStream.

  1. Execute: execute(Request)
    • Executing the request means taking a Request object and, based on it's set of request parameters, do any heavy processing necessary to produce the response.
    • Once the execution has been made, the Response object should be ready to send the response content to an output stream with minimal risk of generating an exception.
    • Anyway, it is not required, even recomended, that the execution process generates the response content itself; just that it performs any query or processing that should generate a trapable error.
    • Execute may throw a ServiceException if they wish to supply a specific response in error. As an example the WFSTransaction process has a defined Transaction Document with provisions for reporting error information.
  2. ContentType: getContentType()
    • Called to set the response type. Depending on the stratagy used by AbstractService the framework may be commited to returning this type.
  3. Writing: writeTo(OutputStream)
    • Write the response to the provided output stream.
    • Any exceptions thrown by this writeTo method may never reach the end user in useable form. You should assume you are writing directly to the client.

Note: abort() will be called as part of error handling giving your response subclass a chance to clean up any temporary resources it may have required in execute() for use in writeTo().

This is specially usefull for streamed responses such as wfs GetFeature or WMS GetMap, where the execution process can be used to parse parameters, execute queries upon the corresponding data sources and leave things ready to generate a streamed response when the consumer calls writeTo.


author:
   Gabriel Rold?n
version:
   $Id: Response.java 6326 2007-03-15 18:36:40Z jdeolive $




Method Summary
public  voidabort(Service gs)
     Called when things go horriably wrong.

Used try and restore application state when things go wrong.

public  voidexecute(Request request)
     Excecutes a request.
public  StringgetContentDisposition()
    
public  StringgetContentEncoding()
    
public  StringgetContentType(GeoServer gs)
     MIME type of this Response - example "text/xml".

thinked to be called after excecute(), this method must return the MIME type of the response content that will be writen when writeTo were called

an implementation of this interface is required to throw an IllegalStateException if execute has not been called yet, to indicate that an inconsistence in the work flow that may result in an inconsistence between the response content and the content type declared for it, if such an implementation can return different contents based on the request that has originated it.

public  HashMapgetResponseHeaders()
     Returns any extra headers that this Response might wish to have set in the HTTP response object.
public  voidwriteTo(OutputStream out)
     Writes this respone to the provided output stream.

To implememt streaming, execution is sometimes delayed until the write opperation (for example of this see FeatureResponse).




Method Detail
abort
public void abort(Service gs)(Code)
Called when things go horriably wrong.

Used try and restore application state when things go wrong. This is called by AbstractAction to try and recover when sending out a ServiceException.

Allows a Response a chance to clean up after its self when AbstractionAction is error handling.




execute
public void execute(Request request) throws ServiceException(Code)
Excecutes a request. If this method finalizes without throwing an Exception, the Response instance should be ready to write the response content through the writeTo method with the minimal posible risk of failure other than not beeing able to write to the output stream due to external reassons

We should clarify when a ServiceException is thrown? I would assume that a "failed" request should still result in a Response that we could write out.


Parameters:
  request - a Request object that implementations should cast to it'sRequest specialization, wich must contain the parsed and readyto use parameters sent by the calling client. In general, such aRequest will be created by either a KVP or XML request reader;resulting in a Request object more usefull than a set of rawparameters, as can be the list of feature types requested as aset of FeatureTypeInfo objects rather than just a list of Stringtype names
throws:
  ServiceException -



getContentDisposition
public String getContentDisposition()(Code)
Returns any special content disposition this response will encode its contents to, such as "filename" and "attachement" the content disposition writeTo will encode with, or null if none



getContentEncoding
public String getContentEncoding()(Code)
Returns any special content encoding this response will encode its contents to, such as "gzip" or "deflate" the content encoding writeTo will encode with, or null if none



getContentType
public String getContentType(GeoServer gs) throws IllegalStateException(Code)
MIME type of this Response - example "text/xml".

thinked to be called after excecute(), this method must return the MIME type of the response content that will be writen when writeTo were called

an implementation of this interface is required to throw an IllegalStateException if execute has not been called yet, to indicate that an inconsistence in the work flow that may result in an inconsistence between the response content and the content type declared for it, if such an implementation can return different contents based on the request that has originated it. i.e. a WMS GetMap response will return different content encodings based on the FORMAT requested, so it would be impossible to it knowing the exact MIME response type if it has not processed the request yet.

There is some MIME stuff in JDK for reference:

  • java.awt.datatransfer package
  • javax.mail.internet
  • and a few other places as well.

the MIME type of the generated or ready to generate responsecontent
throws:
  IllegalStateException - if this method is called and execute hasnot been called yet



getResponseHeaders
public HashMap getResponseHeaders()(Code)
Returns any extra headers that this Response might wish to have set in the HTTP response object. In particular, a WMS might wish to have some external caching information added to the HTTP response, so that caches can hang onto this map for a while and ligten the load on geoserver.



writeTo
public void writeTo(OutputStream out) throws ServiceException, IOException(Code)
Writes this respone to the provided output stream.

To implememt streaming, execution is sometimes delayed until the write opperation (for example of this see FeatureResponse). Hopefully this is okay? GR:the idea for minimize risk error at writing time, is that execute performs any needed query/processing, leaving to this method just the risk of encountering an uncaught or IO exception. i.e. FeatureResponse should execute the queries inside the execute method, and have a set of FeatureReader's (or results) ready to be streamed here. This approach fits well with the Chirs' idea of configuring geoserver for speed or full conformance, wich ends in just writing directly to the http response output stream or to a ByteArrayOutputStream

JG: Consider using a Writer here? GR: I don't think so, because not all responses will be char sequences, such as an image in a WMS GetImage response.
Parameters:
  out -
throws:
  ServiceException - wrapping of any unchecked exception or otherpredictable exception except an IO error while writing toout
throws:
  IOException - ONLY if an error occurs trying to write content tothe passed OutputStream. By this way, we'll can control thevery common situation of a java.net.SocketException product ofthe client closing the connection (like a user pressing it'srefresh browser button many times)



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.