📄 application.java
字号:
* configuration type is DEVELOPMENT, resources are polled for changes, component usage is * checked, wicket tags are not stripped from output and a detailed exception page is used. If * the type is DEPLOYMENT, component usage is not checked, wicket tags are stripped from output * and a non-detailed exception page is used to display errors. * <p> * Note that you should not run Wicket in DEVELOPMENT mode on production servers - the various * debugging checks and resource polling is inefficient and may leak resources, particularly on * webapp redeploy. * * @return configuration * @since 1.2.3 (function existed as a property getter) * @since 1.3.0 (abstract, used to configure things) */ public abstract String getConfigurationType(); /** * @return The converter locator for this application */ public final IConverterLocator getConverterLocator() { return converterLocator; } /** * @return Application's debug related settings * @see IDebugSettings * @since 1.2 */ public IDebugSettings getDebugSettings() { return getSettings(); } /** * @return Application's exception handling settings * @see IExceptionSettings * @since 1.2 */ public IExceptionSettings getExceptionSettings() { return getSettings(); } /** * @return Wicket framework settings * @see IFrameworkSettings * @since 1.2 */ public IFrameworkSettings getFrameworkSettings() { return getSettings(); } /** * Application subclasses must specify a home page class by implementing this abstract method. * * @return Home page class for this application */ public abstract Class getHomePage(); /** * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT. * * @return The markup cache associated with the application * @deprecated please use {@link IMarkupSettings#getMarkupCache()} instead */ public final IMarkupCache getMarkupCache() { return getMarkupSettings().getMarkupCache(); } /** * @return Application's markup related settings * @see IMarkupSettings * @since 1.2 */ public IMarkupSettings getMarkupSettings() { return getSettings(); } /** * Gets metadata for this application using the given key. * * @param key * The key for the data * @return The metadata * @see MetaDataKey */ public final Serializable getMetaData(final MetaDataKey key) { return key.get(metaData); } /** * Gets the name of this application. * * @return The application name. */ public final String getName() { return name; } /** * @return Application's page related settings * @see IPageSettings * @since 1.2 */ public IPageSettings getPageSettings() { return getSettings(); } /** * @return Application's request cycle related settings * @see IDebugSettings * @since 1.2 */ public IRequestCycleSettings getRequestCycleSettings() { return getSettings(); } /** * Gets the {@link RequestLogger}. * * @return The RequestLogger */ public final IRequestLogger getRequestLogger() { if (getRequestLoggerSettings().isRequestLoggerEnabled()) { if (requestLogger == null) { requestLogger = newRequestLogger(); } } else { requestLogger = null; } return requestLogger; } /** * @return Application's resources related settings * @see IResourceSettings * @since 1.3 */ public IRequestLoggerSettings getRequestLoggerSettings() { return getSettings(); } /** * @return Application's resources related settings * @see IResourceSettings * @since 1.2 */ public IResourceSettings getResourceSettings() { return getSettings(); } /** * @return Application's security related settings * @see ISecuritySettings * @since 1.2 */ public ISecuritySettings getSecuritySettings() { return getSettings(); } /** * @return Application's session related settings * @see ISessionSettings * @since 1.2 */ public ISessionSettings getSessionSettings() { return getSettings(); } /** * Gets the facade object for working getting/ storing session instances. * * @return The session facade */ public final ISessionStore getSessionStore() { return sessionStore; } /** * Gets the shared resources. * * @return The SharedResources for this application. */ public final SharedResources getSharedResources() { return sharedResources; } /** * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL. * * Initializes wicket components. */ public final void initializeComponents() { // Load any wicket properties files we can find try { // Load properties files used by all libraries final Enumeration resources = Thread.currentThread() .getContextClassLoader() .getResources("wicket.properties"); while (resources.hasMoreElements()) { InputStream in = null; try { final URL url = (URL)resources.nextElement(); final Properties properties = new Properties(); in = url.openStream(); properties.load(in); load(properties); } finally { if (in != null) { in.close(); } } } } catch (IOException e) { throw new WicketRuntimeException("Unable to load initializers file", e); } // now call any initializers we read callInitializers(); } /** * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL. * * @param target */ public void logEventTarget(IRequestTarget target) { } /** * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL. * * @param requestTarget */ public void logResponseTarget(IRequestTarget requestTarget) { } /** * Creates a new RequestCycle object. Override this method if you want to provide a custom * request cycle. * * @param request * The request * @param response * The response * @return The request cycle * * @since 1.3 */ public abstract RequestCycle newRequestCycle(final Request request, final Response response); /** * FOR DEPRECATION ONLY. * * @param application * @param request * @param response * @return nothing * @throws UnsupportedOperationException * always * @deprecated Applications wishing to provide custom request cycles should override method * {@link #newRequestCycle(Request, Response)} */ public final RequestCycle newRequestCycle(Application application, Request request, Response response) { throw new UnsupportedOperationException(); } /** * Creates a new session. Override this method if you want to provide a custom session. * * @param request * The request that will create this session. * @param response * The response to initialize, for example with cookies. This is important to use * cases involving unit testing because those use cases might want to be able to sign * a user in automatically when the session is created. * * @return The session * * @since 1.3 */ public abstract Session newSession(Request request, Response response); /** * Removes a component instantiation listener. This method should typicaly only be called during * application startup; it is not thread safe. * * @param listener * the listener to remove */ public final void removeComponentInstantiationListener( final IComponentInstantiationListener listener) { final IComponentInstantiationListener[] listeners = componentInstantiationListeners; final int len = listeners.length; if (listener != null && len > 0) { int pos = 0; for (pos = 0; pos < len; pos++) { if (listener == listeners[pos]) { break; } } if (pos < len) { listeners[pos] = listeners[len - 1]; final IComponentInstantiationListener[] newListeners = new IComponentInstantiationListener[len - 1]; System.arraycopy(listeners, 0, newListeners, 0, newListeners.length); componentInstantiationListeners = newListeners; } } } /** * Sets the metadata for this application using the given key. If the metadata object is not of * the correct type for the metadata key, an IllegalArgumentException will be thrown. For * information on creating MetaDataKeys, see {@link MetaDataKey}. * * @param key * The singleton key for the metadata * @param object * The metadata object * @throws IllegalArgumentException * @see MetaDataKey */ public final synchronized void setMetaData(final MetaDataKey key, final Serializable object) { metaData = key.set(metaData, object); } /** * Construct and add initializer from the provided class name. * * @param className */ private final void addInitializer(String className) { IInitializer initializer = (IInitializer)Objects.newInstance(className); if (initializer != null) { initializers.add(initializer); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -