Java Doc for CommonsHttpInvokerRequestExecutor.java in  » J2EE » spring-framework-2.5 » 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.5 » 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.CommonsHttpInvokerRequestExecutor

CommonsHttpInvokerRequestExecutor
public class CommonsHttpInvokerRequestExecutor extends AbstractHttpInvokerRequestExecutor (Code)
HttpInvokerRequestExecutor implementation that uses Jakarta Commons HttpClient to execute POST requests. Requires Commons HttpClient 3.0 or higher.

Allows to use a pre-configured org.apache.commons.httpclient.HttpClient instance, potentially with authentication, HTTP connection pooling, etc. Also designed for easy subclassing, providing specific template methods.
author:
   Juergen Hoeller
author:
   Mark Fisher
since:
   1.1
See Also:   SimpleHttpInvokerRequestExecutor




Constructor Summary
public  CommonsHttpInvokerRequestExecutor()
     Create a new CommonsHttpInvokerRequestExecutor with a default HttpClient that uses a default MultiThreadedHttpConnectionManager.
public  CommonsHttpInvokerRequestExecutor(HttpClient httpClient)
     Create a new CommonsHttpInvokerRequestExecutor with the given HttpClient instance.

Method Summary
protected  PostMethodcreatePostMethod(HttpInvokerClientConfiguration config)
     Create a PostMethod for the given configuration.
protected  RemoteInvocationResultdoExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
     Execute the given request through Commons HttpClient.
protected  voidexecutePostMethod(HttpInvokerClientConfiguration config, HttpClient httpClient, PostMethod postMethod)
     Execute the given PostMethod instance.
public  HttpClientgetHttpClient()
     Return the HttpClient instance that this request executor uses.
protected  InputStreamgetResponseBody(HttpInvokerClientConfiguration config, PostMethod postMethod)
     Extract the response body from the given executed remote invocation request.

The default implementation simply fetches the PostMethod's response body stream.

protected  booleanisGzipResponse(PostMethod postMethod)
     Determine whether the given response indicates a GZIP response.
public  voidsetHttpClient(HttpClient httpClient)
     Set the HttpClient instance to use for this request executor.
public  voidsetReadTimeout(int timeout)
     Set the socket read timeout for the underlying HttpClient.
protected  voidsetRequestBody(HttpInvokerClientConfiguration config, PostMethod postMethod, ByteArrayOutputStream baos)
     Set the given serialized remote invocation as request body.

The default implementation simply sets the serialized invocation as the PostMethod's request body.

protected  voidvalidateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod)
     Validate the given response as contained in the PostMethod object, throwing an exception if it does not correspond to a successful HTTP response.


Constructor Detail
CommonsHttpInvokerRequestExecutor
public CommonsHttpInvokerRequestExecutor()(Code)
Create a new CommonsHttpInvokerRequestExecutor with a default HttpClient that uses a default MultiThreadedHttpConnectionManager. Sets the socket read timeout to CommonsHttpInvokerRequestExecutor.DEFAULT_READ_TIMEOUT_MILLISECONDS .
See Also:   org.apache.commons.httpclient.HttpClient
See Also:   org.apache.commons.httpclient.MultiThreadedHttpConnectionManager



CommonsHttpInvokerRequestExecutor
public CommonsHttpInvokerRequestExecutor(HttpClient httpClient)(Code)
Create a new CommonsHttpInvokerRequestExecutor with the given HttpClient instance. The socket read timeout of the provided HttpClient will not be changed.
Parameters:
  httpClient - the HttpClient instance to use for this request executor




Method Detail
createPostMethod
protected PostMethod createPostMethod(HttpInvokerClientConfiguration config) throws IOException(Code)
Create a PostMethod for the given configuration.

The default implementation creates a standard PostMethod with "application/x-java-serialized-object" as "Content-Type" header.
Parameters:
  config - the HTTP invoker configuration that specifies thetarget service the PostMethod instance
throws:
  IOException - if thrown by I/O methods




