Source Code Cross Referenced for FilterMapping.java in  » Sevlet-Container » jetty-modules » org » mortbay » jetty » servlet » 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 » Sevlet Container » jetty modules » org.mortbay.jetty.servlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //========================================================================
002:        //$Id: FilterMapping.java,v 1.2 2005/11/01 11:42:53 gregwilkins Exp $
003:        //Copyright 2004-2005 Mort Bay Consulting Pty. Ltd.
004:        //------------------------------------------------------------------------
005:        //Licensed under the Apache License, Version 2.0 (the "License");
006:        //you may not use this file except in compliance with the License.
007:        //You may obtain a copy of the License at 
008:        //http://www.apache.org/licenses/LICENSE-2.0
009:        //Unless required by applicable law or agreed to in writing, software
010:        //distributed under the License is distributed on an "AS IS" BASIS,
011:        //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        //See the License for the specific language governing permissions and
013:        //limitations under the License.
014:        //========================================================================
015:
016:        package org.mortbay.jetty.servlet;
017:
018:        import java.util.Arrays;
019:
020:        import org.mortbay.jetty.Handler;
021:
022:        public class FilterMapping {
023:            private int _dispatches = Handler.REQUEST;
024:            private String _filterName;
025:            private transient FilterHolder _holder;
026:            private String[] _pathSpecs;
027:            private String[] _servletNames;
028:
029:            /* ------------------------------------------------------------ */
030:            public FilterMapping() {
031:            }
032:
033:            /* ------------------------------------------------------------ */
034:            /** Check if this filter applies to a path.
035:             * @param path The path to check or null to just check type
036:             * @param type The type of request: __REQUEST,__FORWARD,__INCLUDE or __ERROR.
037:             * @return True if this filter applies
038:             */
039:            boolean appliesTo(String path, int type) {
040:                if (((_dispatches & type) != 0 || (_dispatches == 0 && type == Handler.REQUEST))
041:                        && _pathSpecs != null) {
042:                    for (int i = 0; i < _pathSpecs.length; i++)
043:                        if (_pathSpecs[i] != null
044:                                && PathMap.match(_pathSpecs[i], path, true))
045:                            return true;
046:                }
047:                return false;
048:            }
049:
050:            /* ------------------------------------------------------------ */
051:            /** Check if this filter applies to a particular dispatch type.
052:             * @param type The type of request:
053:             *      {@link Handler#REQUEST}, {@link Handler#FORWARD}, {@link Handler#INCLUDE} or {@link Handler#ERROR}.
054:             * @return <code>true</code> if this filter applies
055:             */
056:            boolean appliesTo(int type) {
057:                if (((_dispatches & type) != 0 || (_dispatches == 0 && type == Handler.REQUEST)))
058:                    return true;
059:                return false;
060:            }
061:
062:            /* ------------------------------------------------------------ */
063:            /**
064:             * @return Returns the dispatches.
065:             */
066:            public int getDispatches() {
067:                return _dispatches;
068:            }
069:
070:            /* ------------------------------------------------------------ */
071:            /**
072:             * @return Returns the filterName.
073:             */
074:            public String getFilterName() {
075:                return _filterName;
076:            }
077:
078:            /* ------------------------------------------------------------ */
079:            /**
080:             * @return Returns the holder.
081:             */
082:            FilterHolder getFilterHolder() {
083:                return _holder;
084:            }
085:
086:            /* ------------------------------------------------------------ */
087:            /**
088:             * @return Returns the pathSpec.
089:             */
090:            public String[] getPathSpecs() {
091:                return _pathSpecs;
092:            }
093:
094:            /* ------------------------------------------------------------ */
095:            /**
096:             * @param dispatches The dispatches to set.
097:             * @see Handler#DEFAULT
098:             * @see Handler#REQUEST
099:             * @see Handler#ERROR
100:             * @see Handler#FORWARD
101:             * @see Handler#INCLUDE
102:             */
103:            public void setDispatches(int dispatches) {
104:                _dispatches = dispatches;
105:            }
106:
107:            /* ------------------------------------------------------------ */
108:            /**
109:             * @param filterName The filterName to set.
110:             */
111:            public void setFilterName(String filterName) {
112:                _filterName = filterName;
113:            }
114:
115:            /* ------------------------------------------------------------ */
116:            /**
117:             * @param holder The holder to set.
118:             */
119:            void setFilterHolder(FilterHolder holder) {
120:                _holder = holder;
121:            }
122:
123:            /* ------------------------------------------------------------ */
124:            /**
125:             * @param pathSpecs The Path specifications to which this filter should be mapped. 
126:             */
127:            public void setPathSpecs(String[] pathSpecs) {
128:                _pathSpecs = pathSpecs;
129:            }
130:
131:            /* ------------------------------------------------------------ */
132:            /**
133:             * @param pathSpec The pathSpec to set.
134:             */
135:            public void setPathSpec(String pathSpec) {
136:                _pathSpecs = new String[] { pathSpec };
137:            }
138:
139:            /* ------------------------------------------------------------ */
140:            /**
141:             * @return Returns the servletName.
142:             */
143:            public String[] getServletNames() {
144:                return _servletNames;
145:            }
146:
147:            /* ------------------------------------------------------------ */
148:            /**
149:             * @param servletNames Maps the {@link #setFilterName(String) named filter} to multiple servlets
150:             * @see #setServletName
151:             */
152:            public void setServletNames(String[] servletNames) {
153:                _servletNames = servletNames;
154:            }
155:
156:            /* ------------------------------------------------------------ */
157:            /**
158:             * @param servletName Maps the {@link #setFilterName(String) named filter} to a single servlet
159:             * @see #setServletNames
160:             */
161:            public void setServletName(String servletName) {
162:                _servletNames = new String[] { servletName };
163:            }
164:
165:            /* ------------------------------------------------------------ */
166:            public String toString() {
167:                return "(F="
168:                        + _filterName
169:                        + ","
170:                        + (_pathSpecs == null ? "[]" : Arrays
171:                                .asList(_pathSpecs).toString())
172:                        + ","
173:                        + (_servletNames == null ? "[]" : Arrays.asList(
174:                                _servletNames).toString()) + "," + _dispatches
175:                        + ")";
176:            }
177:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.