Source Code Cross Referenced for BasicHttpParams.java in  » Net » httpcomponents-core-4.0-beta1 » org » apache » http » params » 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 » Net » httpcomponents core 4.0 beta1 » org.apache.http.params 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $HeadURL: https://svn.apache.org/repos/asf/httpcomponents/httpcore/tags/4.0-beta1/module-main/src/main/java/org/apache/http/params/BasicHttpParams.java $
003:         * $Revision: 610464 $
004:         * $Date: 2008-01-09 18:10:55 +0100 (Wed, 09 Jan 2008) $
005:         *
006:         * ====================================================================
007:         * Licensed to the Apache Software Foundation (ASF) under one
008:         * or more contributor license agreements.  See the NOTICE file
009:         * distributed with this work for additional information
010:         * regarding copyright ownership.  The ASF licenses this file
011:         * to you under the Apache License, Version 2.0 (the
012:         * "License"); you may not use this file except in compliance
013:         * with the License.  You may obtain a copy of the License at
014:         *
015:         *   http://www.apache.org/licenses/LICENSE-2.0
016:         *
017:         * Unless required by applicable law or agreed to in writing,
018:         * software distributed under the License is distributed on an
019:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
020:         * KIND, either express or implied.  See the License for the
021:         * specific language governing permissions and limitations
022:         * under the License.
023:         * ====================================================================
024:         *
025:         * This software consists of voluntary contributions made by many
026:         * individuals on behalf of the Apache Software Foundation.  For more
027:         * information on the Apache Software Foundation, please see
028:         * <http://www.apache.org/>.
029:         *
030:         */
031:
032:        package org.apache.http.params;
033:
034:        import java.io.Serializable;
035:        import java.util.Map;
036:        import java.util.HashMap;
037:        import java.util.Iterator;
038:
039:        import org.apache.http.params.HttpParams;
040:
041:        /**
042:         * This class represents a collection of HTTP protocol parameters.
043:         * Protocol parameters may be linked together to form a hierarchy.
044:         * If a particular parameter value has not been explicitly defined
045:         * in the collection itself, its value will be drawn from the parent 
046:         * collection of parameters.
047:         * 
048:         * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
049:         * 
050:         * @version $Revision: 610464 $
051:         */
052:        public final class BasicHttpParams extends AbstractHttpParams implements 
053:                Serializable, Cloneable {
054:
055:            private static final long serialVersionUID = -7086398485908701455L;
056:
057:            /** Map of HTTP parameters that this collection contains. */
058:            private HashMap parameters;
059:
060:            public BasicHttpParams() {
061:                super ();
062:            }
063:
064:            public Object getParameter(final String name) {
065:                // See if the parameter has been explicitly defined
066:                Object param = null;
067:                if (this .parameters != null) {
068:                    param = this .parameters.get(name);
069:                }
070:                return param;
071:            }
072:
073:            public HttpParams setParameter(final String name, final Object value) {
074:                if (this .parameters == null) {
075:                    this .parameters = new HashMap();
076:                }
077:                this .parameters.put(name, value);
078:                return this ;
079:            }
080:
081:            public boolean removeParameter(String name) {
082:                if (this .parameters == null) {
083:                    return false;
084:                }
085:                //this is to avoid the case in which the key has a null value
086:                if (this .parameters.containsKey(name)) {
087:                    this .parameters.remove(name);
088:                    return true;
089:                } else {
090:                    return false;
091:                }
092:            }
093:
094:            /**
095:             * Assigns the value to all the parameter with the given names
096:             * 
097:             * @param names array of parameter name
098:             * @param value parameter value
099:             */
100:            public void setParameters(final String[] names, final Object value) {
101:                for (int i = 0; i < names.length; i++) {
102:                    setParameter(names[i], value);
103:                }
104:            }
105:
106:            public boolean isParameterSet(final String name) {
107:                return getParameter(name) != null;
108:            }
109:
110:            public boolean isParameterSetLocally(final String name) {
111:                return this .parameters != null
112:                        && this .parameters.get(name) != null;
113:            }
114:
115:            /**
116:             * Removes all parameters from this collection.
117:             */
118:            public void clear() {
119:                this .parameters = null;
120:            }
121:
122:            /**
123:             * Creates a copy of these parameters.
124:             * The implementation here instantiates {@link BasicHttpParams}, 
125:             * then calls {@link #copyParams(HttpParams)} to populate the copy.
126:             *
127:             * @return  a new set of params holding a copy of the
128:             *          <i>local</i> parameters in this object.
129:             */
130:            public HttpParams copy() {
131:                BasicHttpParams clone = new BasicHttpParams();
132:                copyParams(clone);
133:                return clone;
134:            }
135:
136:            public Object clone() throws CloneNotSupportedException {
137:                BasicHttpParams clone = (BasicHttpParams) super .clone();
138:                copyParams(clone);
139:                return clone;
140:            }
141:
142:            /**
143:             * Copies the locally defined parameters to the argument parameters.
144:             * This method is called from {@link #copy()}.
145:             *
146:             * @param target    the parameters to which to copy
147:             */
148:            protected void copyParams(HttpParams target) {
149:                if (this .parameters == null)
150:                    return;
151:
152:                Iterator iter = parameters.entrySet().iterator();
153:                while (iter.hasNext()) {
154:                    Map.Entry me = (Map.Entry) iter.next();
155:                    if (me.getKey() instanceof  String)
156:                        target
157:                                .setParameter((String) me.getKey(), me
158:                                        .getValue());
159:                }
160:            }
161:
162:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.