doExecuteRequest
protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws IOException, ClassNotFoundException(Code)
Execute the given request through Commons HttpClient.

This method implements the basic processing workflow: The actual work happens in this class's template methods.
See Also:   CommonsHttpInvokerRequestExecutor.createPostMethod
See Also:   CommonsHttpInvokerRequestExecutor.setRequestBody
See Also:   CommonsHttpInvokerRequestExecutor.executePostMethod
See Also:   CommonsHttpInvokerRequestExecutor.validateResponse
See Also:   CommonsHttpInvokerRequestExecutor.getResponseBody




executePostMethod
protected void executePostMethod(HttpInvokerClientConfiguration config, HttpClient httpClient, PostMethod postMethod) throws IOException(Code)
Execute the given PostMethod instance.
Parameters:
  config - the HTTP invoker configuration that specifies the target service
Parameters:
  httpClient - the HttpClient to execute on
Parameters:
  postMethod - the PostMethod to execute
throws:
  IOException - if thrown by I/O methods
See Also:   org.apache.commons.httpclient.HttpClient.executeMethod(org.apache.commons.httpclient.HttpMethod)



getHttpClient
public HttpClient getHttpClient()(Code)
Return the HttpClient instance that this request executor uses.



getResponseBody
protected InputStream getResponseBody(HttpInvokerClientConfiguration config, PostMethod postMethod) throws IOException(Code)
Extract the response body from the given executed remote invocation request.

The default implementation simply fetches the PostMethod's response body stream. 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:
  postMethod - the PostMethod to read the response body from an InputStream for the response body
throws:
  IOException - if thrown by I/O methods
See Also:   CommonsHttpInvokerRequestExecutor.isGzipResponse
See Also:   java.util.zip.GZIPInputStream
See Also:   org.apache.commons.httpclient.methods.PostMethod.getResponseBodyAsStream
See Also:   org.apache.commons.httpclient.methods.PostMethod.getResponseHeader(String)




isGzipResponse
protected boolean isGzipResponse(PostMethod postMethod)(Code)
Determine whether the given response indicates a GZIP response.

Default implementation checks whether the HTTP "Content-Encoding" header contains "gzip" (in any casing).
Parameters:
  postMethod - the PostMethod to check whether the given response indicates a GZIP response




setHttpClient
public void setHttpClient(HttpClient httpClient)(Code)
Set the HttpClient instance to use for this request executor.



setReadTimeout
public void setReadTimeout(int timeout)(Code)
Set the socket read timeout for the underlying HttpClient. A value of 0 means never timeout.
Parameters:
  timeout - the timeout value in milliseconds
See Also:   org.apache.commons.httpclient.params.HttpConnectionManagerParams.setSoTimeout(int)
See Also:   CommonsHttpInvokerRequestExecutor.DEFAULT_READ_TIMEOUT_MILLISECONDS



setRequestBody
protected void setRequestBody(HttpInvokerClientConfiguration config, PostMethod postMethod, ByteArrayOutputStream baos) throws IOException(Code)
Set the given serialized remote invocation as request body.

The default implementation simply sets the serialized invocation as the PostMethod's request body. 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:
  postMethod - the PostMethod to set the request body on
Parameters:
  baos - the ByteArrayOutputStream that contains the serializedRemoteInvocation object
throws:
  IOException - if thrown by I/O methods
See Also:   org.apache.commons.httpclient.methods.PostMethod.setRequestBody(java.io.InputStream)
See Also:   org.apache.commons.httpclient.methods.PostMethod.setRequestEntity
See Also:   org.apache.commons.httpclient.methods.InputStreamRequestEntity




validateResponse
protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod) throws IOException(Code)
Validate the given response as contained in the PostMethod 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:
  postMethod - the executed PostMethod to validate
throws:
  IOException - if validation failed
See Also:   org.apache.commons.httpclient.methods.PostMethod.getStatusCode
See Also:   org.apache.commons.httpclient.HttpException




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.