View Javadoc

1   package com.diasparsoftware.htmlunitx;
2   
3   import java.net.URL;
4   import java.util.Properties;
5   
6   import com.diasparsoftware.gsbase.*;
7   import com.gargoylesoftware.htmlunit.WebResponse;
8   
9   
10  public abstract class TestableWebResponse implements WebResponse {
11      private int statusCode = 200;
12      private String statusMessage = "";
13      private String contentType = "application/octet-stream";
14      private String contentCharSet = "ISO-8859-1";
15      private Properties responseHeaderValues = new Properties();
16      private Stopwatch stopwatch = new SystemClockStopwatch();
17  
18      private URL url;
19      
20      public TestableWebResponse(URL url) {
21          this.url = url;
22      }
23  
24      public URL getUrl() {
25          return url;
26      }
27  
28      public int getStatusCode() {
29          return statusCode;
30      }
31      
32      public void setStatusCode(int statusCode) {
33          this.statusCode = statusCode;
34      }
35  
36      public String getStatusMessage() {
37          return statusMessage;
38      }
39  
40      public void setStatusMessage(String statusMessage) {
41          this.statusMessage = statusMessage;
42      }
43  
44      public String getResponseHeaderValue(String headerName) {
45          return responseHeaderValues.getProperty(headerName);
46      }
47  
48      public void addResponseHeaderValue(String name, String value) {
49          responseHeaderValues.put(name, value);
50      }
51  
52      public String getContentCharSet() {
53          return contentCharSet;
54      }
55  
56      public void setContentCharSet(String contentCharSet) {
57          this.contentCharSet = contentCharSet;
58      }
59  
60      public String getContentType() {
61          return contentType;
62      }
63  
64      public void setContentType(String contentType) {
65          this.contentType = contentType;
66      }
67      
68      public Stopwatch getStopwatch() {
69          return stopwatch;
70      }
71  
72      public void setStopwatch(Stopwatch stopwatch) {
73          this.stopwatch = stopwatch;
74      }
75  
76  }