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

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

?? velocitylayoutcommand.java

?? 這是我自己開發的一個MVC框架
?? JAVA
字號:
package dark.web.frame.velocity.command;

import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;

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

import org.apache.velocity.Template;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;

/**
 * <p>Title:            </p>
 * <p>Description:      根據org.apache.velocity.servlet.VelocityLayoutServlet修改
 * 						以使dwf中的Command支持Velocity的Layout管理</p>
 * <p>Copyright:        Copyright (c) 2004</p>
 * <p>Company:          DIS</p>
 * <p>Create Time:      2005-3-3 3:02:46</p>
 * @author             <a href="mailto:dark_he@hotmail.com">darkhe</a>
 * @version            1.0
 */
public abstract class VelocityLayoutCommand extends VelocityCommand
{

	/**
	 * The context/parameter key used to specify an alternate
	 * layout to be used for a request instead of the default layout.
	 */
	public static String KEY_LAYOUT = "layout";
		
	/**
	 * The context key that will hold the content of the screen.
	 * 
	 * This key ($screen_content) must be present in the layout
	 * template for the current screen to be rendered.
	 */
	public static String KEY_SCREEN_CONTENT = "screen_content";	
	
	/**
	 * The context key that holds the {@link Throwable} that
	 * broke the rendering of the requested screen.
	 */
	public static String KEY_ERROR_CAUSE = "error_cause";

	/**
	 * The context key that holds the stack trace of the error that
	 * broke the rendering of the requested screen.
	 */
	public static String KEY_ERROR_STACKTRACE = "stack_trace";

	/**
	 * The context key that holds the {@link MethodInvocationException} 
	 * that broke the rendering of the requested screen.
	 *
	 * If this value is placed in the context, then $error_cause
	 * will hold the error that this invocation exception is wrapping.
	 */
	public static String KEY_ERROR_INVOCATION_EXCEPTION = "invocation_exception";
		
	private String errorTemplate;
	private String layoutDir;
	private String defaultLayout;
	
	/**
	  * Overrides VelocityViewServlet to check the request for 
	  * an alternate layout
	  *
	  * @param request client request
	  * @param response client response
	  * @return the Context to fill
	  */
	protected Context createContext(
		HttpServletRequest request,
		HttpServletResponse response)
	{

		Context ctx = super.createContext(request, response);

		// check if an alternate layout has been specified 
		// by way of the request parameters
		String layout = request.getParameter(KEY_LAYOUT);
		if (layout != null)
		{
			// let the template know what its new layout is
			ctx.put(KEY_LAYOUT, layout);
		}
		return ctx;
	}

	/**
	 * Overrides VelocityViewServlet.mergeTemplate to do a two-pass 
	 * render for handling layouts
	 */
	protected void mergeTemplate(
		Template template,
		Context context,
		HttpServletResponse response)
		throws
			ResourceNotFoundException,
			ParseErrorException,
			MethodInvocationException,
			IOException,
			UnsupportedEncodingException,
			Exception
	{
		//
		// this section is based on Tim Colson's "two pass render"
		//
		// Render the screen content
		StringWriter sw = new StringWriter();
		template.merge(context, sw);
		// Add the resulting content to the context
		context.put(KEY_SCREEN_CONTENT, sw.toString());

		// Check for an alternate layout
		//
		// we check after merging the screen template so the screen 
		// can overrule any layout set in the request parameters
		// by doing #set( $layout = "MyLayout.vm" )
		Object obj = context.get(KEY_LAYOUT);
		String layout = (obj == null) ? null : obj.toString();
		if (layout == null)
		{
			// no alternate, use default
			layout = defaultLayout;
		}
		else
		{
			// make it a full(er) path
			layout = layoutDir + layout;
		}

		try
		{
			//load the layout template
			template = getTemplate(layout);
		}
		catch (Exception e)
		{
			Velocity.error(
				"VelocityLayoutCommand: Can't load layout \""
					+ layout
					+ "\": "
					+ e);

			// if it was an alternate layout we couldn't get...
			if (!layout.equals(defaultLayout))
			{
				// try to get the default layout
				// if this also fails, let the exception go
				template = getTemplate(defaultLayout);
			}
		}

		// Render the layout template into the response
		super.mergeTemplate(template, context, response);
	}

