Java Doc for SimpleHttpInvokerRequestExecutor.java in  » J2EE » spring-framework-2.0.6 » org » springframework » remoting » httpinvoker » 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 » J2EE » spring framework 2.0.6 » org.springframework.remoting.httpinvoker 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
      org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor

SimpleHttpInvokerRequestExecutor
public class SimpleHttpInvokerRequestExecutor extends AbstractHttpInvokerRequestExecutor (Code)
HttpInvokerRequestExecutor implementation that uses standard J2SE facilities to execute POST requests, without support for HTTP authentication or advanced configuration options.

Designed for easy subclassing, customizing specific template methods. However, consider CommonsHttpInvokerRequestExecutor for more sophisticated needs: The J2SE HttpURLConnection is rather limited in its capabilities.
author:
   Juergen Hoeller
since:
   1.1
See Also:   CommonsHttpInvokerRequestExecutor
See Also:   java.net.HttpURLConnection





Method Summary
protected  RemoteInvocationResultdoExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
     Execute the given request through a standard J2SE HttpURLConnection.
protected  booleanisGzipResponse(HttpURLConnection con)
     Determine whether the given response is a GZIP response.
protected  HttpURLConnectionopenConnection(HttpInvokerClientConfiguration config)
     Open an HttpURLConnection for the given remote invocation request.
protected  voidprepareConnection(HttpURLConnection con, int contentLength)
     Prepare the given HTTP connection.
protected  InputStreamreadResponseBody(HttpInvokerClientConfiguration config, HttpURLConnection con)
     Extract the response body from the given executed remote invocation request.

The default implementation simply reads the serialized invocation from the HttpURLConnection's InputStream.

protected  voidvalidateResponse(HttpInvokerClientConfiguration config, HttpURLConnection con)
     Validate the given response as contained in the HttpURLConnection object, throwing an exception if it does not correspond to a successful HTTP response.
protected  voidwriteRequestBody(HttpInvokerClientConfiguration config, HttpURLConnection con, ByteArrayOutputStream baos)
     Set the given serialized remote invocation as request body.

The default implementation simply write the serialized invocation to the HttpURLConnection's OutputStream.




Method Detail
doExecuteRequest
protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws IOException, ClassNotFoundException(Code)
Execute the given request through a standard J2SE HttpURLConnection.

This method implements the basic processing workflow: The actual work happens in this class's template methods.
See Also:   SimpleHttpInvokerRequestExecutor.openConnection
See Also:   SimpleHttpInvokerRequestExecutor.prepareConnection
See Also:   SimpleHttpInvokerRequestExecutor.writeRequestBody
See Also:   SimpleHttpInvokerRequestExecutor.validateResponse
See Also:   SimpleHttpInvokerRequestExecutor.readResponseBody




isGzipResponse
protected boolean isGzipResponse(HttpURLConnection con)(Code)
Determine whether the given response is a GZIP response.

Default implementation checks whether the HTTP "Content-Encoding" header contains "gzip" (in any casing).
Parameters:
  con - the HttpURLConnection to check




openConnection
protected HttpURLConnection openConnection(HttpInvokerClientConfiguration config) throws IOException(Code)
Open an HttpURLConnection for the given remote invocation request.
Parameters:
  config - the HTTP invoker configuration that specifies thetarget service the HttpURLConnection for the given request
throws:
  IOException - if thrown by I/O methods
See Also:   java.net.URL.openConnection



prepareConnection
protected void prepareConnection(HttpURLConnection con, int contentLength) throws IOException(Code)
Prepare the given HTTP connection.

The default implementation specifies POST as method, "application/x-java-serialized-object" as "Content-Type" header, and the given content length as "Content-Length" header.
Parameters:
  con - the HTTP connection to prepare
Parameters:
  contentLength - the length of the content to send
throws:
  IOException - if thrown by HttpURLConnection methods
See Also:   java.net.HttpURLConnection.setRequestMethod
See Also:   java.net.HttpURLConnection.setRequestProperty




readResponseBody
protected InputStream readResponseBody(HttpInvokerClientConfiguration config, HttpURLConnection con) throws IOException(Code)
Extract the response body from the given executed remote invocation request.

The default implementation simply reads the serialized invocation from the HttpURLConnection's InputStream. If the response is recognized as GZIP response, the InputStream will get wrapped in a GZIPInputStream.
Parameters:
  config - the HTTP invoker configuration that specifies the target service
