Source Code Cross Referenced for HTTPInputSource.java in  » XML » xerces-2_9_1 » org » apache » xerces » util » 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 » XML » xerces 2_9_1 » org.apache.xerces.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.xerces.util;
018:
019:        import java.io.InputStream;
020:        import java.io.Reader;
021:
022:        import java.util.HashMap;
023:        import java.util.Iterator;
024:        import java.util.Map;
025:
026:        import org.apache.xerces.xni.XMLResourceIdentifier;
027:        import org.apache.xerces.xni.parser.XMLInputSource;
028:
029:        /**
030:         * This class represents an input source for an XML resource
031:         * retrievable over HTTP. In addition to the properties
032:         * provided by an <code>XMLInputSource</code> an HTTP input
033:         * source also has HTTP request properties and a preference
034:         * whether HTTP redirects will be followed. Note that these
035:         * properties will only be used if reading this input source
036:         * will induce an HTTP connection.
037:         * 
038:         * @author Michael Glavassevich, IBM
039:         * 
040:         * @version $Id: HTTPInputSource.java 447241 2006-09-18 05:12:57Z mrglavas $
041:         */
042:        public final class HTTPInputSource extends XMLInputSource {
043:
044:            //
045:            // Data
046:            //
047:
048:            /** Preference for whether HTTP redirects should be followed. **/
049:            protected boolean fFollowRedirects = true;
050:
051:            /** HTTP request properties. **/
052:            protected Map fHTTPRequestProperties = new HashMap();
053:
054:            //
055:            // Constructors
056:            //
057:
058:            /** 
059:             * Constructs an input source from just the public and system
060:             * identifiers, leaving resolution of the entity and opening of
061:             * the input stream up to the caller.
062:             *
063:             * @param publicId     The public identifier, if known.
064:             * @param systemId     The system identifier. This value should
065:             *                     always be set, if possible, and can be
066:             *                     relative or absolute. If the system identifier
067:             *                     is relative, then the base system identifier
068:             *                     should be set.
069:             * @param baseSystemId The base system identifier. This value should
070:             *                     always be set to the fully expanded URI of the
071:             *                     base system identifier, if possible.
072:             */
073:            public HTTPInputSource(String publicId, String systemId,
074:                    String baseSystemId) {
075:                super (publicId, systemId, baseSystemId);
076:            } // <init>(String,String,String)
077:
078:            /** 
079:             * Constructs an input source from a XMLResourceIdentifier
080:             * object, leaving resolution of the entity and opening of
081:             * the input stream up to the caller.
082:             *
083:             * @param resourceIdentifier the XMLResourceIdentifier containing the information
084:             */
085:            public HTTPInputSource(XMLResourceIdentifier resourceIdentifier) {
086:                super (resourceIdentifier);
087:            } // <init>(XMLResourceIdentifier)
088:
089:            /**
090:             * Constructs an input source from a byte stream.
091:             *
092:             * @param publicId     The public identifier, if known.
093:             * @param systemId     The system identifier. This value should
094:             *                     always be set, if possible, and can be
095:             *                     relative or absolute. If the system identifier
096:             *                     is relative, then the base system identifier
097:             *                     should be set.
098:             * @param baseSystemId The base system identifier. This value should
099:             *                     always be set to the fully expanded URI of the
100:             *                     base system identifier, if possible.
101:             * @param byteStream   The byte stream.
102:             * @param encoding     The encoding of the byte stream, if known.
103:             */
104:            public HTTPInputSource(String publicId, String systemId,
105:                    String baseSystemId, InputStream byteStream, String encoding) {
106:                super (publicId, systemId, baseSystemId, byteStream, encoding);
107:            } // <init>(String,String,String,InputStream,String)
108:
109:            /**
110:             * Constructs an input source from a character stream.
111:             *
112:             * @param publicId     The public identifier, if known.
113:             * @param systemId     The system identifier. This value should
114:             *                     always be set, if possible, and can be
115:             *                     relative or absolute. If the system identifier
116:             *                     is relative, then the base system identifier
117:             *                     should be set.
118:             * @param baseSystemId The base system identifier. This value should
119:             *                     always be set to the fully expanded URI of the
120:             *                     base system identifier, if possible.
121:             * @param charStream   The character stream.
122:             * @param encoding     The original encoding of the byte stream
123:             *                     used by the reader, if known.
124:             */
125:            public HTTPInputSource(String publicId, String systemId,
126:                    String baseSystemId, Reader charStream, String encoding) {
127:                super (publicId, systemId, baseSystemId, charStream, encoding);
128:            } // <init>(String,String,String,Reader,String)
129:
130:            //
131:            // Public methods
132:            //   
133:
134:            /**
135:             * Returns the preference whether HTTP redirects should
136:             * be followed. By default HTTP redirects will be followed.
137:             */
138:            public boolean getFollowHTTPRedirects() {
139:                return fFollowRedirects;
140:            } // getFollowHTTPRedirects():boolean
141:
142:            /**
143:             * Sets the preference whether HTTP redirects should
144:             * be followed. By default HTTP redirects will be followed.
145:             */
146:            public void setFollowHTTPRedirects(boolean followRedirects) {
147:                fFollowRedirects = followRedirects;
148:            } // setFollowHTTPRedirects(boolean)
149:
150:            /**
151:             * Returns the value of the request property 
152:             * associated with the given property name.
153:             * 
154:             * @param key the name of the request property
155:             * @return the value of the request property or 
156:             * <code>null</code> if this property has not
157:             * been set
158:             */
159:            public String getHTTPRequestProperty(String key) {
160:                return (String) fHTTPRequestProperties.get(key);
161:            } // getHTTPRequestProperty(String):String
162:
163:            /**
164:             * Returns an iterator for the request properties this
165:             * input source contains. Each object returned by the
166:             * iterator is an instance of <code>java.util.Map.Entry</code>
167:             * where each key and value are a pair of strings corresponding
168:             * to the name and value of a request property. 
169:             * 
170:             * @return an iterator for the request properties this
171:             * input source contains
172:             */
173:            public Iterator getHTTPRequestProperties() {
174:                return fHTTPRequestProperties.entrySet().iterator();
175:            } // getHTTPRequestProperties():Iterator
176:
177:            /**
178:             * Sets the value of the request property
179:             * associated with the given property name.
180:             * 
181:             * @param key the name of the request property
182:             * @param value the value of the request property
183:             */
184:            public void setHTTPRequestProperty(String key, String value) {
185:                if (value != null) {
186:                    fHTTPRequestProperties.put(key, value);
187:                } else {
188:                    fHTTPRequestProperties.remove(key);
189:                }
190:            } // setHTTPRequestProperty(String,String)
191:
192:        } // class HTTPInputSource
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.