	/**
	 * Overrides VelocityViewServlet to display user's custom error template
	 */
	protected void error(
		HttpServletRequest request,
		HttpServletResponse response,
		Exception e)
		throws ServletException
	{
		try
		{
			// get a velocity context
			Context ctx = createContext(request, response);

			Throwable cause = e;

			// if it's an MIE, i want the real cause and stack trace!
			if (cause instanceof MethodInvocationException)
			{
				// put the invocation exception in the context
				ctx.put(KEY_ERROR_INVOCATION_EXCEPTION, e);
				// get the real cause
				cause = ((MethodInvocationException) e).getWrappedThrowable();
			}

			// add the cause to the context
			ctx.put(KEY_ERROR_CAUSE, cause);

			// grab the cause's stack trace and put it in the context
			StringWriter sw = new StringWriter();
			cause.printStackTrace(new java.io.PrintWriter(sw));
			ctx.put(KEY_ERROR_STACKTRACE, sw.toString());

			// retrieve and render the error template
			Template et = getTemplate(errorTemplate);
			mergeTemplate(et, ctx, response);

		}
		catch (Exception e2)
		{
			// d'oh! log this
			Velocity.error(
				"VelocityLayoutCommand: "
					+ " Error during error template rendering - "
					+ e2);
			// then punt the original to a higher authority
			super.error(request, response, e);
		}
	}

	/**
	 * @return
	 */
	public String getDefaultLayout()
	{
		return defaultLayout;
	}

	/**
	 * @param string
	 */
	public void setDefaultLayout(String string)
	{
		defaultLayout = string;
	}

	/**
	 * @return
	 */
	public String getErrorTemplate()
	{
		return errorTemplate;
	}

	/**
	 * @return
	 */
	public String getLayoutDir()
	{
		return layoutDir;
	}

	/**
	 * @param string
	 */
	public void setErrorTemplate(String string)
	{
		errorTemplate = string;
	}

