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
78 @Override
79 public String getResponseCharSet()
80 {
81 return httpMethodSupport.getResponseCharset();
82 }
83
84 public long getMaxSize()
85 {
86 return httpMethodSupport.getMaxSize();
87 }
88
89 public void setMaxSize( long maxSize )
90 {
91 httpMethodSupport.setMaxSize( maxSize );
92 }
93
94 public long getResponseReadTime()
95 {
96 return httpMethodSupport.getResponseReadTime();
97 }
98
99 protected void writeRequest( HttpState arg0, HttpConnection arg1 ) throws IOException, HttpException
100 {
101 super.writeRequest( arg0, arg1 );
102 httpMethodSupport.afterWriteRequest( arg0, arg1 );
103 }
104
105 public void initStartTime()
106 {
107 httpMethodSupport.initStartTime();
108 }
109
110 public long getTimeTaken()
111 {
112 return httpMethodSupport.getTimeTaken();
113 }
114
115 public long getStartTime()
116 {
117 return httpMethodSupport.getStartTime();
118 }
119
120 public byte[] getResponseBody() throws IOException
121 {
122 return httpMethodSupport.getResponseBody();
123 }
124
125 public SSLInfo getSSLInfo()
126 {
127 return httpMethodSupport.getSSLInfo();
128 }
129
130 public String getResponseContentType()
131 {
132 return httpMethodSupport.getResponseContentType();
133 }
134
135 public RestRequestInterface.RequestMethod getMethod()
136 {
137 return RestRequestInterface.RequestMethod.PUT;
138 }
139
140 public Throwable getFailureCause()
141 {
142 return httpMethodSupport.getFailureCause();
143 }
144
145 public boolean isFailed()
146 {
147 return httpMethodSupport.isFailed();
148 }
149
150 public void setFailed( Throwable t )
151 {
152 httpMethodSupport.setFailed( t );
153 }
154 }