Parameters:
  con - the HttpURLConnection to read the response body from an InputStream for the response body
throws:
  IOException - if thrown by I/O methods
See Also:   SimpleHttpInvokerRequestExecutor.isGzipResponse
See Also:   java.util.zip.GZIPInputStream
See Also:   java.net.HttpURLConnection.getInputStream
See Also:   java.net.HttpURLConnection.getHeaderField(int)
See Also:   java.net.HttpURLConnection.getHeaderFieldKey(int)




validateResponse
protected void validateResponse(HttpInvokerClientConfiguration config, HttpURLConnection con) throws IOException(Code)
Validate the given response as contained in the HttpURLConnection object, throwing an exception if it does not correspond to a successful HTTP response.

Default implementation rejects any HTTP status code beyond 2xx, to avoid parsing the response body and trying to deserialize from a corrupted stream.
Parameters:
  config - the HTTP invoker configuration that specifies the target service
Parameters:
  con - the HttpURLConnection to validate
throws:
  IOException - if validation failed
See Also:   java.net.HttpURLConnection.getResponseCode




writeRequestBody
protected void writeRequestBody(HttpInvokerClientConfiguration config, HttpURLConnection con, ByteArrayOutputStream baos) throws IOException(Code)
Set the given serialized remote invocation as request body.

The default implementation simply write the serialized invocation to the HttpURLConnection's OutputStream. This can be overridden, for example, to write a specific encoding and potentially set appropriate HTTP request headers.
Parameters:
  config - the HTTP invoker configuration that specifies the target service
Parameters:
  con - the HttpURLConnection to write the request body to
Parameters:
  baos - the ByteArrayOutputStream that contains the serializedRemoteInvocation object
throws:
  IOException - if thrown by I/O methods
See Also:   java.net.HttpURLConnection.getOutputStream
See Also:   java.net.HttpURLConnection.setRequestProperty




Fields inherited from org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
final public static String CONTENT_TYPE_SERIALIZED_OBJECT(Code)(Java Doc)
final protected static String ENCODING_GZIP(Code)(Java Doc)
final protected static String HTTP_HEADER_ACCEPT_ENCODING(Code)(Java Doc)
final protected static String HTTP_HEADER_CONTENT_ENCODING(Code)(Java Doc)
final protected static String HTTP_HEADER_CONTENT_LENGTH(Code)(Java Doc)
final protected static String HTTP_HEADER_CONTENT_TYPE(Code)(Java Doc)
final protected static String HTTP_METHOD_POST(Code)(Java Doc)
final protected Log logger(Code)(Java Doc)

Methods inherited from org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor
protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException(Code)(Java Doc)
protected InputStream decorateInputStream(InputStream is) throws IOException(Code)(Java Doc)
protected OutputStream decorateOutputStream(OutputStream os) throws IOException(Code)(Java Doc)
abstract protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws Exception(Code)(Java Doc)
protected RemoteInvocationResult doReadRemoteInvocationResult(ObjectInputStream ois) throws IOException, ClassNotFoundException(Code)(Java Doc)
protected void doWriteRemoteInvocation(RemoteInvocation invocation, ObjectOutputStream oos) throws IOException(Code)(Java Doc)
final public RemoteInvocationResult executeRequest(HttpInvokerClientConfiguration config, RemoteInvocation invocation) throws Exception(Code)(Java Doc)
protected ClassLoader getBeanClassLoader()(Code)(Java Doc)
protected ByteArrayOutputStream getByteArrayOutputStream(RemoteInvocation invocation) throws IOException(Code)(Java Doc)
public String getContentType()(Code)(Java Doc)
public boolean isAcceptGzipEncoding()(Code)(Java Doc)
protected RemoteInvocationResult readRemoteInvocationResult(InputStream is, String codebaseUrl) throws IOException, ClassNotFoundException(Code)(Java Doc)
public void setAcceptGzipEncoding(boolean acceptGzipEncoding)(Code)(Java Doc)
public void setBeanClassLoader(ClassLoader classLoader)(Code)(Java Doc)
public void setContentType(String contentType)(Code)(Java Doc)
protected void writeRemoteInvocation(RemoteInvocation invocation, OutputStream os) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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