本文整理汇总了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");
}
}
示例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);
}
}
}
}
示例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);
}
}
}
}