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 com.eviware.soapui.impl.support.AbstractHttpRequest;
16 import com.eviware.soapui.impl.wsdl.submit.transports.http.ExtendedHttpMethod;
17 import com.eviware.soapui.impl.wsdl.submit.transports.http.HttpMethodSupport;
18 import com.eviware.soapui.impl.wsdl.submit.transports.http.SSLInfo;
19 import org.apache.commons.httpclient.HttpConnection;
20 import org.apache.commons.httpclient.HttpException;
21 import org.apache.commons.httpclient.HttpState;
22 import org.apache.commons.httpclient.methods.PutMethod;
23
24 import java.io.IOException;
25
26 /***
27 * Extended PostMethod that supports limiting of response size and detailed
28 * timestamps
29 *
30 * @author Ole.Matzura
31 */
32
33 public final class ExtendedPutMethod extends PutMethod implements ExtendedHttpMethod
34 {
35 private HttpMethodSupport httpMethodSupport;
36
37 public ExtendedPutMethod()
38 {
39 httpMethodSupport = new HttpMethodSupport( this );
40 }
41
42 public String getDumpFile()
43 {
44 return httpMethodSupport.getDumpFile();
45 }
46
47 public void setDumpFile(String dumpFile)
48 {
49 httpMethodSupport.setDumpFile(dumpFile);
50 }
51
52 protected void readResponse(HttpState arg0, HttpConnection arg1)
53 throws IOException, HttpException
54 {
55 super.readResponse(arg0, arg1);
56 httpMethodSupport.afterReadResponse(arg0, arg1);
57 }
58
59 public long getMaxSize()
60 {
61 return httpMethodSupport.getMaxSize();
62 }
63
64 public void setMaxSize(long maxSize)
65 {
66 httpMethodSupport.setMaxSize( maxSize );
67 }
68
69 public long getResponseReadTime()
70 {
71 return httpMethodSupport.getResponseReadTime();
72 }
73
74 protected void writeRequest(HttpState arg0, HttpConnection arg1)
75 throws IOException, HttpException
76 {
77 super.writeRequest(arg0, arg1);
78 httpMethodSupport.afterWriteRequest(arg0, arg1);
79 }
80
81 public void initStartTime()
82 {
83 httpMethodSupport.initStartTime();
84 }
85
86 public long getTimeTaken()
87 {
88 return httpMethodSupport.getTimeTaken();
89 }
90
91 public long getStartTime()
92 {
93 return httpMethodSupport.getStartTime();
94 }
95
96 public byte[] getResponseBody() throws IOException
97 {
98 return httpMethodSupport.getResponseBody();
99 }
100
101 public SSLInfo getSSLInfo()
102 {
103 return httpMethodSupport.getSSLInfo();
104 }
105
106 public String getResponseContentType()
107 {
108 return httpMethodSupport.getResponseContentType();
109 }
110
111 public AbstractHttpRequest.RequestMethod getMethod() {
112 return AbstractHttpRequest.RequestMethod.PUT;
113 }
114 }