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.HeadMethod;
21 import org.apache.commons.httpclient.methods.RequestEntity;
22
23 import com.eviware.soapui.impl.rest.RestRequestInterface;
24 import com.eviware.soapui.impl.wsdl.submit.transports.http.ExtendedHttpMethod;
25 import com.eviware.soapui.impl.wsdl.submit.transports.http.HttpMethodSupport;
26 import com.eviware.soapui.impl.wsdl.submit.transports.http.SSLInfo;
27
28 /***
29 * Extended PostMethod that supports limiting of response size and detailed
30 * timestamps
31 *
32 * @author Ole.Matzura
33 */
34
35 public final class ExtendedHeadMethod extends HeadMethod implements ExtendedHttpMethod
36 {
37 private HttpMethodSupport httpMethodSupport;
38
39 public ExtendedHeadMethod()
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 String getResponseCharSet()
67 {
68 return httpMethodSupport.getResponseCharset();
69 }
70
71 public long getMaxSize()
72 {
73 return httpMethodSupport.getMaxSize();
74 }
75
76 public void setMaxSize( long maxSize )
77 {
78 httpMethodSupport.setMaxSize( maxSize );
79 }
80
81 public long getResponseReadTime()
82 {
83 return httpMethodSupport.getResponseReadTime();
84 }
85
86 protected void writeRequest( HttpState arg0, HttpConnection arg1 ) throws IOException, HttpException
87 {
88 super.writeRequest( arg0, arg1 );
89 httpMethodSupport.afterWriteRequest( arg0, arg1 );
90 }
91
92 public void initStartTime()
93 {
94 httpMethodSupport.initStartTime();
95 }
96
97 public long getTimeTaken()
98 {
99 return httpMethodSupport.getTimeTaken();
100 }
101
102 public long getStartTime()
103 {
104 return httpMethodSupport.getStartTime();
105 }
106
107 public byte[] getResponseBody() throws IOException
108 {
109 return httpMethodSupport.getResponseBody();
110 }
111
112 public SSLInfo getSSLInfo()
113 {
114 return httpMethodSupport.getSSLInfo();
115 }
116
117 public String getResponseContentType()
118 {
119 return httpMethodSupport.getResponseContentType();
120 }
121
122 public RequestEntity getRequestEntity()
123 {
124 return null;
125 }
126
127 public RestRequestInterface.RequestMethod getMethod()
128 {
129 return RestRequestInterface.RequestMethod.HEAD;
130 }
131
132 public Throwable getFailureCause()
133 {
134 return httpMethodSupport.getFailureCause();
135 }
136
137 public boolean isFailed()
138 {
139 return httpMethodSupport.isFailed();
140 }
141
142 public void setFailed( Throwable t )
143 {
144 httpMethodSupport.setFailed( t );
145 }
146
147 }