Source Code Cross Referenced for ResourceFilter.java in  » Web-Server » Jigsaw » org » w3c » tools » resources » 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 » Web Server » Jigsaw » org.w3c.tools.resources 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // ResourceFilter.java
002:        // $Id: ResourceFilter.java,v 1.10 2002/06/26 17:27:43 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1996.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.tools.resources;
007:
008:        import java.io.OutputStream;
009:        import java.util.Hashtable;
010:
011:        public class ResourceFilter extends ResourceFrame implements 
012:                FilterInterface {
013:
014:            /**
015:             * Get our target resource.
016:             */
017:            public Resource getTargetResource() {
018:                Resource target = (Resource) getResource();
019:                while (target instanceof  ResourceFrame) {
020:                    target = ((ResourceFrame) target).getResource();
021:                }
022:                return target;
023:            }
024:
025:            /**
026:             * Lookup time filtering.
027:             * This method is called while Jigsaw performs resource lookup. Each time
028:             * a lookup end up on the target resource of that filter, this method
029:             * will be called.
030:             * @param ls The current lookup state.
031:             * @param lr The current lookup result.
032:             * @return A boolean, <strong>true</strong> if this filter has performed
033:             * the whole lookup, and side-effect the lookup result appropriatelly,
034:             * <strong>false</strong> otherwise.
035:             * @exception ProtocolException If processing should be interrupted,
036:             * because an abnormal situation occured.
037:             */
038:
039:            public boolean lookup(LookupState ls, LookupResult lr)
040:                    throws ProtocolException {
041:                return false;
042:            }
043:
044:            /**
045:             * Simplified ingoingFilter API.
046:             * This is a default, simplified API to the ingoing filter method.
047:             * @param request The request to filter.
048:             * @return A Reply instance, or <strong>null</strong> if processing
049:             * should continue normally.
050:             * @exception ProtocolException If processing should be interrupted,
051:             * because an abnormal situation occured.
052:             */
053:
054:            public ReplyInterface ingoingFilter(RequestInterface request)
055:                    throws ProtocolException {
056:                return null;
057:            }
058:
059:            /**
060:             * The ingoingFilter method.
061:             * This is the method that really gets called by Jigsaw core. By default
062:             * it will invoke the simpler <code>ingoingFilter</code> method,
063:             * taking only the request has a parameter.
064:             * @param request The request that is about to be handled.
065:             * @param filters The whole filter list to be applied to the resource.
066:             * @param i A pointer into the above array, indicating which filters
067:             * have already been triggered (the one whose index are lower than 
068:             * <strong>i</strong>), and what filters have to be triggered (the one
069:             * whose index are greater or equal to <strong>i+1</strong>).
070:             * @return A Reply instance, if the filter did know how to answer
071:             * the request without further processing, <strong>null</strong>
072:             * otherwise.
073:             * @exception ProtocolException If processing should be interrupted,
074:             * because an abnormal situation occured.
075:             */
076:
077:            public ReplyInterface ingoingFilter(RequestInterface request,
078:                    FilterInterface filters[], int i) throws ProtocolException {
079:                return ingoingFilter(request);
080:            }
081:
082:            /**
083:             * Simplified API to the outgoing filter metho.
084:             * This is a simplified API to the ougoing filter method, you can either
085:             * overide this method, or the more powerfull one.
086:             * @param request The original request.
087:             * @param reply It's original reply.
088:             * @return A Reply instance, or <strong>null</strong> if processing
089:             * should continue normally.
090:             * @exception ProtocolException If processing should be interrupted, 
091:             * because an abnormal situation occured.
092:             */
093:
094:            public ReplyInterface outgoingFilter(RequestInterface request,
095:                    ReplyInterface reply) throws ProtocolException {
096:                return null;
097:            }
098:
099:            public ReplyInterface exceptionFilter(RequestInterface request,
100:                    ProtocolException ex, FilterInterface filters[], int i) {
101:                return null;
102:            }
103:
104:            /**
105:             * The outgoingFilter method.
106:             * This method is the one that gets called by Jigsaw core. By default it
107:             * will call the simpler <code>outgoingFilter</code> method that takes
108:             * only the request and the reply as parameters.
109:             * @param request The request that has been processed.
110:             * @param reply The original reply as emitted by the resource.
111:             * @param filters The whole filter that applies to the resource.
112:             * @param i The current index of filters. The <em>i</em> filter is ourself,
113:             * filters with lower indexes have already been applied, and filters with
114:             * greater indexes are still to be applied.
115:             * @return A Reply instance, if that filter know how to complete the
116:             * request processing, or <strong>null</strong> if reminaing filters
117:             * are to be called by Jigsaw engine.
118:             * @exception ProtocolException If processing should be interrupted,
119:             * because an abnormal situation occured.
120:             */
121:
122:            public ReplyInterface outgoingFilter(RequestInterface request,
123:                    ReplyInterface reply, FilterInterface filters[], int fidx)
124:                    throws ProtocolException {
125:                ReplyInterface fr = outgoingFilter(request, reply);
126:                return (fr != reply) ? fr : null;
127:            }
128:
129:            public OutputStream outputFilter(RequestInterface request,
130:                    ReplyInterface reply, OutputStream output) {
131:                return output;
132:            }
133:
134:            /**
135:             * Set the values. (MUST be called before initialize).
136:             * @param defs The Hashtable containing the values.
137:             */
138:            public void pickleValues(Hashtable defs) {
139:                Object nvalues[] = new Object[attributes.length];
140:                for (int i = 0; i < nvalues.length; i++) {
141:                    String attrname = attributes[i].getName();
142:                    Object def = defs.get(attrname);
143:                    // note that protocol frames have usually names in the
144:                    // frame-XX serie, so it is valid to save (big) on this.
145:                    if ((def != null)
146:                            && ((i == ATTR_HELP_URL) || (i == ATTR_IDENTIFIER))
147:                            && (def instanceof  String)) {
148:                        nvalues[i] = ((String) def).intern();
149:                    } else {
150:                        nvalues[i] = def;
151:                    }
152:                }
153:                this .values = nvalues;
154:            }
155:
156:            /**
157:             * Initialization method for attribute holders.
158:             * This method allows to initialize an attribute holder by providing
159:             * its attributes values through a Hashtable mapping attribute names
160:             * to attribute values.
161:             * @param defs The Hashtable containing the default values.
162:             */
163:
164:            public void initialize(Hashtable defs) {
165:                Object values[] = ((this .values == null) ? new Object[attributes.length]
166:                        : this .values);
167:                for (int i = 0; i < values.length; i++) {
168:                    String attrname = attributes[i].getName();
169:                    Object def = defs.get(attrname);
170:                    if (values[i] == null) {
171:                        // for help_url, we can save lots of space by using 
172:                        // String.intern()
173:                        if ((def != null)
174:                                && ((i == ATTR_HELP_URL) || (i == ATTR_IDENTIFIER))
175:                                && (def instanceof  String)) {
176:                            values[i] = ((String) def).intern();
177:                        } else {
178:                            values[i] = def;
179:                        }
180:                    }
181:                }
182:                initialize(values);
183:            }
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.