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 private boolean followRedirects;
38
39 public ExtendedPutMethod()
40 {
41 httpMethodSupport = new HttpMethodSupport( this );
42 }
43
44 public String getDumpFile()
45 {
46 return httpMethodSupport.getDumpFile();
47 }
48
49 public void setDumpFile( String dumpFile )
50 {
51 httpMethodSupport.setDumpFile( dumpFile );
52 }
53
54 public boolean hasResponse()
55 {
56 return httpMethodSupport.hasResponse();
57 }
58
59 protected void readResponse( HttpState arg0, HttpConnection arg1 ) throws IOException, HttpException
60 {
61 super.readResponse( arg0, arg1 );
62 httpMethodSupport.afterReadResponse( arg0, arg1 );
63 }
64
65 @Override
66 public boolean getFollowRedirects()
67 {
68 return followRedirects;
69 }
70
71 @Override
72 public void setFollowRedirects( boolean followRedirects )
73 {
74 this.followRedirects = followRedirects;
75 }
76
77 @Override
78 public String getResponseCharSet()
79 {
80 return httpMethodSupport.getResponseCharset();
81 }
82
83 public long getMaxSize()
84 {
85 return httpMethodSupport.getMaxSize();
86 }
87
88 public void setMaxSize( long maxSize )
89 {
90 httpMethodSupport.setMaxSize( maxSize );
91 }
92
93 public long getResponseReadTime()
94 {
95 return httpMethodSupport.getResponseReadTime();
96 }
97
98 protected void writeRequest( HttpState arg0, HttpConnection arg1 ) throws IOException, HttpException
99 {
100 super.writeRequest( arg0, arg1 );
101 httpMethodSupport.afterWriteRequest( arg0, arg1 );
102 }
103
104 public void initStartTime()
105 {
106 httpMethodSupport.initStartTime();
107 }
108
109 public long getTimeTaken()
110 {
111 return httpMethodSupport.getTimeTaken();
112 }
113
114 public long getStartTime()
115 {
116 return httpMethodSupport.getStartTime();
117 }
118
119 public byte[] getResponseBody() throws IOException
120 {
121 return httpMethodSupport.getResponseBody();
122 }
123
124 public SSLInfo getSSLInfo()
125 {
126 return httpMethodSupport.getSSLInfo();
127 }
128
129 public String getResponseContentType()
130 {
131 return httpMethodSupport.getResponseContentType();
132 }
133
134 public RestRequestInterface.RequestMethod getMethod()
135 {
136 return RestRequestInterface.RequestMethod.PUT;
137 }
138
139 public Throwable getFailureCause()
140 {
141 return httpMethodSupport.getFailureCause();
142 }
143
144 public boolean isFailed()
145 {
146 return httpMethodSupport.isFailed();
147 }
148
149 public void setFailed( Throwable t )
150 {
151 httpMethodSupport.setFailed( t );
152 }
153
154 public byte[] getDecompressedResponseBody() throws IOException
155 {
156 return httpMethodSupport.getDecompressedResponseBody();
157 }
158
159 public void setDecompress( boolean decompress )
160 {
161 httpMethodSupport.setDecompress( decompress );
162 }
163 }