亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? webapplicationcontextutils.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.web.context.support;

import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.util.Assert;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Convenience methods for retrieving the root
 * {@link org.springframework.web.context.WebApplicationContext} for a given
 * <code>ServletContext</code>. This is e.g. useful for accessing a Spring
 * context from within custom web views or Struts actions.
 *
 * <p>Note that there are more convenient ways of accessing the root context for
 * many web frameworks, either part of Spring or available as external library.
 * This helper class is just the most generic way to access the root context.
 *
 * @author Juergen Hoeller
 * @see org.springframework.web.context.ContextLoader
 * @see org.springframework.web.servlet.FrameworkServlet
 * @see org.springframework.web.servlet.DispatcherServlet
 * @see org.springframework.web.struts.ActionSupport
 * @see org.springframework.web.struts.DelegatingActionProxy
 * @see org.springframework.web.jsf.FacesContextUtils
 * @see org.springframework.web.jsf.DelegatingVariableResolver
 */
public abstract class WebApplicationContextUtils {
	
	/**
	 * Find the root WebApplicationContext for this web application, which is
	 * typically loaded via {@link org.springframework.web.context.ContextLoaderListener} or
	 * {@link org.springframework.web.context.ContextLoaderServlet}.
	 * <p>Will rethrow an exception that happened on root context startup,
	 * to differentiate between a failed context startup and no context at all.
	 * @param sc ServletContext to find the web application context for
	 * @return the root WebApplicationContext for this web app
	 * @throws IllegalStateException if the root WebApplicationContext could not be found
	 * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
	 */
	public static WebApplicationContext getRequiredWebApplicationContext(ServletContext sc)
	    throws IllegalStateException {

		WebApplicationContext wac = getWebApplicationContext(sc);
		if (wac == null) {
			throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
		}
		return wac;
	}

