当前位置: 首页>>代码示例>>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;未经允许,请勿转载。