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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tilesrequestprocessor.java

?? struts的源代碼
?? JAVA
字號(hào):
/*
 * $Id: TilesRequestProcessor.java 164703 2005-04-26 01:28:13Z niallp $ 
 *
 * Copyright 1999-2005 The Apache Software Foundation.
 * 
 * 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.apache.struts.tiles;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.RequestProcessor;
import org.apache.struts.config.ForwardConfig;
import org.apache.struts.config.ModuleConfig;

/**
 * <p><strong>RequestProcessor</strong> contains the processing logic that
 * the Struts controller servlet performs as it receives each servlet request
 * from the container.</p>
 * <p>This processor subclasses the Struts RequestProcessor in order to intercept calls to forward
 * or include. When such calls are done, the Tiles processor checks if the specified URI
 * is a definition name. If true, the definition is retrieved and included. If
 * false, the original URI is included or a forward is performed.
 * <p>
 * Actually, catching is done by overloading the following methods:
 * <ul>
 * <li>{@link #processForwardConfig(HttpServletRequest,HttpServletResponse,ForwardConfig)}</li>
 * <li>{@link #internalModuleRelativeForward(String, HttpServletRequest , HttpServletResponse)}</li>
 * <li>{@link #internalModuleRelativeInclude(String, HttpServletRequest , HttpServletResponse)}</li>
 * </ul>
 * </p>
 * @since Struts 1.1
 */
public class TilesRequestProcessor extends RequestProcessor {

	/** 
	 * Definitions factory. 
	 */
	protected DefinitionsFactory definitionsFactory = null;

	/**
	 * Commons Logging instance.
	 */
	protected static Log log = LogFactory.getLog(TilesRequestProcessor.class);

	/**
	 * Initialize this request processor instance.
	 *
	 * @param servlet The ActionServlet we are associated with.
	 * @param moduleConfig The ModuleConfig we are associated with.
	 * @throws ServletException If an error occurs during initialization.
	 */
	public void init(ActionServlet servlet, ModuleConfig moduleConfig)
		throws ServletException {

		super.init(servlet, moduleConfig);
		this.initDefinitionsMapping();
	}

	/**
	 * Read component instance mapping configuration file.
	 * This is where we read files properties.
	 */
	protected void initDefinitionsMapping() throws ServletException {
		// Retrieve and set factory for this modules
		definitionsFactory =
			(
				(TilesUtilStrutsImpl) TilesUtil
					.getTilesUtil())
					.getDefinitionsFactory(
				getServletContext(),
				moduleConfig);

		if (definitionsFactory == null) { // problem !

			log.info(
				"Definition Factory not found for module '"
					+ moduleConfig.getPrefix()
					+ "'. "
					+ "Have you declared the appropriate plugin in struts-config.xml ?");

			return;
		}

		log.info(
			"Tiles definition factory found for request processor '"
				+ moduleConfig.getPrefix()
				+ "'.");

	}

