Source Code Cross Referenced for Rewriter.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » rewriter » 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 » Portal » jetspeed 2.1.3 » org.apache.jetspeed.rewriter 
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.jetspeed.rewriter;
018:
019:        import java.io.Reader;
020:        import java.io.Writer;
021:
022:        /**
023:         * Rewriter
024:         *
025:         * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
026:         * @version $Id: Rewriter.java 516448 2007-03-09 16:25:47Z ate $
027:         */
028:        public interface Rewriter {
029:            /**
030:             * Parses the reader of content receiving call backs for rewriter events.
031:             * This method does not rewrite, but only parses. Useful for readonly operations.
032:             * The configured parser can parse over different stream formats returning a
033:             * normalized (org.sax.xml) attribute and element based events.
034:             *
035:             * @param adaptor the parser adaptor which handles generating SAX-like events called back on this object. 
036:             * @param reader the input stream over the content to be parsed.
037:             * @exception RewriteException when a parsing error occurs or unexpected content is found.
038:             */
039:            void parse(ParserAdaptor adaptor, Reader reader)
040:                    throws RewriterException;
041:
042:            /**
043:             * Parses the reader of content receiving call backs for rewriter events.
044:             * The content is rewritten to the output stream.
045:             * The configured parser can parse over different stream formats returning a
046:             * normalized (org.sax.xml) attribute and element based events. 
047:             *
048:             * @param adaptor the parser adaptor which handles generating SAX-like events called back on this object. 
049:             * @param reader the input stream over the content to be parsed.
050:             * @param writer the output stream where content is rewritten to.
051:             * @exception RewriteException when a parsing error occurs or unexpected content is found.
052:             */
053:            void rewrite(ParserAdaptor adaptor, Reader reader, Writer writer)
054:                    throws RewriterException;
055:
056:            /** 
057:             * This event is the inteface between the Rewriter and ParserAdaptor for rewriting URLs.
058:             * The ParserAdaptor calls back the Rewriter when it finds a URL that is a candidate to be
059:             * rewritten. The Rewriter rewrites the URL and returns it as the result of this function. 
060:             * 
061:             * @param url the URL to be rewritten
062:             * @param tag The tag being processed
063:             * @param attribute The current attribute being processsed
064:             */
065:            String rewriteUrl(String url, String tag, String attribute);
066:
067:            /**
068:             * Returns true if the tag should be removed, otherwise false.
069:             * Removing a tag only removes the tag but not the contents in 
070:             * between the start and end tag.
071:             * 
072:             * @return true if the tag should be removed.
073:             */
074:            boolean shouldRemoveTag(String tag);
075:
076:            /**
077:             * Returns true if the tag should be stripped, otherwise false.
078:             * Stripping tags removes the start and end tag, plus all tags
079:             * and content in between the start and end tag.
080:             * 
081:             * @return true if the tag should be stripped.
082:             */
083:            boolean shouldStripTag(String tag);
084:
085:            /**
086:             * Returns true if all comments should be removed.
087:             * 
088:             * @return true If all comments should be removed.
089:             */
090:            boolean shouldRemoveComments();
091:
092:            /**
093:             * Sets the base URL for rewriting. This URL is the base 
094:             * from which other URLs are generated.
095:             * 
096:             * @param base The base URL for this rewriter
097:             */
098:            void setBaseUrl(String base);
099:
100:            /**
101:             * Gets the base URL for rewriting. This URL is the base 
102:             * from which other URLs are generated.
103:             * 
104:             * @return The base URL for this rewriter
105:             */
106:            String getBaseUrl();
107:
108:            /**
109:             * Gets a new URL relative to Base according to the site / and URL
110:             * rewriting rules of java.net.URL
111:             * 
112:             * @return The new URL from path, relative to the base URL (or path, if path is absolute)
113:             */
114:            String getBaseRelativeUrl(String path);
115:
116:            /**
117:             * Gets whether this rewriter require a proxy server.
118:             * 
119:             * @return true if it requires a proxy
120:             */
121:            boolean getUseProxy();
122:
123:            /**
124:             * Set whether this rewriter require a proxy server.
125:             * 
126:             * @param useProxy true if it requires a proxy
127:             */
128:            void setUseProxy(boolean useProxy);
129:
130:            /**
131:             * Rewriter event called back on the leading edge of processing a simple tag by the ParserAdaptor.
132:             * Returns false to indicate to the ParserAdaptor to short-circuit processing on this tag.
133:             * 
134:             * @param tag The name of the tag being processed.
135:             * @param attrs The attribute list for the tag.
136:             * @return Should return true to continue processing the tag in the ParserAdaptor, false to indicate that processing is completed.
137:             */
138:            boolean enterSimpleTagEvent(String tag, MutableAttributes attrs);
139:
140:            /**
141:             * Rewriter event called back on the trailing edge of a simple tag by the ParserAdaptor.
142:             * Returns a String that can be appended to the rewritten output for the given tag, or null to indicate no content available. 
143:             *  
144:             * @param tag The name of the tag being processed.
145:             * @param attrs The attribute list for the tag.
146:             * @return Returns a String that can be appended to the rewritten output for the given tag, or null to indicate no content available.
147:             */
148:            String exitSimpleTagEvent(String tag, MutableAttributes attrs);
149:
150:            /**
151:             * Rewriter event called back on the leading edge of processing a start tag by the ParserAdaptor.
152:             * Returns false to indicate to the ParserAdaptor to short-circuit processing on this tag.
153:             * 
154:             * @param tag The name of the tag being processed.
155:             * @param attrs The attribute list for the tag.
156:             * @return Should return true to continue processing the tag in the ParserAdaptor, false to indicate that processing is completed.
157:             */
158:            boolean enterStartTagEvent(String tag, MutableAttributes attrs);
159:
160:            /**
161:             * Rewriter event called back on the trailing edge of a start tag by the ParserAdaptor.
162:             * Returns a String that can be appended to the rewritten output for the given tag, or null to indicate no content available. 
163:             *  
164:             * @param tag The name of the tag being processed.
165:             * @param attrs The attribute list for the tag.
166:             * @return Returns a String that can be appended to the rewritten output for the given tag, or null to indicate no content available.
167:             */
168:            String exitStartTagEvent(String tag, MutableAttributes attrs);
169:
170:            /**
171:             * Rewriter event called back on the leading edge of processing an end tag by the ParserAdaptor.
172:             * Returns false to indicate to the ParserAdaptor to short-circuit processing on this tag.
173:             * 
174:             * @param tag The name of the tag being processed.
175:             * @param attrs The attribute list for the tag.
176:             * @return Should return true to continue processing the tag in the ParserAdaptor, false to indicate that processing is completed.
177:             */
178:            boolean enterEndTagEvent(String tag);
179:
180:            /**
181:             * Rewriter event called back on the trailing edge of a end tag by the ParserAdaptor.
182:             * Returns a String that can be appended to the rewritten output for the given tag, or null to indicate no content available. 
183:             *  
184:             * @param tag The name of the tag being processed.
185:             * @param attrs The attribute list for the tag.
186:             * @return Returns a String that can be appended to the rewritten output for the given tag, or null to indicate no content available.
187:             */
188:            String exitEndTagEvent(String tag);
189:
190:            /**
191:             * Rewriter event called back when text is found for 
192:             * Returns false to indicate to the ParserAdaptor to short-circuit processing on this tag.
193:             * 
194:             * @param values an array of characters containing the text.
195:             * @param param 
196:             * @return Should return true to continue processing the tag in the ParserAdaptor, false to indicate that processing is completed.
197:             */
198:            boolean enterText(char[] values, int param);
199:
200:            /**
201:             * Rewriter event called back just before tag conversion (rewriter callbacks) begins by the ParserAdaptor.
202:             * 
203:             * @param tag The name of the tag being processed.
204:             * @param attrs The attribute list for the tag.
205:             */
206:            void enterConvertTagEvent(String tag, MutableAttributes attrs);
207:
208:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.