Source Code Cross Referenced for ClientProperties.java in  » Testing » HttpUnit » com » meterware » httpunit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » HttpUnit » com.meterware.httpunit 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.meterware.httpunit;
002:
003:        /********************************************************************************************************************
004:         * $Id: ClientProperties.java,v 1.7 2003/08/20 12:06:15 russgold Exp $
005:         *
006:         * Copyright (c) 2002-2003, Russell Gold
007:         *
008:         * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
009:         * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
010:         * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
011:         * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
012:         *
013:         * The above copyright notice and this permission notice shall be included in all copies or substantial portions
014:         * of the Software.
015:         *
016:         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
017:         * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018:         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
019:         * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
020:         * DEALINGS IN THE SOFTWARE.
021:         *
022:         *******************************************************************************************************************/
023:
024:        /**
025:         * A class which represents the properties of a web client.
026:         *
027:         * @author <a href="mailto:russgold@httpunit.org">Russell Gold</a>
028:         **/
029:        public class ClientProperties {
030:
031:            /**
032:             * Returns the current defaults for newly created web clients.
033:             */
034:            public static ClientProperties getDefaultProperties() {
035:                return _defaultProperties;
036:            }
037:
038:            /**
039:             * Specifies the ID information for a client.
040:             */
041:            public void setApplicationID(String applicationName,
042:                    String applicationCodeName, String applicationVersion) {
043:                _applicationCodeName = applicationCodeName;
044:                _applicationName = applicationName;
045:                _applicationVersion = applicationVersion;
046:            }
047:
048:            public String getApplicationCodeName() {
049:                return _applicationCodeName;
050:            }
051:
052:            public void setApplicationCodeName(String applicationCodeName) {
053:                _applicationCodeName = applicationCodeName;
054:            }
055:
056:            public String getApplicationName() {
057:                return _applicationName;
058:            }
059:
060:            public void setApplicationName(String applicationName) {
061:                _applicationName = applicationName;
062:            }
063:
064:            public String getApplicationVersion() {
065:                return _applicationVersion;
066:            }
067:
068:            public void setApplicationVersion(String applicationVersion) {
069:                _applicationVersion = applicationVersion;
070:            }
071:
072:            /**
073:             * Returns the user agent identification. Unless this has been set explicitly, it will default to the
074:             * application code name followed by a slash and the application version.
075:             */
076:            public String getUserAgent() {
077:                return _userAgent != null ? _userAgent : _applicationCodeName
078:                        + '/' + _applicationVersion;
079:            }
080:
081:            public void setUserAgent(String userAgent) {
082:                _userAgent = userAgent;
083:            }
084:
085:            public String getPlatform() {
086:                return _platform;
087:            }
088:
089:            public void setPlatform(String platform) {
090:                _platform = platform;
091:            }
092:
093:            /**
094:             * A shortcut for setting both availableScreenWidth and availableScreenHeight at one time.
095:             */
096:            public void setAvailableScreenSize(int width, int height) {
097:                _availWidth = width;
098:                _availHeight = height;
099:            }
100:
101:            public int getAvailableScreenWidth() {
102:                return _availWidth;
103:            }
104:
105:            public void setAvailableScreenWidth(int availWidth) {
106:                _availWidth = availWidth;
107:            }
108:
109:            public int getAvailHeight() {
110:                return _availHeight;
111:            }
112:
113:            public void setAvailHeight(int availHeight) {
114:                _availHeight = availHeight;
115:            }
116:
117:            /**
118:             * Returns true if the client should accept and transmit cookies. The default is to accept them.
119:             */
120:            public boolean isAcceptCookies() {
121:                return _acceptCookies;
122:            }
123:
124:            /**
125:             * Specifies whether the client should accept and send cookies.
126:             */
127:            public void setAcceptCookies(boolean acceptCookies) {
128:                _acceptCookies = acceptCookies;
129:            }
130:
131:            /**
132:             * Returns true if the client will accept GZIP encoding of responses. The default is to accept GZIP encoding.
133:             **/
134:            public boolean isAcceptGzip() {
135:                return _acceptGzip;
136:            }
137:
138:            /**
139:             * Specifies whether the client will accept GZIP encoded responses. The default is true.
140:             */
141:            public void setAcceptGzip(boolean acceptGzip) {
142:                _acceptGzip = acceptGzip;
143:            }
144:
145:            /**
146:             * Returns true if the client should automatically follow page redirect requests (status 3xx).
147:             * By default, this is true.
148:             **/
149:            public boolean isAutoRedirect() {
150:                return _autoRedirect;
151:            }
152:
153:            /**
154:             * Determines whether the client should automatically follow page redirect requests (status 3xx).
155:             * By default, this is true in order to simulate normal browser operation.
156:             **/
157:            public void setAutoRedirect(boolean autoRedirect) {
158:                _autoRedirect = autoRedirect;
159:            }
160:
161:            /**
162:             * Returns true if the client should automatically follow page refresh requests.
163:             * By default, this is false, so that programs can verify the redirect page presented
164:             * to users before the browser switches to the new page.
165:             **/
166:            public boolean isAutoRefresh() {
167:                return _autoRefresh;
168:            }
169:
170:            /**
171:             * Specifies whether the client should automatically follow page refresh requests.
172:             * By default, this is false, so that programs can verify the redirect page presented
173:             * to users before the browser switches to the new page. Setting this to true can
174:             * cause an infinite loop on pages that refresh themselves.
175:             **/
176:            public void setAutoRefresh(boolean autoRefresh) {
177:                _autoRefresh = autoRefresh;
178:            }
179:
180:            public boolean isIframeSupported() {
181:                return _iframeSupported;
182:            }
183:
184:            public void setIframeSupported(boolean iframeSupported) {
185:                _iframeSupported = iframeSupported;
186:            }
187:
188:            /**
189:             * Specifies a listener for DNS requests from the client.
190:             */
191:            public void setDnsListener(DNSListener dnsListener) {
192:                _dnsListener = dnsListener;
193:            }
194:
195:            /**
196:             * Returns the listener for DNS requests to be used by the client.
197:             */
198:            DNSListener getDnsListener() {
199:                return _dnsListener;
200:            }
201:
202:            ClientProperties cloneProperties() {
203:                return new ClientProperties(this );
204:            }
205:
206:            private String _applicationCodeName = "httpunit";
207:            private String _applicationName = "HttpUnit";
208:            private String _applicationVersion = "1.5";
209:            private String _userAgent;
210:            private String _platform = "Java";
211:            private int _availWidth = 800;
212:            private int _availHeight = 600;
213:
214:            private boolean _iframeSupported = true;
215:            private boolean _acceptCookies = true;
216:            private boolean _acceptGzip = true;
217:            private boolean _autoRedirect = true;
218:            private boolean _autoRefresh = false;
219:
220:            private DNSListener _dnsListener;
221:
222:            private static ClientProperties _defaultProperties = new ClientProperties();
223:
224:            private ClientProperties() {
225:            }
226:
227:            private ClientProperties(ClientProperties source) {
228:                _applicationCodeName = source._applicationCodeName;
229:                _applicationName = source._applicationName;
230:                _applicationVersion = source._applicationVersion;
231:                _userAgent = source._userAgent;
232:                _platform = source._platform;
233:                _iframeSupported = source._iframeSupported;
234:                _acceptCookies = source._acceptCookies;
235:                _acceptGzip = source._acceptGzip;
236:                _autoRedirect = source._autoRedirect;
237:                _autoRefresh = source._autoRefresh;
238:            }
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.