	/**
	 * Process a Tile definition name.
	 * This method tries to process the parameter <code>definitionName</code> as a definition name.
	 * It returns <code>true</code> if a definition has been processed, or <code>false</code> otherwise.
	 * Parameter <code>contextRelative</code> is not used in this implementation.
	 *
	 * @param definitionName Definition name to insert.
	 * @param contextRelative Is the definition marked contextRelative ?
	 * @param request Current page request.
	 * @param response Current page response.
	 * @return <code>true</code> if the method has processed uri as a definition name, <code>false</code> otherwise.
	 */
	protected boolean processTilesDefinition(
		String definitionName,
		boolean contextRelative,
		HttpServletRequest request,
		HttpServletResponse response)
		throws IOException, ServletException {

		// Do we do a forward (original behavior) or an include ?
		boolean doInclude = false;

		// Controller associated to a definition, if any
		Controller controller = null;

		// Computed uri to include
		String uri = null;

		ComponentContext tileContext = null;

		try {
			// Get current tile context if any.
			// If context exist, we will do an include
			tileContext = ComponentContext.getContext(request);
			doInclude = (tileContext != null);
			ComponentDefinition definition = null;

			// Process tiles definition names only if a definition factory exist,
			// and definition is found.
			if (definitionsFactory != null) {
				// Get definition of tiles/component corresponding to uri.
				try {
					definition =
						definitionsFactory.getDefinition(
							definitionName,
							request,
							getServletContext());
				} catch (NoSuchDefinitionException ex) {
					// Ignore not found
					log.debug("NoSuchDefinitionException " + ex.getMessage());
				}
				if (definition != null) { // We have a definition.
					// We use it to complete missing attribute in context.
					// We also get uri, controller.
					uri = definition.getPath();
					controller = definition.getOrCreateController();

					if (tileContext == null) {
						tileContext =
							new ComponentContext(definition.getAttributes());
						ComponentContext.setContext(tileContext, request);

					} else {
						tileContext.addMissing(definition.getAttributes());
					}
				}
			}

			// Process definition set in Action, if any.
			definition = DefinitionsUtil.getActionDefinition(request);
			if (definition != null) { // We have a definition.
				// We use it to complete missing attribute in context.
				// We also overload uri and controller if set in definition.
				if (definition.getPath() != null) {
					uri = definition.getPath();
				}

				if (definition.getOrCreateController() != null) {
					controller = definition.getOrCreateController();
				}

				if (tileContext == null) {
					tileContext =
						new ComponentContext(definition.getAttributes());
					ComponentContext.setContext(tileContext, request);
				} else {
					tileContext.addMissing(definition.getAttributes());
				}
			}

		} catch (java.lang.InstantiationException ex) {

			log.error("Can't create associated controller", ex);

			throw new ServletException(
				"Can't create associated controller",
				ex);
		} catch (DefinitionsFactoryException ex) {
			throw new ServletException(ex);
		}

		// Have we found a definition ?
		if (uri == null) {
			return false;
		}

		// Execute controller associated to definition, if any.
		if (controller != null) {
			try {
				controller.execute(
					tileContext,
					request,
					response,
					getServletContext());
                    
			} catch (Exception e) {
				throw new ServletException(e); 
			}
		}

		// If request comes from a previous Tile, do an include.
		// This allows to insert an action in a Tile.
		if (log.isDebugEnabled()) {
			log.debug("uri=" + uri + " doInclude=" + doInclude);
		}
        
		if (doInclude) {
			doInclude(uri, request, response);
		} else {
			doForward(uri, request, response); // original behavior
		}

		return true;
	}

	/**
	 * Do a forward using request dispatcher.
	 * Uri is a valid uri. If response has already been commited, do an include
	 * instead.
	 * @param uri Uri or Definition name to forward.
	 * @param request Current page request.
	 * @param response Current page response.
	 */
	protected void doForward(
		String uri,
		HttpServletRequest request,
		HttpServletResponse response)
		throws IOException, ServletException {
            
		if (response.isCommitted()) {
			this.doInclude(uri, request, response);
            
		} else {
			super.doForward(uri, request, response);
		}
	}

	/**
	 * Overloaded method from Struts' RequestProcessor.
	 * Forward or redirect to the specified destination by the specified
	 * mechanism.
	 * This method catches the Struts' actionForward call. It checks if the
	 * actionForward is done on a Tiles definition name. If true, process the
	 * definition and insert it. If false, call the original parent's method.
	 * @param request The servlet request we are processing.
	 * @param response The servlet response we are creating.
	 * @param forward The ActionForward controlling where we go next.
	 *
	 * @exception IOException if an input/output error occurs.
	 * @exception ServletException if a servlet exception occurs.
	 */
	protected void processForwardConfig(
		HttpServletRequest request,
		HttpServletResponse response,
		ForwardConfig forward)
		throws IOException, ServletException {
            
		// Required by struts contract
		if (forward == null) {
			return;
		}

		if (log.isDebugEnabled()) {
			log.debug(
				"processForwardConfig("
					+ forward.getPath()
					+ ", "
					+ forward.getContextRelative()
					+ ")");
		}
        
		// Try to process the definition.
		if (processTilesDefinition(forward.getPath(),
			forward.getContextRelative(),
			request,
			response)) {
			if (log.isDebugEnabled()) {
				log.debug(
					"  '" + forward.getPath() + "' - processed as definition");
			}
			return;
		}
        
		if (log.isDebugEnabled()) {
			log.debug("  '" + forward.getPath() + "' - processed as uri");
		}
        
		// forward doesn't contain a definition, let parent do processing
		super.processForwardConfig(request, response, forward);
	}

