1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.submit.transports.http.support.methods;
14
15 import java.io.IOException;
16
17 import org.apache.commons.httpclient.HttpConnection;
18 import org.apache.commons.httpclient.HttpException;
19 import org.apache.commons.httpclient.HttpState;
20 import org.apache.commons.httpclient.methods.PutMethod;
21
22 import com.eviware.soapui.impl.rest.RestRequestInterface;
23 import com.eviware.soapui.impl.wsdl.submit.transports.http.ExtendedHttpMethod;
24 import com.eviware.soapui.impl.wsdl.submit.transports.http.HttpMethodSupport;
25 import com.eviware.soapui.impl.wsdl.submit.transports.http.SSLInfo;
26
27 /***
28 * Extended PostMethod that supports limiting of response size and detailed
29 * timestamps
30 *
31 * @author Ole.Matzura
32 */
33
34 public final class ExtendedPutMethod extends PutMethod implements ExtendedHttpMethod
35 {
36 private HttpMethodSupport httpMethodSupport;
37
38 public ExtendedPutMethod()
39 {
40 httpMethodSupport = new HttpMethodSupport( this );
41 }
42
43 public String getDumpFile()
44 {
45 return httpMethodSupport.getDumpFile();
46 }
47
48 public void setDumpFile( String dumpFile )
49 {
50 httpMethodSupport.setDumpFile( dumpFile );
51 }
52
53 public boolean hasResponse()
54 {
55 return httpMethodSupport.hasResponse();
56 }
57
58 protected void readResponse( HttpState arg0, HttpConnection arg1 ) throws IOException, HttpException
59 {
60 super.readResponse( arg0, arg1 );
61 httpMethodSupport.afterReadResponse( arg0, arg1 );
62 }
63
64 @Override
65 public String getResponseCharSet()
66 {
67 return httpMethodSupport.getResponseCharset();
68 }
69
70 public long getMaxSize()
71 {
72 return httpMethodSupport.getMaxSize();
73 }
74
75 public void setMaxSize( long maxSize )
76 {
77 httpMethodSupport.setMaxSize( maxSize );
78 }
79
80 public long getResponseReadTime()
81 {
82 return httpMethodSupport.getResponseReadTime();
83 }
84
85 protected void writeRequest( HttpState arg0, HttpConnection arg1 ) throws IOException, HttpException
86 {
87 super.writeRequest( arg0, arg1 );
88 httpMethodSupport.afterWriteRequest( arg0, arg1 );
89 }
90
91 public void initStartTime()
92 {
93 httpMethodSupport.initStartTime();
94 }
95
96 public long getTimeTaken()
97 {
98 return httpMethodSupport.getTimeTaken();
99 }
100
101 public long getStartTime()
102 {
103 return httpMethodSupport.getStartTime();
104 }
105
106 public byte[] getResponseBody() throws IOException
107 {
108 return httpMethodSupport.getResponseBody();
109 }
110
111 public SSLInfo getSSLInfo()
112 {
113 return httpMethodSupport.getSSLInfo();
114 }
115
116 public String getResponseContentType()
117 {
118 return httpMethodSupport.getResponseContentType();
119 }
120
121 public RestRequestInterface.RequestMethod getMethod()
122 {
123 return RestRequestInterface.RequestMethod.PUT;
124 }
125
126 public Throwable getFailureCause()
127 {
128 return httpMethodSupport.getFailureCause();
129 }
130
131 public boolean isFailed()
132 {
133 return httpMethodSupport.isFailed();
134 }
135
136 public void setFailed( Throwable t )
137 {
138 httpMethodSupport.setFailed( t );
139 }
140 }