當前位置: 首頁>>代碼示例>>Java>>正文


Java DispatcherType.ERROR屬性代碼示例

本文整理匯總了Java中javax.servlet.DispatcherType.ERROR屬性的典型用法代碼示例。如果您正苦於以下問題:Java DispatcherType.ERROR屬性的具體用法?Java DispatcherType.ERROR怎麽用?Java DispatcherType.ERROR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.servlet.DispatcherType的用法示例。


在下文中一共展示了DispatcherType.ERROR屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: putHeaders

@Override
protected void putHeaders(HttpServletResponse response, HttpContent content, long contentLength) {
	super.putHeaders(response, content, contentLength);
	HttpFields fields = ((Response) response).getHttpFields();
	if (requestHolder.get().getDispatcherType() == DispatcherType.ERROR) {
		/*
		 * Do not cache error page and also makes sure that error page is not eligible for 
		 * modification check. That is, error page will be always retrieved.
		 */
           fields.put(HttpHeader.CACHE_CONTROL, "must-revalidate,no-cache,no-store");
	} else if (requestHolder.get().getRequestURI().equals("/favicon.ico")) {
		/*
		 * Make sure favicon request is cached. Otherwise, it will be requested for every 
		 * page request.
		 */
		fields.put(HttpHeader.CACHE_CONTROL, "max-age=86400,public");
	}
}
 
開發者ID:jmfgdev,項目名稱:gitplex-mit,代碼行數:18,代碼來源:AssetServlet.java

示例2: processRequest

/**
 * Prepare the request based on the filter configuration.
 * @param request The servlet request we are processing
 * @param response The servlet response we are creating
 * @param state The RD state
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet error occurs
 */
private void processRequest(ServletRequest request, 
                            ServletResponse response,
                            State state)
    throws IOException, ServletException {
            
    DispatcherType disInt = (DispatcherType) request.getAttribute(Globals.DISPATCHER_TYPE_ATTR);
    if (disInt != null) {
        boolean doInvoke = true;
        
        if (context.getFireRequestListenersOnForwards() &&
                !context.fireRequestInitEvent(request)) {
            doInvoke = false;
        }

        if (doInvoke) {
            if (disInt != DispatcherType.ERROR) {
                state.outerRequest.setAttribute(
                        Globals.DISPATCHER_REQUEST_PATH_ATTR,
                        getCombinedPath());
                state.outerRequest.setAttribute(
                        Globals.DISPATCHER_TYPE_ATTR,
                        DispatcherType.FORWARD);
                invoke(state.outerRequest, response, state);
            } else {
                invoke(state.outerRequest, response, state);
            }
            
            if (context.getFireRequestListenersOnForwards()) {
                context.fireRequestDestroyEvent(request);
            }
        }
    }
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:42,代碼來源:ApplicationDispatcher.java

示例3: processRequest

/**
 * Prepare the request based on the filter configuration.
 * 
 * @param request
 *            The servlet request we are processing
 * @param response
 *            The servlet response we are creating
 * @param state
 *            The RD state
 *
 * @exception IOException
 *                if an input/output error occurs
 * @exception ServletException
 *                if a servlet error occurs
 */
private void processRequest(ServletRequest request, ServletResponse response, State state)
		throws IOException, ServletException {

	DispatcherType disInt = (DispatcherType) request.getAttribute(Globals.DISPATCHER_TYPE_ATTR);
	if (disInt != null) {
		boolean doInvoke = true;

		if (context.getFireRequestListenersOnForwards() && !context.fireRequestInitEvent(request)) {
			doInvoke = false;
		}

		if (doInvoke) {
			if (disInt != DispatcherType.ERROR) {
				state.outerRequest.setAttribute(Globals.DISPATCHER_REQUEST_PATH_ATTR, getCombinedPath());
				state.outerRequest.setAttribute(Globals.DISPATCHER_TYPE_ATTR, DispatcherType.FORWARD);
				invoke(state.outerRequest, response, state);
			} else {
				invoke(state.outerRequest, response, state);
			}

			if (context.getFireRequestListenersOnForwards()) {
				context.fireRequestDestroyEvent(request);
			}
		}
	}
}
 
開發者ID:how2j,項目名稱:lazycat,代碼行數:41,代碼來源:ApplicationDispatcher.java


注:本文中的javax.servlet.DispatcherType.ERROR屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。