	/**
	 * Catch the call to a module relative forward.
	 * If the specified uri is a tiles definition name, insert it.
	 * Otherwise, parent processing is called.
	 * Do a module relative forward to specified uri using request dispatcher.
	 * Uri is relative to the current module. The real uri is computed by 
     * prefixing the module name.
	 * <strong>This method is used internally and is not part of the public 
     * API. It is advised to not use it in subclasses.</strong>
	 * @param uri Module-relative URI to forward to.
	 * @param request Current page request.
	 * @param response Current page response.
	 * @since Struts 1.1
	 */
	protected void internalModuleRelativeForward(
		String uri,
		HttpServletRequest request,
		HttpServletResponse response)
		throws IOException, ServletException {
            
		if (processTilesDefinition(uri, false, request, response)) {
			return;
		}

		super.internalModuleRelativeForward(uri, request, response);
	}

	/**
	 * Do a module relative include to specified uri using request dispatcher.
	 * Uri is relative to the current module. The real uri is computed by 
     * prefixing the module name.
	 * <strong>This method is used internally and is not part of the public 
     * API. It is advised to not use it in subclasses.</strong>
	 * @param uri Module-relative URI to forward to.
	 * @param request Current page request.
	 * @param response Current page response.
	 * @since Struts 1.1
	 */
	protected void internalModuleRelativeInclude(
		String uri,
		HttpServletRequest request,
		HttpServletResponse response)
		throws IOException, ServletException {
            
		if (processTilesDefinition(uri, false, request, response)) {
			return;
		}

		super.internalModuleRelativeInclude(uri, request, response);
	}

