⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webapplication.java

📁 Wicket一个开发Java Web应用程序框架。它使得开发web应用程序变得容易而轻松。 Wicket利用一个POJO data beans组件使得它可以与任何持久层技术相结合。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	// FIXME remove this method after 1.3.0	public final Session newSession()	{		throw new UnsupportedOperationException("this method is replaced by Application#newSession");	}	/**	 * Create new Wicket Session object. Note, this method is not called if you registered your own	 * ISessionFactory with the Application.	 * 	 * @param request	 * @return The created session	 * @deprecated {@link WebApplication#newSession(Request, Response)}.	 */	// FIXME remove this method after 1.3.0	public final Session newSession(Request request)	{		throw new UnsupportedOperationException("this method is replaced by Application#newSession");	}	/**	 * @see org.apache.wicket.Application#newSession(org.apache.wicket.Request,	 *      org.apache.wicket.Response)	 */	public Session newSession(Request request, Response response)	{		return new WebSession(request);	}	/**	 * @param sessionId	 *            The session id that was destroyed	 */	public void sessionDestroyed(String sessionId)	{		bufferedResponses.remove(sessionId);		IRequestLogger logger = getRequestLogger();		if (logger != null)		{			logger.sessionDestroyed(sessionId);		}	}	/**	 * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.	 * 	 * @param wicketFilter	 *            The wicket filter instance for this application	 */	public final void setWicketFilter(final WicketFilter wicketFilter)	{		this.wicketFilter = wicketFilter;		applicationKey = wicketFilter.getFilterConfig().getFilterName();	}	/**	 * Unmounts whatever encoder is mounted at a given path.	 * 	 * @param path	 *            the path of the encoder to unmount	 */	public final void unmount(String path)	{		getRequestCycleProcessor().getRequestCodingStrategy().unmount(path);	}	/**	 * @return nada	 * @deprecated Replaced by {@link #newRequestCycle(Request, Response)}	 */	// TODO remove after compatibility release.	protected final Object getDefaultRequestCycleFactory()	{		throw new UnsupportedOperationException("obsolete method. see getRequestCycleFactory");	}	/**	 * Initialize; if you need the wicket servlet for initialization, e.g. because you want to read	 * an initParameter from web.xml or you want to read a resource from the servlet's context path,	 * you can override this method and provide custom initialization. This method is called right	 * after this application class is constructed, and the wicket servlet is set. <strong>Use this	 * method for any application setup instead of the constructor.</strong>	 */	protected void init()	{	}	/**	 * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.	 */	protected void internalDestroy()	{		// destroy the resource watcher		ModificationWatcher resourceWatcher = getResourceSettings().getResourceWatcher(false);		if (resourceWatcher != null)		{			resourceWatcher.destroy();		}		super.internalDestroy();		bufferedResponses.clear();		getSessionStore().destroy();		FileCleaner.destroy();	}	/**	 * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.	 * 	 * Internal initialization. First determine the deployment mode. First check the system property	 * -Dwicket.configuration. If it does not exist check the servlet init parameter (	 * <code>&lt;init-param&gt&lt;param-name&gt;configuration&lt;/param-name&gt;</code>). If not	 * found check the servlet context init parameter	 * <code>&lt;context-param&gt&lt;param-name6gt;configuration&lt;/param-name&gt;</code>). If	 * the parameter is "development" (which is default), settings appropriate for development are	 * set. If it's "deployment" , deployment settings are used. If development is specified and a	 * "sourceFolder" init parameter is also set, then resources in that folder will be polled for	 * changes.	 */	protected void internalInit()	{		super.internalInit();		// Set default error pages for HTML markup		getApplicationSettings().setPageExpiredErrorPage(PageExpiredErrorPage.class);		getApplicationSettings().setInternalErrorPage(InternalErrorPage.class);		getApplicationSettings().setAccessDeniedPage(AccessDeniedPage.class);		// Add resolver for automatically resolving HTML links		getPageSettings().addComponentResolver(new AutoLinkResolver());		// Set resource finder to web app path		getResourceSettings().setResourceFinder(getResourceFinder());		// Add optional sourceFolder for resources.		String resourceFolder = getInitParameter("sourceFolder");		if (resourceFolder != null)		{			getResourceSettings().addResourceFolder(resourceFolder);		}		// Configure the app.		configure();	}	/**	 * @see org.apache.wicket.Application#getConfigurationType()	 */	public String getConfigurationType()	{		String result = null;		try		{			result = System.getProperty("wicket." + Application.CONFIGURATION);		}		catch (SecurityException e)		{			// Ignore - we're not allowed to read system properties.		}		// If no system parameter check filter/servlet specific <init-param>		if (result == null)		{			result = getInitParameter(Application.CONFIGURATION);		}		// If no system parameter and no <init-param>, then check		// <context-param>		if (result == null)		{			result = getServletContext().getInitParameter(Application.CONFIGURATION);		}		// Return result if we have found it, else fall back to DEVELOPMENT mode		// as the default.		if (result != null)		{			return result;		}		return Application.DEVELOPMENT;	}	protected IResourceFinder getResourceFinder()	{		return new WebApplicationPath(getServletContext());	}	/**	 * Gets a new request cycle processor for web requests. May be replaced by subclasses which wish	 * to use their own implementation of IRequestCycleProcessor.	 * 	 * NOTE this can't be moved to application as portlets use two different request cycle	 * processors, and hence have two different methods for them, depending on the kind of request.	 * 	 * @return IRequestCycleProcessor	 */	protected IRequestCycleProcessor newRequestCycleProcessor()	{		return new WebRequestCycleProcessor();	}	/**	 * @see org.apache.wicket.Application#newSessionStore()	 */	protected ISessionStore newSessionStore()	{		return new SecondLevelCacheSessionStore(this, new DiskPageStore());	}	/**	 * Create a new WebRequest. Subclasses of WebRequest could e.g. decode and obfuscated URL which	 * has been encoded by an appropriate WebResponse.	 * 	 * @param servletRequest	 * @return a WebRequest object	 */	protected WebRequest newWebRequest(final HttpServletRequest servletRequest)	{		return new ServletWebRequest(servletRequest);	}	/**	 * Create a WebResponse. Subclasses of WebRequest could e.g. encode wicket's default URL and	 * hide the details from the user. A appropriate WebRequest must be implemented and configured	 * to decode the encoded URL.	 * 	 * @param servletResponse	 * @return a WebResponse object	 */	protected WebResponse newWebResponse(final HttpServletResponse servletResponse)	{		return (getRequestCycleSettings().getBufferResponse() ? new BufferedWebResponse(			servletResponse) : new WebResponse(servletResponse));	}	/**	 * Creates a new ajax request target used to control ajax responses	 * 	 * @param page	 *            page on which ajax response is made	 * @return non-null ajax request target instance	 */	public AjaxRequestTarget newAjaxRequestTarget(final Page page)	{		return new AjaxRequestTarget(page);	}	/**	 * Set the application key value	 * 	 * @param applicationKey	 *            Unique application key (typically the filter name).	 */	protected final void setApplicationKey(String applicationKey)	{		this.applicationKey = applicationKey;	}	/**	 * Add a buffered response to the redirect buffer.	 * 	 * @param sessionId	 *            the session id	 * @param bufferId	 *            the id that should be used for storing the buffer	 * @param renderedResponse	 *            the response to buffer	 */	final void addBufferedResponse(String sessionId, String bufferId,		BufferedHttpServletResponse renderedResponse)	{		Map responsesPerSession = (Map)bufferedResponses.get(sessionId);		if (responsesPerSession == null)		{			responsesPerSession = new MostRecentlyUsedMap(4);			bufferedResponses.put(sessionId, responsesPerSession);		}		responsesPerSession.put(bufferId, renderedResponse);	}	/**	 * Log that this application is started.	 */	final void logStarted()	{		String version = getFrameworkSettings().getVersion();		StringBuffer b = new StringBuffer();		b.append("[").append(getName()).append("] Started Wicket ");		if (!"n/a".equals(version))		{			b.append("version ").append(version).append(" ");		}		b.append("in ").append(getConfigurationType()).append(" mode");		log.info(b.toString());		if (DEVELOPMENT.equalsIgnoreCase(getConfigurationType()))		{			outputDevelopmentModeWarning();		}	}	/**	 * This method prints a warning to stderr that we are starting in development mode.	 * <p>	 * If you really need to test Wicket in development mode on a staging server somewhere and are	 * annoying the sysadmin for it with stderr messages, you can override this to make it do	 * something else.	 */	protected void outputDevelopmentModeWarning()	{		System.err.print("********************************************************************\n"			+ "*** WARNING: Wicket is running in DEVELOPMENT mode.              ***\n"			+ "***                               ^^^^^^^^^^^                    ***\n"			+ "*** Do NOT deploy to your live server(s) without changing this.  ***\n"			+ "*** See Application#getConfigurationType() for more information. ***\n"			+ "********************************************************************\n");	}	// TODO remove after deprecation release	/**	 * Returns the redirect map where the buffered render pages are stored in and removes it	 * immediately.	 * 	 * @param sessionId	 *            the session id	 * 	 * @param bufferId	 *            the id of the buffer as passed in as a request parameter	 * @return the buffered response or null if not found (when this request is on a different box	 *         than the original request came in	 */	final BufferedHttpServletResponse popBufferedResponse(String sessionId, String bufferId)	{		Map responsesPerSession = (Map)bufferedResponses.get(sessionId);		if (responsesPerSession != null)		{			BufferedHttpServletResponse buffered = (BufferedHttpServletResponse)responsesPerSession.remove(bufferId);			if (responsesPerSession.size() == 0)			{				bufferedResponses.remove(sessionId);			}			return buffered;		}		return null;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -