本文整理匯總了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);
}
}
}
}