Source Code Cross Referenced for JspPropertyGroup.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » jsp » cfg » 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 » EJB Server resin 3.1.5 » resin » com.caucho.jsp.cfg 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *
023:         *   Free SoftwareFoundation, Inc.
024:         *   59 Temple Place, Suite 330
025:         *   Boston, MA 02111-1307  USA
026:         *
027:         * @author Scott Ferguson
028:         */
029:
030:        package com.caucho.jsp.cfg;
031:
032:        import com.caucho.config.ConfigException;
033:        import com.caucho.config.types.FileSetType;
034:        import com.caucho.config.types.Period;
035:        import com.caucho.jsp.JspServlet;
036:        import com.caucho.jsp.JspXmlServlet;
037:        import com.caucho.server.dispatch.ServletMapping;
038:        import com.caucho.server.dispatch.UrlMap;
039:        import com.caucho.server.webapp.WebApp;
040:        import com.caucho.util.L10N;
041:        import com.caucho.vfs.Path;
042:
043:        import javax.annotation.PostConstruct;
044:        import javax.servlet.ServletException;
045:        import java.util.ArrayList;
046:        import java.util.regex.Pattern;
047:
048:        /**
049:         * Configuration for the jsp-property-group.
050:         */
051:        public class JspPropertyGroup {
052:            private static final L10N L = new L10N(JspPropertyGroup.class);
053:
054:            private static int _gId;
055:
056:            private static boolean _isDefaultFastJsf;
057:
058:            private WebApp _webApp;
059:
060:            private String _id;
061:            private ArrayList<String> _urlPatterns = new ArrayList<String>();
062:            private String _pageEncoding;
063:            private Boolean _isELIgnored;
064:            private boolean _isScriptingInvalid = false;
065:            private Boolean _isXml = null;
066:            private ArrayList<String> _includePrelude = new ArrayList<String>();
067:            private ArrayList<String> _includeCoda = new ArrayList<String>();
068:
069:            // Resin config
070:            private boolean _precompile = true;
071:            private boolean _fastJstl = true;
072:            private boolean _fastJsf = _isDefaultFastJsf;
073:            private boolean _ideHack = false;
074:            private boolean _velocity = false;
075:            private boolean _session = true;
076:            private boolean _staticEncoding = true;
077:            private boolean _recycleTags = true;
078:            private boolean _autoCompile = true;
079:            private boolean _requireSource = false;
080:            private boolean _ignoreELException = true;
081:            private boolean _isValidateTaglibSchema = true;
082:            private boolean _isPrintNullAsBlank = false;
083:
084:            private int _jspMax = 0;
085:            private boolean _disableLog = true;
086:            private long _dependencyCheckInterval = Long.MIN_VALUE;
087:            private boolean _staticPageGeneratesClass = true;
088:            private boolean _loadTldOnInit = false;
089:
090:            private boolean _recompileOnError = false;
091:            private FileSetType _tldFileSet;
092:
093:            private boolean _isTrimWhitespace = false;
094:            private boolean _isDeferredSyntaxAllowedAsLiteral = false;
095:
096:            public JspPropertyGroup() {
097:            }
098:
099:            public JspPropertyGroup(WebApp webApp) {
100:                _webApp = webApp;
101:            }
102:
103:            /**
104:             * Returns the group's identifier.
105:             */
106:            public String getId() {
107:                return _id;
108:            }
109:
110:            /**
111:             * Sets the group's identifier.
112:             */
113:            public void setId(String id) {
114:                _id = id;
115:            }
116:
117:            /**
118:             * Sets the group's description
119:             */
120:            public void setDescription(String description) {
121:            }
122:
123:            /**
124:             * Sets the group's display name
125:             */
126:            public void setDisplayName(String displayName) {
127:            }
128:
129:            /**
130:             * Adds a URL pattern.
131:             */
132:            public void addURLPattern(String urlPattern) {
133:                _urlPatterns.add(urlPattern);
134:            }
135:
136:            /**
137:             * Sets the default page encoding.
138:             */
139:            public void setPageEncoding(String pageEncoding) {
140:                _pageEncoding = pageEncoding;
141:            }
142:
143:            /**
144:             * Returns the default page encoding.
145:             */
146:            public String getPageEncoding() {
147:                return _pageEncoding;
148:            }
149:
150:            /**
151:             * Set true if EL expressions are ignored for the JSP page.
152:             */
153:            public void setELIgnored(boolean isELIgnored) {
154:                _isELIgnored = isELIgnored ? Boolean.TRUE : Boolean.FALSE;
155:                ;
156:            }
157:
158:            /**
159:             * Return true if EL expressions are ignored for the JSP page.
160:             */
161:            public Boolean isELIgnored() {
162:                return _isELIgnored;
163:            }
164:
165:            /**
166:             * Set true when JSP pages should load tld files.
167:             */
168:            public void setLoadTldOnInit(boolean isPreload) {
169:                _loadTldOnInit = isPreload;
170:            }
171:
172:            /**
173:             * Set true when JSP pages should load tld files.
174:             */
175:            public boolean isLoadTldOnInit() {
176:                return _loadTldOnInit;
177:            }
178:
179:            /**
180:             * Sets the dependency check interval.
181:             */
182:            public void setDependencyCheckInterval(Period period) {
183:                _dependencyCheckInterval = period.getPeriod();
184:            }
185:
186:            /**
187:             * Gets the dependency check interval.
188:             */
189:            public long getDependencyCheckInterval() {
190:                return _dependencyCheckInterval;
191:            }
192:
193:            /**
194:             * Set true if scripting is invalid for the JSP page.
195:             */
196:            public void setScriptingInvalid(boolean isScriptingInvalid) {
197:                _isScriptingInvalid = isScriptingInvalid;
198:            }
199:
200:            /**
201:             * Return true if scripting expressions are invalid for the JSP page.
202:             */
203:            public boolean isScriptingInvalid() {
204:                return _isScriptingInvalid;
205:            }
206:
207:            /**
208:             * Return true if the JSP uses XML format.
209:             */
210:            public void setIsXml(boolean isXml) {
211:                _isXml = isXml ? Boolean.TRUE : Boolean.FALSE;
212:            }
213:
214:            /**
215:             * Return true if the JSP uses XML format.
216:             */
217:            public Boolean isXml() {
218:                return _isXml;
219:            }
220:
221:            /**
222:             * Adds a new prelude inclusion.
223:             */
224:            public void addIncludePrelude(String url) {
225:                _includePrelude.add(url);
226:            }
227:
228:            /**
229:             * Returns the prelude inclusion.
230:             */
231:            public ArrayList<String> getIncludePreludeList() {
232:                return _includePrelude;
233:            }
234:
235:            /**
236:             * Adds a new coda inclusion.
237:             */
238:            public void addIncludeCoda(String url) {
239:                _includeCoda.add(url);
240:            }
241:
242:            /**
243:             * Returns the coda inclusion.
244:             */
245:            public ArrayList<String> getIncludeCodaList() {
246:                return _includeCoda;
247:            }
248:
249:            // Resin config
250:
251:            /**
252:             * Set if precompilation is allowed.
253:             */
254:            public void setPrecompile(boolean precompile) {
255:                _precompile = precompile;
256:            }
257:
258:            /**
259:             * Return true if precompilation is allowed.
260:             */
261:            public boolean getPrecompile() {
262:                return _precompile;
263:            }
264:
265:            /**
266:             * Return true if auto-compilation is allowed.
267:             */
268:            public boolean isAutoCompile() {
269:                return _autoCompile;
270:            }
271:
272:            /**
273:             * Set if auto-compile is allowed.
274:             */
275:            public void setAutoCompile(boolean compile) {
276:                _autoCompile = compile;
277:            }
278:
279:            /**
280:             * Set if the *.jsp source is required.
281:             */
282:            public void setRequireSource(boolean requireSource) {
283:                _requireSource = requireSource;
284:            }
285:
286:            /**
287:             * Set if the *.jsp source is required.
288:             */
289:            public boolean getRequireSource() {
290:                return _requireSource;
291:            }
292:
293:            /**
294:             * Set if nulls are printed as space
295:             */
296:            public void setPrintNullAsBlank(boolean enable) {
297:                _isPrintNullAsBlank = enable;
298:            }
299:
300:            /**
301:             * Set if nulls are printed as space
302:             */
303:            public boolean isPrintNullAsBlank() {
304:                return _isPrintNullAsBlank;
305:            }
306:
307:            /**
308:             * Set true if EL exceptions should be ignored.
309:             */
310:            public boolean isIgnoreELException() {
311:                return _ignoreELException;
312:            }
313:
314:            /**
315:             * Set true if EL exceptions should be ignored.
316:             */
317:            public void setIgnoreELException(boolean ignore) {
318:                _ignoreELException = ignore;
319:            }
320:
321:            /**
322:             * Set if fast jstl is allowed.
323:             */
324:            public void setFastJstl(boolean fastJstl) {
325:                _fastJstl = fastJstl;
326:            }
327:
328:            /**
329:             * Return true if fast jstl is allowed.
330:             */
331:            public boolean isFastJstl() {
332:                return _fastJstl;
333:            }
334:
335:            /**
336:             * Set if fast jsf is allowed.
337:             */
338:            public void setFastJsf(boolean fastJsf) {
339:                _fastJsf = fastJsf;
340:            }
341:
342:            /**
343:             * Return true if fast jsf is allowed.
344:             */
345:            public boolean isFastJsf() {
346:                return _fastJsf;
347:            }
348:
349:            /**
350:             * Set if velocity-style syntax is allowed.
351:             */
352:            public void setVelocityEnabled(boolean velocity) {
353:                _velocity = velocity;
354:            }
355:
356:            /**
357:             * Return true if velocity is allowed.
358:             */
359:            public boolean isVelocityEnabled() {
360:                return _velocity;
361:            }
362:
363:            /**
364:             * Set if sessions are enabled by default
365:             */
366:            public void setSession(boolean session) {
367:                _session = session;
368:            }
369:
370:            /**
371:             * Return true if sessions are enabled by default.
372:             */
373:            public boolean isSession() {
374:                return _session;
375:            }
376:
377:            /**
378:             * Set if static encoding is enabled.
379:             */
380:            public void setStaticEncoding(boolean staticEncoding) {
381:                _staticEncoding = staticEncoding;
382:            }
383:
384:            /**
385:             * Return true if static encoding is enabled
386:             */
387:            public boolean isStaticEncoding() {
388:                return _staticEncoding;
389:            }
390:
391:            /**
392:             * Set if recycle tags is enabled.
393:             */
394:            public void setRecycleTags(boolean recycleTags) {
395:                _recycleTags = recycleTags;
396:            }
397:
398:            /**
399:             * Return true if recycle tags is enabled
400:             */
401:            public boolean isRecycleTags() {
402:                return _recycleTags;
403:            }
404:
405:            /**
406:             * Sets true for the ide-hack
407:             */
408:            public void setIdeHack(boolean ideHack) {
409:                _ideHack = ideHack;
410:            }
411:
412:            /**
413:             * Gets the value of the ide-hack
414:             */
415:            public boolean getIdeHack() {
416:                return _ideHack;
417:            }
418:
419:            /**
420:             * Sets the jsp-max
421:             */
422:            public void setJspMax(int max) throws ConfigException {
423:                if (max <= 0)
424:                    throw new ConfigException(L.l(
425:                            "`{0}' is too small a value for jsp-max", max));
426:
427:                _jspMax = max;
428:            }
429:
430:            /**
431:             * Gets the value of the jsp-max
432:             */
433:            public int getJspMax() {
434:                return _jspMax;
435:            }
436:
437:            /**
438:             * Returns true if JSP logging should be disabled.
439:             */
440:            public boolean isDisableLog() {
441:                return _disableLog;
442:            }
443:
444:            /**
445:             * Sets the deferred-syntax.
446:             */
447:            public void setDeferredSyntaxAllowedAsLiteral(boolean isAllowed) {
448:                _isDeferredSyntaxAllowedAsLiteral = isAllowed;
449:            }
450:
451:            /**
452:             * Sets the deferred-syntax.
453:             */
454:            public boolean isDeferredSyntaxAllowedAsLiteral() {
455:                return _isDeferredSyntaxAllowedAsLiteral;
456:            }
457:
458:            /**
459:             * Sets the recompile-on-errrkReturns true if JSP logging should be disabled.
460:             */
461:            public void setRecompileOnError(boolean recompile) {
462:                _recompileOnError = recompile;
463:            }
464:
465:            /**
466:             * Sets the recompile-on-errrkReturns true if JSP logging should be disabled.
467:             */
468:            public boolean isRecompileOnError() {
469:                return _recompileOnError;
470:            }
471:
472:            /**
473:             * Set true if the taglibs should have the schema validated
474:             */
475:            public void setValidateTaglibSchema(boolean isValidate) {
476:                _isValidateTaglibSchema = isValidate;
477:            }
478:
479:            /**
480:             * Set true if the taglibs should have the schema validated
481:             */
482:            public boolean isValidateTaglibSchema() {
483:                return _isValidateTaglibSchema;
484:            }
485:
486:            /**
487:             * Sets the tld fileset.
488:             */
489:            public void setTldFileSet(FileSetType fileSet) {
490:                _tldFileSet = fileSet;
491:            }
492:
493:            /**
494:             * Gets the tld fileset.
495:             */
496:            public FileSetType getTldFileSet() {
497:                return _tldFileSet;
498:            }
499:
500:            /**
501:             * Sets a restriction of the tld dir.
502:             */
503:            public void setTldDir(Path tldDir) {
504:                _tldFileSet = new FileSetType();
505:                _tldFileSet.setDir(tldDir);
506:            }
507:
508:            /**
509:             * Set true if static pages should generate a class
510:             */
511:            public void setStaticPageGeneratesClass(boolean generate) {
512:                _staticPageGeneratesClass = generate;
513:            }
514:
515:            /**
516:             * Set true if static pages should generate a class
517:             */
518:            public boolean getStaticPageGeneratesClass() {
519:                return _staticPageGeneratesClass;
520:            }
521:
522:            /**
523:             * True if whitespace is trimmed.
524:             */
525:            public boolean isTrimDirectiveWhitespaces() {
526:                return _isTrimWhitespace;
527:            }
528:
529:            /**
530:             * Set if whitespace is trimmed.
531:             */
532:            public void setTrimDirectiveWhitespaces(boolean isTrim) {
533:                _isTrimWhitespace = isTrim;
534:            }
535:
536:            @PostConstruct
537:            public void init() throws ServletException {
538:                if (_webApp != null) {
539:                    ServletMapping mapping = _webApp.createServletMapping();
540:                    mapping.setServletName("jsp-property-group-" + _gId++);
541:
542:                    if (Boolean.TRUE.equals(_isXml))
543:                        mapping.setServletClass(JspXmlServlet.class.getName());
544:                    else
545:                        mapping.setServletClass(JspServlet.class.getName());
546:
547:                    for (int i = 0; i < _urlPatterns.size(); i++) {
548:                        mapping.addURLPattern(_urlPatterns.get(i));
549:                    }
550:
551:                    _webApp.addServletMapping(mapping);
552:                }
553:            }
554:
555:            /**
556:             * Returns true if the property group matches the URL.
557:             */
558:            public boolean match(String url) {
559:                if (_urlPatterns.size() == 0)
560:                    return true;
561:
562:                for (int i = 0; i < _urlPatterns.size(); i++) {
563:                    String urlPattern = _urlPatterns.get(i);
564:                    String regexpPattern = UrlMap
565:                            .urlPatternToRegexpPattern(urlPattern);
566:
567:                    if (Pattern.compile(regexpPattern).matcher(url).find()) {
568:                        return true;
569:                    }
570:                }
571:
572:                return false;
573:            }
574:
575:            static {
576:                try {
577:                    Class cl = Class.forName("javax.faces.webapp.CauchoUtil");
578:
579:                    if (cl != null)
580:                        _isDefaultFastJsf = true;
581:                } catch (Exception e) {
582:                }
583:            }
584:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.