Source Code Cross Referenced for ResponseHandler.java in  » Net » SkunkDAV » HTTPClient » 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 » SkunkDAV » HTTPClient 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)ResponseHandler.java				0.3-2 18/06/1999
003:         *
004:         *  This file is part of the HTTPClient package
005:         *  Copyright (C) 1996-1999  Ronald Tschalär
006:         *
007:         *  This library is free software; you can redistribute it and/or
008:         *  modify it under the terms of the GNU Lesser General Public
009:         *  License as published by the Free Software Foundation; either
010:         *  version 2 of the License, or (at your option) any later version.
011:         *
012:         *  This library is distributed in the hope that it will be useful,
013:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
014:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015:         *  Lesser General Public License for more details.
016:         *
017:         *  You should have received a copy of the GNU Lesser General Public
018:         *  License along with this library; if not, write to the Free
019:         *  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
020:         *  MA 02111-1307, USA
021:         *
022:         *  For questions, suggestions, bug-reports, enhancement-requests etc.
023:         *  I may be contacted at:
024:         *
025:         *  ronald@innovation.ch
026:         *
027:         */
028:
029:        package HTTPClient;
030:
031:        import java.io.IOException;
032:
033:        /**
034:         * This holds various information about an active response. Used by the
035:         * StreamDemultiplexor and RespInputStream.
036:         *
037:         * @version	0.3-2  18/06/1999
038:         * @author	Ronald Tschalär
039:         * @since	V0.2
040:         */
041:
042:        final class ResponseHandler implements  GlobalConstants {
043:            /** the response stream */
044:            RespInputStream stream;
045:
046:            /** the response class */
047:            Response resp;
048:
049:            /** the response class */
050:            Request request;
051:
052:            /** signals that the demux has closed the response stream, and that
053:            therefore no more data can be read */
054:            boolean eof = false;
055:
056:            /** this is non-null if the stream has an exception pending */
057:            IOException exception = null;
058:
059:            /**
060:             * Creates a new handler. This also allocates the response input
061:             * stream.
062:             *
063:             * @param resp     the reponse
064:             * @param request  the request
065:             * @param demux    our stream demultiplexor.
066:             */
067:            ResponseHandler(Response resp, Request request,
068:                    StreamDemultiplexor demux) {
069:                this .resp = resp;
070:                this .request = request;
071:                this .stream = new RespInputStream(demux, this );
072:
073:                if (DebugDemux)
074:                    System.err.println("Demux: Opening stream "
075:                            + this .stream.hashCode() + " (" + " ("
076:                            + demux.hashCode() + ") (" + Thread.currentThread()
077:                            + ")");
078:            }
079:
080:            /** holds the string that marks the end of this stream; used for
081:            multipart delimited responses. */
082:            private byte[] endbndry = null;
083:
084:            /** holds the compilation of the above string */
085:            private int[] end_cmp = null;
086:
087:            /**
088:             * return the boundary string for this response. Set's up the
089:             * InputStream buffer if neccessary.
090:             *
091:             * @param  MasterStream the input stream from which the stream demux
092:             *                      is reading.
093:             * @return the boundary string.
094:             */
095:            byte[] getEndBoundary(ExtBufferedInputStream MasterStream)
096:                    throws IOException, ParseException {
097:                if (endbndry == null)
098:                    setupBoundary(MasterStream);
099:
100:                return endbndry;
101:            }
102:
103:            /**
104:             * return the compilation of the boundary string for this response.
105:             * Set's up the InputStream buffer if neccessary.
106:             *
107:             * @param  MasterStream the input stream from which the stream demux
108:             *                      is reading.
109:             * @return the compiled boundary string.
110:             */
111:            int[] getEndCompiled(ExtBufferedInputStream MasterStream)
112:                    throws IOException, ParseException {
113:                if (end_cmp == null)
114:                    setupBoundary(MasterStream);
115:
116:                return end_cmp;
117:            }
118:
119:            /**
120:             * Gets the boundary string, compiles it for searching, and initializes
121:             * the buffered input stream.
122:             */
123:            void setupBoundary(ExtBufferedInputStream MasterStream)
124:                    throws IOException, ParseException {
125:                String endstr = "--"
126:                        + Util.getParameter("boundary", resp
127:                                .getHeader("Content-Type")) + "--\r\n";
128:                endbndry = new byte[endstr.length()];
129:                endstr.getBytes(0, endbndry.length, endbndry, 0);
130:                end_cmp = Util.compile_search(endbndry);
131:                MasterStream.initMark();
132:            }
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.