Source Code Cross Referenced for Settings.java in  » J2EE » wicket » wicket » settings » 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 » J2EE » wicket » wicket.settings 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * $Id: Settings.java 4858 2006-03-12 00:26:31 -0800 (Sun, 12 Mar 2006)
0003:         * ivaynberg $ $Revision: 464726 $ $Date: 2006-03-12 00:26:31 -0800 (Sun, 12 Mar
0004:         * 2006) $
0005:         * 
0006:         * ==============================================================================
0007:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
0008:         * use this file except in compliance with the License. You may obtain a copy of
0009:         * the License at
0010:         * 
0011:         * http://www.apache.org/licenses/LICENSE-2.0
0012:         * 
0013:         * Unless required by applicable law or agreed to in writing, software
0014:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
0015:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
0016:         * License for the specific language governing permissions and limitations under
0017:         * the License.
0018:         */
0019:        package wicket.settings;
0020:
0021:        import java.util.ArrayList;
0022:        import java.util.Collections;
0023:        import java.util.HashMap;
0024:        import java.util.List;
0025:        import java.util.Locale;
0026:        import java.util.Map;
0027:
0028:        import wicket.Application;
0029:        import wicket.Component;
0030:        import wicket.IPageFactory;
0031:        import wicket.IResourceFactory;
0032:        import wicket.IResponseFilter;
0033:        import wicket.Localizer;
0034:        import wicket.Page;
0035:        import wicket.RequestCycle;
0036:        import wicket.application.DefaultClassResolver;
0037:        import wicket.application.IClassResolver;
0038:        import wicket.authorization.IAuthorizationStrategy;
0039:        import wicket.authorization.IUnauthorizedComponentInstantiationListener;
0040:        import wicket.authorization.UnauthorizedInstantiationException;
0041:        import wicket.markup.IMarkupParserFactory;
0042:        import wicket.markup.MarkupParserFactory;
0043:        import wicket.markup.html.IPackageResourceGuard;
0044:        import wicket.markup.html.PackageResourceGuard;
0045:        import wicket.markup.html.form.persistence.CookieValuePersisterSettings;
0046:        import wicket.markup.html.pages.BrowserInfoPage;
0047:        import wicket.markup.resolver.AutoComponentResolver;
0048:        import wicket.markup.resolver.IComponentResolver;
0049:        import wicket.protocol.http.WebRequest;
0050:        import wicket.resource.PropertiesFactory;
0051:        import wicket.resource.loader.ClassStringResourceLoader;
0052:        import wicket.resource.loader.ComponentStringResourceLoader;
0053:        import wicket.resource.loader.IStringResourceLoader;
0054:        import wicket.session.DefaultPageFactory;
0055:        import wicket.session.pagemap.IPageMapEvictionStrategy;
0056:        import wicket.session.pagemap.LeastRecentlyAccessedEvictionStrategy;
0057:        import wicket.util.convert.ConverterFactory;
0058:        import wicket.util.convert.IConverterFactory;
0059:        import wicket.util.crypt.CachingSunJceCryptFactory;
0060:        import wicket.util.crypt.ICryptFactory;
0061:        import wicket.util.file.IResourceFinder;
0062:        import wicket.util.file.IResourcePath;
0063:        import wicket.util.file.Path;
0064:        import wicket.util.resource.locator.CompoundResourceStreamLocator;
0065:        import wicket.util.resource.locator.IResourceStreamLocator;
0066:        import wicket.util.string.Strings;
0067:        import wicket.util.time.Duration;
0068:        import wicket.util.watch.ModificationWatcher;
0069:
0070:        /**
0071:         * Contains settings exposed via IXXXSettings interfaces. It is not a good idea
0072:         * to use this class directly, instead use the provided IXXXSettings interfaces.
0073:         * 
0074:         * @author Jonathan Locke
0075:         * @author Chris Turner
0076:         * @author Eelco Hillenius
0077:         * @author Juergen Donnerstag
0078:         * @author Johan Compagner
0079:         * @author Igor Vaynberg (ivaynberg)
0080:         * @author Martijn Dashorst
0081:         */
0082:        public final class Settings implements  IApplicationSettings,
0083:                IDebugSettings, IExceptionSettings, IMarkupSettings,
0084:                IPageSettings, IRequestCycleSettings, IResourceSettings,
0085:                ISecuritySettings, ISessionSettings, IAjaxSettings,
0086:                IFrameworkSettings {
0087:            /** Class of access denied page. */
0088:            private Class accessDeniedPage;
0089:
0090:            /** ajax debug mode status */
0091:            private boolean ajaxDebugModeEnabled = false;
0092:
0093:            /** The application */
0094:            private Application application;
0095:
0096:            /** The authorization strategy. */
0097:            private IAuthorizationStrategy authorizationStrategy = IAuthorizationStrategy.ALLOW_ALL;
0098:
0099:            /** Application default for automatically resolving hrefs */
0100:            private boolean automaticLinking = false;
0101:
0102:            /**
0103:             * Whether Wicket should try to support multiple windows transparently, true
0104:             * by default.
0105:             */
0106:            private boolean automaticMultiWindowSupport = true;
0107:
0108:            /** True if the response should be buffered */
0109:            private boolean bufferResponse = true;
0110:
0111:            /** class resolver to find classes */
0112:            private IClassResolver classResolver = new DefaultClassResolver();
0113:
0114:            /** List of (static) ComponentResolvers */
0115:            private List componentResolvers = new ArrayList();
0116:
0117:            /** True to check that each component on a page is used */
0118:            private boolean componentUseCheck = true;
0119:
0120:            /** True if multiple tabs/spaces should be compressed to a single space */
0121:            private boolean compressWhitespace = false;
0122:
0123:            /** The context path that should be used for url prefixing */
0124:            private String contextPath;
0125:
0126:            /**
0127:             * Factory for the converter instance; default to the non localized factory
0128:             * {@link ConverterFactory}.
0129:             */
0130:            private IConverterFactory converterFactory = new ConverterFactory();
0131:
0132:            /** Default values for persistence of form data (by means of cookies) */
0133:            private CookieValuePersisterSettings cookieValuePersisterSettings = new CookieValuePersisterSettings();
0134:
0135:            /** facotry for creating crypt objects */
0136:            private ICryptFactory cryptFactory;
0137:
0138:            /** Default markup for after a disabled link */
0139:            private String defaultAfterDisabledLink = "</em>";
0140:
0141:            /** Default markup for before a disabled link */
0142:            private String defaultBeforeDisabledLink = "<em>";
0143:
0144:            /** The default locale to use */
0145:            private Locale defaultLocale = Locale.getDefault();
0146:
0147:            /** Default markup encoding. If null, the OS default will be used */
0148:            private String defaultMarkupEncoding;
0149:
0150:            /**
0151:             * Whether Wicket should try to get extensive client info by redirecting to
0152:             * {@link BrowserInfoPage a page that polls for client capabilities}. This
0153:             * method is used by the default implementation of {@link #newClientInfo()},
0154:             * so if that method is overriden, there is no guarantee this method will be
0155:             * taken into account. False by default.
0156:             */
0157:            private boolean gatherExtendedBrowserInfo = false;
0158:
0159:            /** Class of internal error page. */
0160:            private Class internalErrorPage;
0161:
0162:            /** I18N support */
0163:            private Localizer localizer;
0164:
0165:            /** Factory for creating markup parsers */
0166:            private IMarkupParserFactory markupParserFactory;
0167:
0168:            /** To help prevent denial of service attacks */
0169:            private int maxPageMaps = 5;
0170:
0171:            /** The maximum number of versions of a page to track */
0172:            private int maxPageVersions = Integer.MAX_VALUE;
0173:
0174:            /** Map to look up resource factories by name */
0175:            private Map nameToResourceFactory = new HashMap();
0176:
0177:            /** True if string resource loaders have been overridden */
0178:            private boolean overriddenStringResourceLoaders = false;
0179:
0180:            /** The package resource guard. */
0181:            private IPackageResourceGuard packageResourceGuard = new PackageResourceGuard();
0182:
0183:            /** The error page displayed when an expired page is accessed. */
0184:            private Class pageExpiredErrorPage;
0185:
0186:            /** factory to create new Page objects */
0187:            private IPageFactory pageFactory = new DefaultPageFactory();
0188:
0189:            /** The eviction strategy. */
0190:            private IPageMapEvictionStrategy pageMapEvictionStrategy = new LeastRecentlyAccessedEvictionStrategy(
0191:                    5);
0192:
0193:            /** The factory to be used for the property files */
0194:            private wicket.resource.IPropertiesFactory propertiesFactory;
0195:
0196:            /**
0197:             * The render strategy, defaults to 'REDIRECT_TO_BUFFER'. This property
0198:             * influences the default way in how a logical request that consists of an
0199:             * 'action' and a 'render' part is handled, and is mainly used to have a
0200:             * means to circumvent the 'refresh' problem.
0201:             */
0202:            private IRequestCycleSettings.RenderStrategy renderStrategy = REDIRECT_TO_BUFFER;
0203:
0204:            /** Filesystem Path to search for resources */
0205:            private IResourceFinder resourceFinder = new Path();
0206:
0207:            /** Frequency at which files should be polled */
0208:            private Duration resourcePollFrequency = null;
0209:
0210:            /** resource locator for this application */
0211:            private IResourceStreamLocator resourceStreamLocator;
0212:
0213:            /** ModificationWatcher to watch for changes in markup files */
0214:            private ModificationWatcher resourceWatcher;
0215:
0216:            /** List of {@link IResponseFilter}s. */
0217:            private List responseFilters;
0218:
0219:            /**
0220:             * In order to do proper form parameter decoding it is important that the
0221:             * response and the following request have the same encoding. see
0222:             * http://www.crazysquirrel.com/computing/general/form-encoding.jspx for
0223:             * additional information.
0224:             */
0225:            private String responseRequestEncoding = "UTF-8";
0226:
0227:            /** Flag for serialize session attributes feature */
0228:            private boolean serializeSessionAttributes = false;
0229:
0230:            /** Chain of string resource loaders to use */
0231:            private List stringResourceLoaders = new ArrayList(4);
0232:
0233:            /** Should HTML comments be stripped during rendering? */
0234:            private boolean stripComments = false;
0235:
0236:            /**
0237:             * If true, wicket tags ( <wicket: ..>) and wicket:id attributes we be
0238:             * removed from output
0239:             */
0240:            private boolean stripWicketTags = false;
0241:
0242:            /** In order to remove <?xml?> from output as required by IE quirks mode */
0243:            private boolean stripXmlDeclarationFromOutput;
0244:
0245:            /** Flags used to determine how to behave if resources are not found */
0246:            private boolean throwExceptionOnMissingResource = true;
0247:
0248:            /**
0249:             * The time that a request will by default be waiting for the previous
0250:             * request to be handled before giving up. Defaults to one minute.
0251:             */
0252:            private Duration timeout = Duration.ONE_MINUTE;
0253:
0254:            /** Authorizer for component instantiations */
0255:            private IUnauthorizedComponentInstantiationListener unauthorizedComponentInstantiationListener = new IUnauthorizedComponentInstantiationListener() {
0256:                /**
0257:                 * Called when an unauthorized component instantiation is about to take
0258:                 * place (but before it happens).
0259:                 * 
0260:                 * @param component
0261:                 *            The partially constructed component (only the id is
0262:                 *            guaranteed to be valid).
0263:                 */
0264:                public void onUnauthorizedInstantiation(
0265:                        final Component component) {
0266:                    throw new UnauthorizedInstantiationException(component
0267:                            .getClass());
0268:                }
0269:            };
0270:
0271:            /** Type of handling for unexpected exceptions */
0272:            private UnexpectedExceptionDisplay unexpectedExceptionDisplay = SHOW_EXCEPTION_PAGE;
0273:
0274:            /** Determines behavior of string resource loading if string is missing */
0275:            private boolean useDefaultOnMissingResource = true;
0276:
0277:            /** Determines if pages should be managed by a version manager by default */
0278:            private boolean versionPagesByDefault = true;
0279:
0280:            /**
0281:             * Create the application settings, carrying out any necessary
0282:             * initialisations.
0283:             * 
0284:             * @param application
0285:             *            The application that these settings are for
0286:             */
0287:            public Settings(final Application application) {
0288:                this .application = application;
0289:                this .markupParserFactory = new MarkupParserFactory(application);
0290:                stringResourceLoaders.add(new ComponentStringResourceLoader(
0291:                        application));
0292:                stringResourceLoaders.add(new ClassStringResourceLoader(
0293:                        application, this .application.getClass()));
0294:            }
0295:
0296:            /**
0297:             * @see wicket.settings.IPageSettings#addComponentResolver(wicket.markup.resolver.IComponentResolver)
0298:             */
0299:            public void addComponentResolver(IComponentResolver resolver) {
0300:                componentResolvers.add(resolver);
0301:            }
0302:
0303:            /**
0304:             * @see wicket.settings.IResourceSettings#addResourceFactory(java.lang.String,
0305:             *      wicket.IResourceFactory)
0306:             */
0307:            public void addResourceFactory(final String name,
0308:                    IResourceFactory resourceFactory) {
0309:                nameToResourceFactory.put(name, resourceFactory);
0310:            }
0311:
0312:            /**
0313:             * @see wicket.settings.IResourceSettings#addResourceFolder(java.lang.String)
0314:             */
0315:            public void addResourceFolder(final String resourceFolder) {
0316:                // Get resource finder
0317:                final IResourceFinder finder = getResourceFinder();
0318:
0319:                // Make sure it's a path
0320:                if (!(finder instanceof  IResourcePath)) {
0321:                    throw new IllegalArgumentException(
0322:                            "To add a resource folder, the application's resource finder must be an instance of IResourcePath");
0323:                }
0324:
0325:                // Cast to resource path and add folder
0326:                final IResourcePath path = (IResourcePath) finder;
0327:                path.add(resourceFolder);
0328:            }
0329:
0330:            /**
0331:             * @see wicket.settings.IRequestCycleSettings#addResponseFilter(wicket.IResponseFilter)
0332:             */
0333:            public void addResponseFilter(IResponseFilter responseFilter) {
0334:                if (responseFilters == null) {
0335:                    responseFilters = new ArrayList(3);
0336:                }
0337:                responseFilters.add(responseFilter);
0338:            }
0339:
0340:            /**
0341:             * @see wicket.settings.IResourceSettings#addStringResourceLoader(wicket.resource.loader.IStringResourceLoader)
0342:             */
0343:            public void addStringResourceLoader(
0344:                    final IStringResourceLoader loader) {
0345:                if (!overriddenStringResourceLoaders) {
0346:                    stringResourceLoaders.clear();
0347:                    overriddenStringResourceLoaders = true;
0348:                }
0349:                stringResourceLoaders.add(loader);
0350:            }
0351:
0352:            /**
0353:             * @see wicket.settings.IApplicationSettings#getAccessDeniedPage()
0354:             */
0355:            public Class getAccessDeniedPage() {
0356:                return accessDeniedPage;
0357:            }
0358:
0359:            /**
0360:             * @see wicket.settings.ISecuritySettings#getAuthorizationStrategy()
0361:             */
0362:            public IAuthorizationStrategy getAuthorizationStrategy() {
0363:                return authorizationStrategy;
0364:            }
0365:
0366:            /**
0367:             * @see wicket.settings.IMarkupSettings#getAutomaticLinking()
0368:             */
0369:            public boolean getAutomaticLinking() {
0370:                return automaticLinking;
0371:            }
0372:
0373:            /**
0374:             * @see wicket.settings.IPageSettings#getAutomaticMultiWindowSupport()
0375:             */
0376:            public boolean getAutomaticMultiWindowSupport() {
0377:                return automaticMultiWindowSupport;
0378:            }
0379:
0380:            /**
0381:             * @see wicket.settings.IRequestCycleSettings#getBufferResponse()
0382:             */
0383:            public boolean getBufferResponse() {
0384:                return bufferResponse;
0385:            }
0386:
0387:            /**
0388:             * @see wicket.settings.IApplicationSettings#getClassResolver()
0389:             */
0390:            public IClassResolver getClassResolver() {
0391:                return classResolver;
0392:            }
0393:
0394:            /**
0395:             * Get the (modifiable) list of IComponentResolvers.
0396:             * 
0397:             * @see AutoComponentResolver for an example
0398:             * @return List of ComponentResolvers
0399:             */
0400:            public List getComponentResolvers() {
0401:                return componentResolvers;
0402:            }
0403:
0404:            /**
0405:             * @see wicket.settings.IDebugSettings#getComponentUseCheck()
0406:             */
0407:            public boolean getComponentUseCheck() {
0408:                return this .componentUseCheck;
0409:            }
0410:
0411:            /**
0412:             * @see wicket.settings.IMarkupSettings#getCompressWhitespace()
0413:             */
0414:            public boolean getCompressWhitespace() {
0415:                return compressWhitespace;
0416:            }
0417:
0418:            /**
0419:             * @see wicket.settings.IApplicationSettings#getContextPath()
0420:             */
0421:            public String getContextPath() {
0422:                // Set the default context path if the context path is not already
0423:                // set (previous time or by the developer itself)
0424:                // This all to do missing api in the servlet spec.. You can't get a
0425:                // context path from the servlet context, which is just stupid.
0426:                if (contextPath == null
0427:                        && RequestCycle.get().getRequest() instanceof  WebRequest) {
0428:                    contextPath = ((WebRequest) RequestCycle.get().getRequest())
0429:                            .getContextPath();
0430:                }
0431:                return contextPath;
0432:            }
0433:
0434:            /**
0435:             * @see wicket.settings.IApplicationSettings#getConverterFactory()
0436:             */
0437:            public IConverterFactory getConverterFactory() {
0438:                return converterFactory;
0439:            }
0440:
0441:            /**
0442:             * @see wicket.settings.ISecuritySettings#getCookieValuePersisterSettings()
0443:             */
0444:            public CookieValuePersisterSettings getCookieValuePersisterSettings() {
0445:                return cookieValuePersisterSettings;
0446:            }
0447:
0448:            /**
0449:             * @see wicket.settings.ISecuritySettings#getCryptFactory()
0450:             */
0451:            public synchronized ICryptFactory getCryptFactory() {
0452:                if (cryptFactory == null) {
0453:                    cryptFactory = new CachingSunJceCryptFactory(
0454:                            ISecuritySettings.DEFAULT_ENCRYPTION_KEY);
0455:                }
0456:                return cryptFactory;
0457:            }
0458:
0459:            /**
0460:             * @see wicket.settings.IMarkupSettings#getDefaultAfterDisabledLink()
0461:             */
0462:            public String getDefaultAfterDisabledLink() {
0463:                return defaultAfterDisabledLink;
0464:            }
0465:
0466:            /**
0467:             * @see wicket.settings.IMarkupSettings#getDefaultBeforeDisabledLink()
0468:             */
0469:            public String getDefaultBeforeDisabledLink() {
0470:                return defaultBeforeDisabledLink;
0471:            }
0472:
0473:            /**
0474:             * @see wicket.settings.IApplicationSettings#getDefaultLocale()
0475:             */
0476:            public Locale getDefaultLocale() {
0477:                return defaultLocale;
0478:            }
0479:
0480:            /**
0481:             * @see wicket.settings.IMarkupSettings#getDefaultMarkupEncoding()
0482:             */
0483:            public String getDefaultMarkupEncoding() {
0484:                return defaultMarkupEncoding;
0485:            }
0486:
0487:            /**
0488:             * @see wicket.settings.IRequestCycleSettings#getGatherExtendedBrowserInfo()
0489:             */
0490:            public boolean getGatherExtendedBrowserInfo() {
0491:                return gatherExtendedBrowserInfo;
0492:            }
0493:
0494:            /**
0495:             * @see wicket.settings.IApplicationSettings#getInternalErrorPage()
0496:             */
0497:            public Class getInternalErrorPage() {
0498:                return internalErrorPage;
0499:            }
0500:
0501:            /**
0502:             * @see wicket.settings.IResourceSettings#getLocalizer()
0503:             */
0504:            public Localizer getLocalizer() {
0505:                if (localizer == null) {
0506:                    this .localizer = new Localizer(application);
0507:                }
0508:                return localizer;
0509:            }
0510:
0511:            /**
0512:             * @see wicket.settings.IMarkupSettings#getMarkupParserFactory()
0513:             */
0514:            public IMarkupParserFactory getMarkupParserFactory() {
0515:                return markupParserFactory;
0516:            }
0517:
0518:            /**
0519:             * @see wicket.settings.ISessionSettings#getMaxPageMaps()
0520:             */
0521:            public final int getMaxPageMaps() {
0522:                return maxPageMaps;
0523:            }
0524:
0525:            /**
0526:             * @see wicket.settings.IPageSettings#getMaxPageVersions()
0527:             */
0528:            public int getMaxPageVersions() {
0529:                return maxPageVersions;
0530:            }
0531:
0532:            /**
0533:             * @see wicket.settings.IResourceSettings#getPackageResourceGuard()
0534:             */
0535:            public IPackageResourceGuard getPackageResourceGuard() {
0536:                return packageResourceGuard;
0537:            }
0538:
0539:            /**
0540:             * @see wicket.settings.IApplicationSettings#getPageExpiredErrorPage()
0541:             */
0542:            public Class getPageExpiredErrorPage() {
0543:                return pageExpiredErrorPage;
0544:            }
0545:
0546:            /**
0547:             * @see wicket.settings.ISessionSettings#getPageFactory()
0548:             */
0549:            public IPageFactory getPageFactory() {
0550:                return pageFactory;
0551:            }
0552:
0553:            /**
0554:             * @see wicket.settings.ISessionSettings#getPageMapEvictionStrategy()
0555:             */
0556:            public IPageMapEvictionStrategy getPageMapEvictionStrategy() {
0557:                return pageMapEvictionStrategy;
0558:            }
0559:
0560:            /**
0561:             * @see wicket.settings.IResourceSettings#getPropertiesFactory()
0562:             */
0563:            public wicket.resource.IPropertiesFactory getPropertiesFactory() {
0564:                if (propertiesFactory == null) {
0565:                    propertiesFactory = new PropertiesFactory();
0566:                }
0567:                return propertiesFactory;
0568:            }
0569:
0570:            /**
0571:             * @see wicket.settings.IRequestCycleSettings#getRenderStrategy()
0572:             */
0573:            public IRequestCycleSettings.RenderStrategy getRenderStrategy() {
0574:                return renderStrategy;
0575:            }
0576:
0577:            /**
0578:             * @see wicket.settings.IResourceSettings#getResourceFactory(java.lang.String)
0579:             */
0580:            public IResourceFactory getResourceFactory(final String name) {
0581:                return (IResourceFactory) nameToResourceFactory.get(name);
0582:            }
0583:
0584:            /**
0585:             * @see wicket.settings.IResourceSettings#getResourceFinder()
0586:             */
0587:            public IResourceFinder getResourceFinder() {
0588:                return resourceFinder;
0589:            }
0590:
0591:            /**
0592:             * @see wicket.settings.IResourceSettings#getResourcePollFrequency()
0593:             */
0594:            public Duration getResourcePollFrequency() {
0595:                return resourcePollFrequency;
0596:            }
0597:
0598:            /**
0599:             * @see wicket.settings.IResourceSettings#getResourceStreamLocator()
0600:             */
0601:            public IResourceStreamLocator getResourceStreamLocator() {
0602:                if (resourceStreamLocator == null) {
0603:                    // Create compound resource locator using source path from
0604:                    // application settings
0605:                    resourceStreamLocator = new CompoundResourceStreamLocator(
0606:                            getResourceFinder());
0607:                }
0608:                return resourceStreamLocator;
0609:            }
0610:
0611:            /**
0612:             * @see wicket.settings.IResourceSettings#getResourceWatcher()
0613:             */
0614:            public ModificationWatcher getResourceWatcher() {
0615:                if (resourceWatcher == null) {
0616:                    final Duration pollFrequency = getResourcePollFrequency();
0617:                    if (pollFrequency != null) {
0618:                        resourceWatcher = new ModificationWatcher(pollFrequency);
0619:                    }
0620:                }
0621:                return resourceWatcher;
0622:            }
0623:
0624:            /**
0625:             * @see wicket.settings.IRequestCycleSettings#getResponseFilters()
0626:             */
0627:            public List getResponseFilters() {
0628:                if (responseFilters == null) {
0629:                    return null;
0630:                } else {
0631:                    return Collections.unmodifiableList(responseFilters);
0632:                }
0633:            }
0634:
0635:            /**
0636:             * @see wicket.settings.IRequestCycleSettings#getResponseRequestEncoding()
0637:             */
0638:            public String getResponseRequestEncoding() {
0639:                return responseRequestEncoding;
0640:            }
0641:
0642:            /**
0643:             * 
0644:             * @see wicket.settings.IDebugSettings#getSerializeSessionAttributes()
0645:             */
0646:            public boolean getSerializeSessionAttributes() {
0647:                return serializeSessionAttributes;
0648:            }
0649:
0650:            /**
0651:             * @see wicket.settings.IResourceSettings#getStringResourceLoaders()
0652:             */
0653:            public List getStringResourceLoaders() {
0654:                return Collections.unmodifiableList(stringResourceLoaders);
0655:            }
0656:
0657:            /**
0658:             * @see wicket.settings.IMarkupSettings#getStripComments()
0659:             */
0660:            public boolean getStripComments() {
0661:                return stripComments;
0662:            }
0663:
0664:            /**
0665:             * @see wicket.settings.IMarkupSettings#getStripWicketTags()
0666:             */
0667:            public boolean getStripWicketTags() {
0668:                return this .stripWicketTags;
0669:            }
0670:
0671:            /**
0672:             * @see wicket.settings.IMarkupSettings#getStripXmlDeclarationFromOutput()
0673:             */
0674:            public boolean getStripXmlDeclarationFromOutput() {
0675:                return this .stripXmlDeclarationFromOutput;
0676:            }
0677:
0678:            /**
0679:             * @see wicket.settings.IResourceSettings#getThrowExceptionOnMissingResource()
0680:             */
0681:            public boolean getThrowExceptionOnMissingResource() {
0682:                return throwExceptionOnMissingResource;
0683:            }
0684:
0685:            /**
0686:             * @see wicket.settings.IRequestCycleSettings#getTimeout()
0687:             */
0688:            public Duration getTimeout() {
0689:                return timeout;
0690:            }
0691:
0692:            /**
0693:             * @see wicket.settings.ISecuritySettings#getUnauthorizedComponentInstantiationListener()
0694:             */
0695:            public IUnauthorizedComponentInstantiationListener getUnauthorizedComponentInstantiationListener() {
0696:                return unauthorizedComponentInstantiationListener;
0697:            }
0698:
0699:            /**
0700:             * @see wicket.settings.IRequestCycleSettings#getUnexpectedExceptionDisplay()
0701:             */
0702:            public UnexpectedExceptionDisplay getUnexpectedExceptionDisplay() {
0703:                return unexpectedExceptionDisplay;
0704:            }
0705:
0706:            /**
0707:             * @see wicket.settings.IResourceSettings#getUseDefaultOnMissingResource()
0708:             */
0709:            public boolean getUseDefaultOnMissingResource() {
0710:                return useDefaultOnMissingResource;
0711:            }
0712:
0713:            /**
0714:             * @see wicket.settings.IFrameworkSettings#getVersion()
0715:             */
0716:            public String getVersion() {
0717:                String implVersion = null;
0718:                Package pkg = this .getClass().getPackage();
0719:                if (pkg != null) {
0720:                    implVersion = pkg.getImplementationVersion();
0721:                }
0722:                return Strings.isEmpty(implVersion) ? "n/a" : implVersion;
0723:            }
0724:
0725:            /**
0726:             * @see wicket.settings.IPageSettings#getVersionPagesByDefault()
0727:             */
0728:            public boolean getVersionPagesByDefault() {
0729:                return versionPagesByDefault;
0730:            }
0731:
0732:            /**
0733:             * @see wicket.settings.IDebugSettings#isAjaxDebugModeEnabled()
0734:             */
0735:            public boolean isAjaxDebugModeEnabled() {
0736:                return ajaxDebugModeEnabled;
0737:            }
0738:
0739:            /**
0740:             * @see wicket.settings.IApplicationSettings#setAccessDeniedPage(java.lang.Class)
0741:             */
0742:            public void setAccessDeniedPage(Class accessDeniedPage) {
0743:                if (accessDeniedPage == null) {
0744:                    throw new IllegalArgumentException(
0745:                            "Argument accessDeniedPage may not be null");
0746:                }
0747:                checkPageClass(accessDeniedPage);
0748:
0749:                this .accessDeniedPage = accessDeniedPage;
0750:            }
0751:
0752:            /**
0753:             * @see wicket.settings.IDebugSettings#setAjaxDebugModeEnabled(boolean)
0754:             */
0755:            public void setAjaxDebugModeEnabled(boolean enable) {
0756:                ajaxDebugModeEnabled = enable;
0757:            }
0758:
0759:            /**
0760:             * @see wicket.settings.ISecuritySettings#setAuthorizationStrategy(wicket.authorization.IAuthorizationStrategy)
0761:             */
0762:            public void setAuthorizationStrategy(IAuthorizationStrategy strategy) {
0763:                if (strategy == null) {
0764:                    throw new IllegalArgumentException(
0765:                            "authorization strategy cannot be set to null");
0766:                }
0767:                this .authorizationStrategy = strategy;
0768:            }
0769:
0770:            /**
0771:             * @see wicket.settings.IMarkupSettings#setAutomaticLinking(boolean)
0772:             */
0773:            public void setAutomaticLinking(boolean automaticLinking) {
0774:                this .automaticLinking = automaticLinking;
0775:            }
0776:
0777:            /**
0778:             * @see wicket.settings.IPageSettings#setAutomaticMultiWindowSupport(boolean)
0779:             */
0780:            public void setAutomaticMultiWindowSupport(
0781:                    boolean automaticMultiWindowSupport) {
0782:                this .automaticMultiWindowSupport = automaticMultiWindowSupport;
0783:            }
0784:
0785:            /**
0786:             * @see wicket.settings.IRequestCycleSettings#setBufferResponse(boolean)
0787:             */
0788:            public void setBufferResponse(boolean bufferResponse) {
0789:                this .bufferResponse = bufferResponse;
0790:            }
0791:
0792:            /**
0793:             * @see wicket.settings.IApplicationSettings#setClassResolver(wicket.application.IClassResolver)
0794:             */
0795:            public void setClassResolver(
0796:                    final IClassResolver defaultClassResolver) {
0797:                this .classResolver = defaultClassResolver;
0798:            }
0799:
0800:            /**
0801:             * @see wicket.settings.IDebugSettings#setComponentUseCheck(boolean)
0802:             */
0803:            public void setComponentUseCheck(final boolean componentUseCheck) {
0804:                this .componentUseCheck = componentUseCheck;
0805:            }
0806:
0807:            /**
0808:             * @see wicket.settings.IMarkupSettings#setCompressWhitespace(boolean)
0809:             */
0810:            public void setCompressWhitespace(final boolean compressWhitespace) {
0811:                this .compressWhitespace = compressWhitespace;
0812:            }
0813:
0814:            /**
0815:             * @see wicket.settings.IApplicationSettings#setContextPath(java.lang.String)
0816:             */
0817:            public void setContextPath(String contextPath) {
0818:                if (contextPath != null) {
0819:                    if (!contextPath.startsWith("/")
0820:                            && !contextPath.startsWith("http:")
0821:                            && !contextPath.startsWith("https:")) {
0822:                        this .contextPath = "/" + contextPath;
0823:                    } else {
0824:                        this .contextPath = contextPath;
0825:                    }
0826:                }
0827:            }
0828:
0829:            /**
0830:             * @see wicket.settings.IApplicationSettings#setConverterFactory(wicket.util.convert.IConverterFactory)
0831:             */
0832:            public void setConverterFactory(IConverterFactory factory) {
0833:                if (factory == null) {
0834:                    throw new IllegalArgumentException(
0835:                            "converter factory cannot be set to null");
0836:                }
0837:                this .converterFactory = factory;
0838:            }
0839:
0840:            /**
0841:             * @see wicket.settings.ISecuritySettings#setCookieValuePersisterSettings(wicket.markup.html.form.persistence.CookieValuePersisterSettings)
0842:             */
0843:            public void setCookieValuePersisterSettings(
0844:                    CookieValuePersisterSettings cookieValuePersisterSettings) {
0845:                this .cookieValuePersisterSettings = cookieValuePersisterSettings;
0846:            }
0847:
0848:            /**
0849:             * @see wicket.settings.ISecuritySettings#setCryptFactory(wicket.util.crypt.ICryptFactory)
0850:             */
0851:            public void setCryptFactory(ICryptFactory cryptFactory) {
0852:                if (cryptFactory == null) {
0853:                    throw new IllegalArgumentException(
0854:                            "cryptFactory cannot be null");
0855:                }
0856:                this .cryptFactory = cryptFactory;
0857:            }
0858:
0859:            /**
0860:             * @see wicket.settings.IMarkupSettings#setDefaultAfterDisabledLink(java.lang.String)
0861:             */
0862:            public void setDefaultAfterDisabledLink(
0863:                    final String defaultAfterDisabledLink) {
0864:                this .defaultAfterDisabledLink = defaultAfterDisabledLink;
0865:            }
0866:
0867:            /**
0868:             * @see wicket.settings.IMarkupSettings#setDefaultBeforeDisabledLink(java.lang.String)
0869:             */
0870:            public void setDefaultBeforeDisabledLink(
0871:                    String defaultBeforeDisabledLink) {
0872:                this .defaultBeforeDisabledLink = defaultBeforeDisabledLink;
0873:            }
0874:
0875:            /**
0876:             * @see wicket.settings.IApplicationSettings#setDefaultLocale(java.util.Locale)
0877:             */
0878:            public void setDefaultLocale(Locale defaultLocale) {
0879:                this .defaultLocale = defaultLocale;
0880:            }
0881:
0882:            /**
0883:             * @see wicket.settings.IMarkupSettings#setDefaultMarkupEncoding(java.lang.String)
0884:             */
0885:            public void setDefaultMarkupEncoding(final String encoding) {
0886:                this .defaultMarkupEncoding = encoding;
0887:            }
0888:
0889:            /**
0890:             * @see wicket.settings.IRequestCycleSettings#setGatherExtendedBrowserInfo(boolean)
0891:             */
0892:            public void setGatherExtendedBrowserInfo(
0893:                    boolean gatherExtendedBrowserInfo) {
0894:                this .gatherExtendedBrowserInfo = gatherExtendedBrowserInfo;
0895:            }
0896:
0897:            /**
0898:             * @see wicket.settings.IApplicationSettings#setInternalErrorPage(java.lang.Class)
0899:             */
0900:            public void setInternalErrorPage(final Class internalErrorPage) {
0901:                if (internalErrorPage == null) {
0902:                    throw new IllegalArgumentException(
0903:                            "Argument internalErrorPage may not be null");
0904:                }
0905:                checkPageClass(internalErrorPage);
0906:
0907:                this .internalErrorPage = internalErrorPage;
0908:            }
0909:
0910:            /**
0911:             * @see wicket.settings.IMarkupSettings#setMarkupParserFactory(wicket.markup.IMarkupParserFactory)
0912:             */
0913:            public void setMarkupParserFactory(IMarkupParserFactory factory) {
0914:                if (factory == null) {
0915:                    throw new IllegalArgumentException(
0916:                            "markup parser factory cannot be null");
0917:                }
0918:
0919:                this .markupParserFactory = factory;
0920:            }
0921:
0922:            /**
0923:             * @see wicket.settings.ISessionSettings#setMaxPageMaps(int)
0924:             */
0925:            public final void setMaxPageMaps(int maxPageMaps) {
0926:                this .maxPageMaps = maxPageMaps;
0927:            }
0928:
0929:            /**
0930:             * @see wicket.settings.IPageSettings#setMaxPageVersions(int)
0931:             */
0932:            public void setMaxPageVersions(int maxPageVersions) {
0933:                if (maxPageVersions < 0) {
0934:                    throw new IllegalArgumentException(
0935:                            "Value for maxPageVersions must be >= 0");
0936:                }
0937:                this .maxPageVersions = maxPageVersions;
0938:            }
0939:
0940:            /**
0941:             * @see wicket.settings.IResourceSettings#setPackageResourceGuard(wicket.markup.html.IPackageResourceGuard)
0942:             */
0943:            public void setPackageResourceGuard(
0944:                    IPackageResourceGuard packageResourceGuard) {
0945:                if (packageResourceGuard == null) {
0946:                    throw new IllegalArgumentException(
0947:                            "Argument packageResourceGuard may not be null");
0948:                }
0949:                this .packageResourceGuard = packageResourceGuard;
0950:            }
0951:
0952:            /**
0953:             * @see wicket.settings.IApplicationSettings#setPageExpiredErrorPage(java.lang.Class)
0954:             */
0955:            public void setPageExpiredErrorPage(final Class pageExpiredErrorPage) {
0956:                if (pageExpiredErrorPage == null) {
0957:                    throw new IllegalArgumentException(
0958:                            "Argument pageExpiredErrorPage may not be null");
0959:                }
0960:                checkPageClass(pageExpiredErrorPage);
0961:
0962:                this .pageExpiredErrorPage = pageExpiredErrorPage;
0963:            }
0964:
0965:            /**
0966:             * @see wicket.settings.ISessionSettings#setPageFactory(wicket.IPageFactory)
0967:             */
0968:            public void setPageFactory(final IPageFactory defaultPageFactory) {
0969:                this .pageFactory = defaultPageFactory;
0970:            }
0971:
0972:            /**
0973:             * @see wicket.settings.ISessionSettings#setPageMapEvictionStrategy(wicket.session.pagemap.IPageMapEvictionStrategy)
0974:             */
0975:            public void setPageMapEvictionStrategy(
0976:                    IPageMapEvictionStrategy pageMapEvictionStrategy) {
0977:                this .pageMapEvictionStrategy = pageMapEvictionStrategy;
0978:            }
0979:
0980:            /**
0981:             * @see wicket.settings.IResourceSettings#setPropertiesFactory(wicket.resource.PropertiesFactory)
0982:             */
0983:            public void setPropertiesFactory(
0984:                    wicket.resource.IPropertiesFactory factory) {
0985:                this .propertiesFactory = factory;
0986:            }
0987:
0988:            /**
0989:             * @see wicket.settings.IRequestCycleSettings#setRenderStrategy(wicket.settings.Settings.RenderStrategy)
0990:             */
0991:            public void setRenderStrategy(
0992:                    IRequestCycleSettings.RenderStrategy renderStrategy) {
0993:                this .renderStrategy = renderStrategy;
0994:            }
0995:
0996:            /**
0997:             * @see wicket.settings.IResourceSettings#setResourceFinder(wicket.util.file.IResourceFinder)
0998:             */
0999:            public void setResourceFinder(final IResourceFinder resourceFinder) {
1000:                this .resourceFinder = resourceFinder;
1001:
1002:                // Cause resource locator to get recreated
1003:                this .resourceStreamLocator = null;
1004:            }
1005:
1006:            /**
1007:             * @see wicket.settings.IResourceSettings#setResourcePollFrequency(wicket.util.time.Duration)
1008:             */
1009:            public void setResourcePollFrequency(
1010:                    final Duration resourcePollFrequency) {
1011:                this .resourcePollFrequency = resourcePollFrequency;
1012:            }
1013:
1014:            /**
1015:             * @see wicket.settings.IResourceSettings#setResourceStreamLocator(wicket.util.resource.locator.IResourceStreamLocator)
1016:             */
1017:            public void setResourceStreamLocator(
1018:                    IResourceStreamLocator resourceStreamLocator) {
1019:                this .resourceStreamLocator = resourceStreamLocator;
1020:            }
1021:
1022:            /**
1023:             * @see wicket.settings.IRequestCycleSettings#setResponseRequestEncoding(java.lang.String)
1024:             */
1025:            public void setResponseRequestEncoding(
1026:                    final String responseRequestEncoding) {
1027:                this .responseRequestEncoding = responseRequestEncoding;
1028:            }
1029:
1030:            /**
1031:             * 
1032:             * @see wicket.settings.IDebugSettings#setSerializeSessionAttributes(boolean)
1033:             */
1034:            public void setSerializeSessionAttributes(boolean serialize) {
1035:                this .serializeSessionAttributes = serialize;
1036:            }
1037:
1038:            /**
1039:             * @see wicket.settings.IMarkupSettings#setStripComments(boolean)
1040:             */
1041:            public void setStripComments(boolean stripComments) {
1042:                this .stripComments = stripComments;
1043:            }
1044:
1045:            /**
1046:             * @see wicket.settings.IMarkupSettings#setStripWicketTags(boolean)
1047:             */
1048:            public void setStripWicketTags(boolean stripWicketTags) {
1049:                this .stripWicketTags = stripWicketTags;
1050:            }
1051:
1052:            /**
1053:             * @see wicket.settings.IMarkupSettings#setStripXmlDeclarationFromOutput(boolean)
1054:             */
1055:            public void setStripXmlDeclarationFromOutput(final boolean strip) {
1056:                this .stripXmlDeclarationFromOutput = strip;
1057:            }
1058:
1059:            /**
1060:             * @see wicket.settings.IResourceSettings#setThrowExceptionOnMissingResource(boolean)
1061:             */
1062:            public void setThrowExceptionOnMissingResource(
1063:                    final boolean throwExceptionOnMissingResource) {
1064:                this .throwExceptionOnMissingResource = throwExceptionOnMissingResource;
1065:            }
1066:
1067:            /**
1068:             * @see wicket.settings.IRequestCycleSettings#setTimeout(wicket.util.time.Duration)
1069:             */
1070:            public void setTimeout(Duration timeout) {
1071:                if (timeout == null) {
1072:                    throw new IllegalArgumentException("timeout cannot be null");
1073:                }
1074:                this .timeout = timeout;
1075:            }
1076:
1077:            /**
1078:             * @see wicket.settings.ISecuritySettings#setUnauthorizedComponentInstantiationListener(wicket.authorization.IUnauthorizedComponentInstantiationListener)
1079:             */
1080:            public void setUnauthorizedComponentInstantiationListener(
1081:                    IUnauthorizedComponentInstantiationListener unauthorizedComponentInstantiationListener) {
1082:                this .unauthorizedComponentInstantiationListener = unauthorizedComponentInstantiationListener;
1083:            }
1084:
1085:            /**
1086:             * @see wicket.settings.IRequestCycleSettings#setUnexpectedExceptionDisplay(wicket.settings.Settings.UnexpectedExceptionDisplay)
1087:             */
1088:            public void setUnexpectedExceptionDisplay(
1089:                    final UnexpectedExceptionDisplay unexpectedExceptionDisplay) {
1090:                this .unexpectedExceptionDisplay = unexpectedExceptionDisplay;
1091:            }
1092:
1093:            /**
1094:             * @see wicket.settings.IResourceSettings#setUseDefaultOnMissingResource(boolean)
1095:             */
1096:            public void setUseDefaultOnMissingResource(
1097:                    final boolean useDefaultOnMissingResource) {
1098:                this .useDefaultOnMissingResource = useDefaultOnMissingResource;
1099:            }
1100:
1101:            /**
1102:             * @see wicket.settings.IPageSettings#setVersionPagesByDefault(boolean)
1103:             */
1104:            public void setVersionPagesByDefault(boolean pagesVersionedByDefault) {
1105:                this .versionPagesByDefault = pagesVersionedByDefault;
1106:            }
1107:
1108:            /**
1109:             * Throws an IllegalArgumentException if the given class is not a subclass
1110:             * of Page.
1111:             * 
1112:             * @param pageClass
1113:             *            the page class to check
1114:             */
1115:            private void checkPageClass(final Class pageClass) {
1116:                // NOTE: we can't really check on whether it is a bookmarkable page
1117:                // here, as - though the default is that a bookmarkable page must
1118:                // either have a default constructor and/or a constructor with a
1119:                // PageParameters object, this could be different for another
1120:                // IPageFactory implementation
1121:                if (!Page.class.isAssignableFrom(pageClass)) {
1122:                    throw new IllegalArgumentException("argument " + pageClass
1123:                            + " must be a subclass of Page");
1124:                }
1125:            }
1126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.