	/**
	 * Find the root WebApplicationContext for this web application, which is
	 * typically loaded via {@link org.springframework.web.context.ContextLoaderListener} or
	 * {@link org.springframework.web.context.ContextLoaderServlet}.
	 * <p>Will rethrow an exception that happened on root context startup,
	 * to differentiate between a failed context startup and no context at all.
	 * @param sc ServletContext to find the web application context for
	 * @return the root WebApplicationContext for this web app, or <code>null</code> if none
	 * @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
	 */
	public static WebApplicationContext getWebApplicationContext(ServletContext sc) {
		return getWebApplicationContext(sc, WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
	}

	/**
	 * Find a custom WebApplicationContext for this web application.
	 * @param sc ServletContext to find the web application context for
	 * @param attrName the name of the ServletContext attribute to look for
	 * @return the desired WebApplicationContext for this web app, or <code>null</code> if none
	 */
	public static WebApplicationContext getWebApplicationContext(ServletContext sc, String attrName) {
		Assert.notNull(sc, "ServletContext must not be null");
		Object attr = sc.getAttribute(attrName);
		if (attr == null) {
			return null;
		}
		if (attr instanceof RuntimeException) {
			throw (RuntimeException) attr;
		}
		if (attr instanceof Error) {
			throw (Error) attr;
		}
		if (attr instanceof Exception) {
			IllegalStateException ex = new IllegalStateException();
			ex.initCause((Exception) attr);
			throw ex;
		}
		if (!(attr instanceof WebApplicationContext)) {
			throw new IllegalStateException("Context attribute is not of type WebApplicationContext: " + attr);
		}
		return (WebApplicationContext) attr;
	}


	/**
	 * Register web-specific scopes with the given BeanFactory,
	 * as used by the WebApplicationContext.
	 * @param beanFactory the BeanFactory to configure
	 */
	public static void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory) {
		beanFactory.registerScope(WebApplicationContext.SCOPE_REQUEST, new RequestScope());
		beanFactory.registerScope(WebApplicationContext.SCOPE_SESSION, new SessionScope(false));
		beanFactory.registerScope(WebApplicationContext.SCOPE_GLOBAL_SESSION, new SessionScope(true));

		beanFactory.registerResolvableDependency(ServletRequest.class, new ObjectFactory() {
			public Object getObject() {
				RequestAttributes requestAttr = RequestContextHolder.currentRequestAttributes();
				if (!(requestAttr instanceof ServletRequestAttributes)) {
					throw new IllegalStateException("Current request is not a servlet request");
				}
				return ((ServletRequestAttributes) requestAttr).getRequest();
			}
		});
		beanFactory.registerResolvableDependency(HttpSession.class, new ObjectFactory() {
			public Object getObject() {
				RequestAttributes requestAttr = RequestContextHolder.currentRequestAttributes();
				if (!(requestAttr instanceof ServletRequestAttributes)) {
					throw new IllegalStateException("Current request is not a servlet request");
				}
				return ((ServletRequestAttributes) requestAttr).getRequest().getSession();
			}
		});
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区在线观看| 亚洲国产一区视频| 在线观看免费成人| 国产一区久久久| 亚洲国产视频a| 一区二区在线电影| 成人欧美一区二区三区在线播放| 欧美精品一卡两卡| 欧美日韩不卡一区二区| 欧美日韩在线播放三区| 日韩欧美一区二区久久婷婷| 亚洲大片在线观看| 亚洲va中文字幕| 日韩av中文在线观看| 男女激情视频一区| 激情综合色丁香一区二区| 久久精品噜噜噜成人88aⅴ| 麻豆精品国产传媒mv男同| 美女视频黄 久久| 国产一区二区在线影院| www.av精品| 欧美伊人精品成人久久综合97| 色婷婷亚洲精品| 欧美一区二区三区小说| 久久亚洲综合色一区二区三区 | 精品视频色一区| 中文字幕一区二区视频| 欧美日韩一级黄| 欧美精品一区二区不卡| 亚洲三级久久久| 日本不卡123| 成人av午夜影院| 一区二区三区精品在线观看| 天天色综合成人网| 国产suv一区二区三区88区| 色诱视频网站一区| 91精品国产色综合久久不卡电影 | 精品国产电影一区二区| 久久久精品免费免费| 91官网在线免费观看| 欧美日韩久久久一区| 国产婷婷一区二区| 日韩精彩视频在线观看| av中文一区二区三区| 欧美第一区第二区| 粉嫩一区二区三区性色av| 蜜臀av性久久久久蜜臀av麻豆| 成人精品在线视频观看| 日韩视频一区二区在线观看| 有码一区二区三区| 成人动漫中文字幕| 久久夜色精品国产噜噜av| 天天亚洲美女在线视频| 欧美在线一二三| 国产精品看片你懂得| 韩日欧美一区二区三区| 欧美日韩大陆一区二区| 一区二区视频在线| 国产精品99久久久久久久vr| 欧美一区二区日韩| 人禽交欧美网站| 91麻豆精品国产综合久久久久久| 中文字幕一区免费在线观看| 国产激情一区二区三区| 久久婷婷成人综合色| 日韩 欧美一区二区三区| 91美女精品福利| 国产精品乱人伦| 日韩国产欧美一区二区三区| 337p亚洲精品色噜噜噜| 青青青爽久久午夜综合久久午夜| 欧美日韩激情一区二区| 免费在线视频一区| 久久亚洲欧美国产精品乐播| 国产精品99久| 中文字幕 久热精品 视频在线| 成人免费毛片片v| 亚洲成人免费在线| 日韩视频在线观看一区二区| 成人爽a毛片一区二区免费| 18欧美亚洲精品| 欧美年轻男男videosbes| 欧美午夜在线观看| 麻豆精品一二三| 日韩理论片一区二区| 欧美精品丝袜久久久中文字幕| 午夜久久久久久| 国产日韩av一区二区| 色婷婷av一区二区| 国产白丝网站精品污在线入口| 国产盗摄女厕一区二区三区 | 天堂影院一区二区| 欧美精品一区二区久久久 | 成人激情黄色小说| 国产在线一区观看| 国产一区二区三区四| 亚洲国产精品久久人人爱蜜臀| 日韩欧美中文字幕一区| 国产91丝袜在线18| 蜜臀久久99精品久久久画质超高清| 国产日本一区二区| 日韩午夜在线播放| 91国偷自产一区二区三区观看| 免费人成黄页网站在线一区二区| 国产欧美日韩三级| 欧美高清视频在线高清观看mv色露露十八 | 欧美日韩久久久久久| 欧美偷拍一区二区| 亚洲午夜久久久久久久久电影网 | 色婷婷久久综合| 一本一本大道香蕉久在线精品| 粉嫩av一区二区三区| 国产精品一区二区无线| 国产麻豆视频精品| 国产精品一区二区黑丝| 国产a区久久久| 国产成人免费网站| 成人av在线一区二区三区| www.激情成人| 欧美一级艳片视频免费观看| 26uuu精品一区二区在线观看| 欧美一区二区性放荡片| 欧美精选一区二区| 国产精品福利在线播放| 肉色丝袜一区二区| 91麻豆免费在线观看| 久久久无码精品亚洲日韩按摩| 国产精品国产三级国产aⅴ原创| 亚洲一区二区三区三| 国内外成人在线| 国产一区二区三区综合| 极品尤物av久久免费看| 一本色道a无线码一区v| 日韩一级片在线播放| 国产精品视频第一区| 婷婷丁香激情综合| 99热这里都是精品| 91精品国产免费| 亚洲欧美日韩久久| 韩国av一区二区三区四区| 99视频一区二区| 国产精品久久久久久亚洲伦| 蜜臀91精品一区二区三区| 色噜噜夜夜夜综合网| 日本一区二区在线不卡| 成人激情黄色小说| 亚洲欧洲日本在线| 麻豆91精品视频| 成人免费视频一区二区| 精品美女一区二区三区| 色综合天天综合在线视频| 欧美tk—视频vk| 亚洲一级在线观看| 国产xxx精品视频大全| 精品国产区一区| 蜜臀久久99精品久久久画质超高清| 在线日韩一区二区| 亚洲欧美电影院| 懂色av中文一区二区三区 | 欧美精品一卡两卡| 亚洲午夜免费电影| 91麻豆精品91久久久久同性| 日韩高清一区在线| 国产亚洲精品aa午夜观看| 成人网页在线观看| 一区二区在线观看视频| 欧美人体做爰大胆视频| 极品美女销魂一区二区三区 | 26uuu亚洲综合色| 久久99精品久久久久久国产越南 | 国产在线精品免费| 精品三级av在线| 国产精品77777竹菊影视小说| 2020国产成人综合网| 国产黄色精品视频| 中国av一区二区三区| 色综合天天在线| 亚洲高清免费在线| 久久综合色8888| 成人精品视频一区| 亚洲在线视频一区| 国内精品免费在线观看| 久久久99久久| 91色九色蝌蚪| 日本免费新一区视频| 国产亚洲一区二区三区在线观看 | 综合激情网...| 欧美日韩国产综合视频在线观看| 一区二区三区视频在线看| 欧美性猛交一区二区三区精品| 美女视频黄免费的久久 | 中文字幕精品一区二区精品绿巨人 | 欧美三级电影在线观看| 精品综合久久久久久8888| 亚洲国产精品成人久久综合一区| 在线观看免费亚洲| 成人禁用看黄a在线| 一个色综合网站| 久久久99精品免费观看| 欧洲一区在线电影|