	/**
	 * Get associated definition factory.
	 */
	public DefinitionsFactory getDefinitionsFactory() {
		return definitionsFactory;
	}

}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品在线一区二区| 一区二区三区久久| 91极品美女在线| 日本在线不卡视频| 国产高清不卡一区二区| 欧美一卡2卡3卡4卡| 亚洲综合成人在线| 欧美日韩一区二区三区高清| 怡红院av一区二区三区| 色综合久久88色综合天天免费| 国产免费久久精品| 色哟哟国产精品免费观看| 亚洲一区二区三区免费视频| 日韩一区二区麻豆国产| 国产成人午夜片在线观看高清观看 | 激情偷乱视频一区二区三区| 久久蜜桃av一区二区天堂 | 波多野结衣精品在线| 国产欧美一区二区精品久导航 | xnxx国产精品| 国产在线观看免费一区| 国产成人自拍高清视频在线免费播放| 欧美xingq一区二区| 精品午夜久久福利影院| 久久久国产精品麻豆| 国产成人8x视频一区二区| 中文无字幕一区二区三区 | 欧美aaaaaa午夜精品| 精品国产乱码久久久久久1区2区| 日韩成人午夜电影| 日韩欧美中文一区二区| 国产精品99久久久| 国产精品女同互慰在线看| av在线不卡网| 婷婷丁香激情综合| 精品欧美一区二区在线观看| 国产成人av影院| 亚洲欧美另类综合偷拍| 欧美精品丝袜中出| 国产一区二区三区国产| 国产精品久久二区二区| 欧美日韩国产中文| 国产激情91久久精品导航| 亚洲视频在线一区观看| 欧美日韩在线播放一区| 极品少妇xxxx精品少妇| 亚洲激情图片小说视频| 日韩一区二区三区av| 成人国产精品免费网站| 国产精品水嫩水嫩| 日韩午夜小视频| 成人一级片在线观看| 久久精品国产一区二区三区免费看| 亚洲男同性视频| 色噜噜狠狠成人中文综合| 久久丁香综合五月国产三级网站| 国产精品不卡视频| 精品免费一区二区三区| 色综合天天做天天爱| 韩国成人福利片在线播放| 亚洲影视资源网| 国产精品国产a级| 日韩精品一区二区在线| 91免费看视频| 国模套图日韩精品一区二区| 亚洲在线中文字幕| 国产欧美精品区一区二区三区| 欧美精品久久一区二区三区| 成人午夜又粗又硬又大| 奇米色一区二区三区四区| 亚洲欧美一区二区三区极速播放| 欧美sm极限捆绑bd| 欧美欧美欧美欧美首页| 色综合夜色一区| 国产成人精品在线看| 麻豆91在线播放| 日韩成人一级片| 亚洲国产一区视频| 一区二区三区资源| 欧美国产日韩精品免费观看| 欧美成人精品1314www| 91精品国产综合久久久久| 91美女精品福利| 91免费国产在线| 91丨九色丨蝌蚪富婆spa| 成人激情小说网站| 成人动漫一区二区在线| 国产成人午夜视频| 国产美女视频91| 国内精品在线播放| 国模冰冰炮一区二区| 亚洲成人免费观看| 中文字幕亚洲精品在线观看| 亚洲欧洲在线观看av| 欧美成人精品二区三区99精品| 欧美在线观看视频一区二区 | 国产女同互慰高潮91漫画| 精品国产乱码久久| www激情久久| 日韩精品综合一本久道在线视频| 欧美人妇做爰xxxⅹ性高电影| 欧美性生活大片视频| 欧美在线免费视屏| 欧美日韩成人在线一区| 欧美一区二区观看视频| 欧美大胆人体bbbb| 精品处破学生在线二十三| 久久久美女毛片| 亚洲国产精华液网站w| 国产精品乱码一区二区三区软件 | 精品午夜久久福利影院| 韩国av一区二区| 国产成a人亚洲精品| 91毛片在线观看| 欧美精品国产精品| 欧美一区二区三区在线| xnxx国产精品| 中文字幕在线不卡一区| 亚洲日本va午夜在线电影| 亚洲激情图片一区| 亚洲一区二区偷拍精品| 一区二区三区免费看视频| 亚洲一区二区三区中文字幕在线| 亚洲美女视频在线| 亚洲成人精品影院| 麻豆久久久久久久| 成人免费高清在线观看| 欧美在线视频日韩| 欧美日韩高清影院| 欧美不卡激情三级在线观看| 国产欧美一区二区精品秋霞影院| 亚洲图片欧美激情| 性做久久久久久免费观看| 青青青爽久久午夜综合久久午夜| 日韩精品乱码av一区二区| 国产欧美一区二区三区在线看蜜臀| 成人黄色大片在线观看| 成人精品视频一区| 欧美丝袜丝交足nylons| 欧美不卡123| 一区二区三区日韩| 婷婷一区二区三区| 成人高清免费观看| 欧美日韩成人高清| 中文字幕va一区二区三区| 五月天精品一区二区三区| 国产a区久久久| 欧美日韩综合一区| 国产亚洲精品aa| 天堂资源在线中文精品| 成人黄色在线网站| 一本色道久久综合亚洲aⅴ蜜桃| 免费的成人av| 成人精品国产福利| 日韩午夜在线播放| 亚洲线精品一区二区三区 | 久久一区二区三区国产精品| 中文字幕中文字幕一区| 青青草原综合久久大伊人精品优势| 成人综合激情网| 欧美在线观看视频一区二区三区| 日韩精品一区二区三区老鸭窝| 亚洲乱码国产乱码精品精98午夜| 国产精品资源在线看| 91精品久久久久久久久99蜜臂| 亚洲人成电影网站色mp4| 国产乱理伦片在线观看夜一区| 欧美日韩一级二级| 亚洲黄色性网站| 成人免费的视频| 久久久精品欧美丰满| 免费一级片91| 91精品国产91综合久久蜜臀| 伊人色综合久久天天| 91亚洲精华国产精华精华液| 日本一区二区三区在线观看| 国产精品香蕉一区二区三区| 欧美一区二区三区四区视频| 亚洲午夜一区二区三区| 日本高清成人免费播放| 综合久久国产九一剧情麻豆| 成人午夜av影视| 国产精品人妖ts系列视频| 国产98色在线|日韩| 精品国产欧美一区二区| 久久国产综合精品| 欧美大片在线观看一区二区| 视频一区二区三区中文字幕| 欧美日韩一区二区三区不卡| 亚洲国产aⅴ天堂久久| 91传媒视频在线播放| 亚洲精品视频在线看| 91福利在线观看| 亚洲综合在线五月| 欧美日韩一区二区三区高清| 日韩福利视频导航| 精品国产精品一区二区夜夜嗨| 国产在线一区二区综合免费视频| 久久嫩草精品久久久精品| 国产久卡久卡久卡久卡视频精品|