	/**
	 * @param string
	 */
	public void setLayoutDir(String string)
	{
		layoutDir = string;
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99re6这里只有精品视频在线观看| 国产成人福利片| 亚洲欧美电影院| 亚洲色图在线看| 亚洲日本乱码在线观看| 自拍av一区二区三区| 亚洲欧洲精品一区二区三区不卡| 中文文精品字幕一区二区| 欧美激情一区二区三区全黄| 国产精品伦理一区二区| 亚洲欧洲成人av每日更新| 亚洲精品一二三四区| 一区二区三区在线视频播放| 亚洲一二三区在线观看| 亚洲国产视频在线| 精品一区二区三区免费播放| 国产一区二区三区免费播放| 成人精品小蝌蚪| 91国产精品成人| 91精品国产91久久综合桃花| 久久综合九色综合97婷婷| 国产精品久久久久四虎| 樱桃国产成人精品视频| 免费人成在线不卡| 国产成人亚洲精品青草天美| 99精品在线观看视频| 欧美日韩精品高清| 久久精品欧美一区二区三区不卡| 1区2区3区国产精品| 午夜久久久久久久久久一区二区| 蜜臀av性久久久久蜜臀aⅴ| 成人午夜视频福利| 欧美亚洲国产一区在线观看网站 | 国产欧美视频一区二区三区| 日本一区二区高清| 亚洲h精品动漫在线观看| 久久er99精品| 欧美这里有精品| 久久美女高清视频 | 91污在线观看| 欧美日韩精品高清| 国产精品青草久久| 免费欧美高清视频| 色综合中文字幕国产| 欧美男生操女生| 国产欧美精品区一区二区三区 | 日韩一级在线观看| 中文字幕精品—区二区四季| 性欧美疯狂xxxxbbbb| 波多野结衣91| 精品日韩99亚洲| 亚洲成av人片在www色猫咪| 国产成人综合网站| 精品少妇一区二区三区在线视频| 一区二区在线观看av| 国产精品自拍在线| 精品国产伦一区二区三区观看体验 | 亚洲一线二线三线视频| 日韩高清一区二区| 欧美性色黄大片手机版| 国产精品久久久久久福利一牛影视 | 日韩电影在线免费| 色中色一区二区| 亚洲视频在线一区二区| 成人午夜视频网站| 国产精品久久看| 风间由美性色一区二区三区| 久久久一区二区三区| 精品一区二区成人精品| 欧美成人性战久久| 狂野欧美性猛交blacked| 欧美日韩国产三级| 亚洲成人在线网站| 欧美理论片在线| 五月婷婷综合在线| 欧美日韩亚洲丝袜制服| 亚洲gay无套男同| 欧美午夜精品一区二区蜜桃| 亚洲精品乱码久久久久久黑人 | 欧美一区二区三区免费| 视频一区二区欧美| 精品黑人一区二区三区久久| 激情欧美一区二区| 国产精品午夜春色av| 懂色av中文一区二区三区| 国产欧美一区二区三区网站 | 香蕉久久夜色精品国产使用方法| 日本高清成人免费播放| 亚洲国产精品久久久久婷婷884| 欧美日韩久久久| 男人的天堂亚洲一区| 久久免费看少妇高潮| 国产91精品久久久久久久网曝门| 国产日产欧美一区二区三区| 99精品视频在线观看免费| 亚洲一区在线免费观看| 日韩欧美成人午夜| 成人自拍视频在线| 亚洲专区一二三| 欧美成人精品1314www| 国产精品99久久久久久宅男| 亚洲乱码国产乱码精品精的特点 | 亚洲综合成人在线视频| 欧美一区二区三区四区视频| 国产精品系列在线观看| 亚洲精品免费在线观看| 精品久久免费看| 99r精品视频| 麻豆免费精品视频| 亚洲人成小说网站色在线| 538prom精品视频线放| 丁香啪啪综合成人亚洲小说 | 精品在线免费视频| 国产精品美女久久久久久久久| 欧洲国内综合视频| 精品亚洲aⅴ乱码一区二区三区| 国产精品对白交换视频| 91麻豆精品国产91久久久更新时间| 国产丶欧美丶日本不卡视频| 亚洲影视在线观看| 国产精品视频yy9299一区| 欧美群妇大交群中文字幕| 不卡的av在线播放| 久久国产精品露脸对白| 亚洲美女一区二区三区| 久久久夜色精品亚洲| 欧美日韩国产美女| 色婷婷久久综合| 懂色av中文一区二区三区| 美国欧美日韩国产在线播放| 日韩理论电影院| 国产欧美综合在线| 精品久久久久久久久久久院品网| 色婷婷综合久久久| 成人精品鲁一区一区二区| 九色综合狠狠综合久久| 日本欧美肥老太交大片| 亚洲综合精品自拍| 亚洲人成在线播放网站岛国| 欧美国产1区2区| 国产精品私人影院| 国产视频一区二区在线| 久久精品亚洲精品国产欧美kt∨| 555www色欧美视频| 91麻豆精品国产91久久久资源速度| 日本韩国一区二区三区| 一本大道综合伊人精品热热 | 亚洲一区二区三区小说| 亚洲乱码中文字幕| 亚洲人123区| 亚洲精品写真福利| 夜夜嗨av一区二区三区网页| 亚洲精品国产精华液| 亚洲视频每日更新| 一区二区三区高清不卡| 亚洲国产一区在线观看| 日韩综合小视频| 裸体歌舞表演一区二区| 极品少妇xxxx偷拍精品少妇| 国产综合色在线| 国产成人精品免费| 色综合色狠狠综合色| 在线看国产日韩| 欧美日韩视频在线观看一区二区三区| 在线观看一区二区视频| 欧美日本一道本在线视频| 欧美一区二区视频在线观看| 日韩欧美www| 欧美极品另类videosde| 自拍偷拍欧美精品| 亚洲va国产天堂va久久en| 丝袜诱惑制服诱惑色一区在线观看 | 欧美中文字幕一区二区三区亚洲| 不卡一卡二卡三乱码免费网站| 91影院在线免费观看| 欧美伊人精品成人久久综合97| 欧美精品xxxxbbbb| 国产农村妇女毛片精品久久麻豆 | 欧美少妇xxx| 日韩久久精品一区| 中文字幕一区二区三区精华液| 一个色综合网站| 精品中文av资源站在线观看| 成人一道本在线| 欧美高清视频在线高清观看mv色露露十八 | 国产福利精品导航| 92国产精品观看| 777亚洲妇女| 欧美国产日本视频| 午夜影院在线观看欧美| 国产成人av电影在线| 欧美日韩视频在线第一区| 久久一日本道色综合| 亚洲国产日韩精品| 成人免费视频一区| 91精品国产乱| 亚洲嫩草精品久久| 国产盗摄一区二区| 日韩一区和二区| 一区二区三区四区激情|