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

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

?? abstractview.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2007 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.servlet.view;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;

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

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.util.CollectionUtils;
import org.springframework.web.context.support.WebApplicationObjectSupport;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.support.RequestContext;

/**
 * Abstract base class for {@link org.springframework.web.servlet.View}
 * implementations. Subclasses should be JavaBeans, to allow for
 * convenient configuration as Spring-managed bean instances.
 *
 * <p>Provides support for static attributes, to be made available to the view,
 * with a variety of ways to specify them. Static attributes will be merged
 * with the given dynamic attributes (the model that the controller returned)
 * for each render operation.
 *
 * <p>Extends {@link WebApplicationObjectSupport}, which will be helpful to
 * some views. Subclasses just need to implement the actual rendering.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 * @see #setAttributes
 * @see #setAttributesMap
 * @see #renderMergedOutputModel
 */
public abstract class AbstractView extends WebApplicationObjectSupport implements View, BeanNameAware {

	/** Default content type. Overridable as bean property. */
	public static final String DEFAULT_CONTENT_TYPE = "text/html;charset=ISO-8859-1";


	private String beanName;

	private String contentType = DEFAULT_CONTENT_TYPE;

	private String requestContextAttribute;

	/** Map of static attributes, keyed by attribute name (String) */
	private final Map	staticAttributes = new HashMap();


	/**
	 * Set the view's name. Helpful for traceability.
	 * <p>Framework code must call this when constructing views.
	 */
	public void setBeanName(String beanName) {
		this.beanName = beanName;
	}

	/**
	 * Return the view's name. Should never be <code>null</code>,
	 * if the view was correctly configured.
	 */
	public String getBeanName() {
		return this.beanName;
	}

	/**
	 * Set the content type for this view.
	 * Default is "text/html;charset=ISO-8859-1".
	 * <p>May be ignored by subclasses if the view itself is assumed
	 * to set the content type, e.g. in case of JSPs.
	 */
	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	/**
	 * Return the content type for this view.
	 */
	public String getContentType() {
		return this.contentType;
	}

	/**
	 * Set the name of the RequestContext attribute for this view.
	 * Default is none.
	 */
	public void setRequestContextAttribute(String requestContextAttribute) {
		this.requestContextAttribute = requestContextAttribute;
	}

	/**
	 * Return the name of the RequestContext attribute, if any.
	 */
	public String getRequestContextAttribute() {
		return this.requestContextAttribute;
	}

	/**
	 * Set static attributes as a CSV string.
	 * Format is: attname0={value1},attname1={value1}
	 * <p>"Static" attributes are fixed attributes that are specified in
	 * the View instance configuration. "Dynamic" attributes, on the other hand,
	 * are values passed in as part of the model.
	 */
	public void setAttributesCSV(String propString) throws IllegalArgumentException {
		if (propString != null) {
			StringTokenizer st = new StringTokenizer(propString, ",");
			while (st.hasMoreTokens()) {
				String tok = st.nextToken();
				int eqIdx = tok.indexOf("=");
				if (eqIdx == -1) {
					throw new IllegalArgumentException("Expected = in attributes CSV string '" + propString + "'");
				}
				if (eqIdx >= tok.length() - 2) {
					throw new IllegalArgumentException(
							"At least 2 characters ([]) required in attributes CSV string '" + propString + "'");
				}
				String name = tok.substring(0, eqIdx);
				String value = tok.substring(eqIdx + 1);

				// Delete first and last characters of value: { and }
				value = value.substring(1);
				value = value.substring(0, value.length() - 1);

				addStaticAttribute(name, value);
			}
		}
	}

	/**
	 * Set static attributes for this view from a
	 * <code>java.util.Properties</code> object.
	 * <p>"Static" attributes are fixed attributes that are specified in
	 * the View instance configuration. "Dynamic" attributes, on the other hand,
	 * are values passed in as part of the model.
	 * <p>This is the most convenient way to set static attributes. Note that
	 * static attributes can be overridden by dynamic attributes, if a value
	 * with the same name is included in the model.
	 * <p>Can be populated with a String "value" (parsed via PropertiesEditor)
	 * or a "props" element in XML bean definitions.
	 * @see org.springframework.beans.propertyeditors.PropertiesEditor
	 */
	public void setAttributes(Properties attributes) {
		CollectionUtils.mergePropertiesIntoMap(attributes, this.staticAttributes);
	}

	/**
	 * Set static attributes for this view from a Map. This allows to set
	 * any kind of attribute values, for example bean references.
	 * <p>"Static" attributes are fixed attributes that are specified in
	 * the View instance configuration. "Dynamic" attributes, on the other hand,
	 * are values passed in as part of the model.
	 * <p>Can be populated with a "map" or "props" element in XML bean definitions.
	 * @param attributes Map with name Strings as keys and attribute objects as values
	 */
	public void setAttributesMap(Map attributes) {
		if (attributes != null) {
			Iterator it = attributes.entrySet().iterator();
			while (it.hasNext()) {
				Map.Entry entry = (Map.Entry) it.next();
				Object key = entry.getKey();
				if (!(key instanceof String)) {
					throw new IllegalArgumentException(
							"Invalid attribute key [" + key + "]: only Strings allowed");
				}
				addStaticAttribute((String) key, entry.getValue());
			}
		}
	}

	/**
	 * Allow Map access to the static attributes of this view,
	 * with the option to add or override specific entries.
	 * <p>Useful for specifying entries directly, for example via
	 * "attributesMap[myKey]". This is particularly useful for
	 * adding or overriding entries in child view definitions.
	 */
	public Map getAttributesMap() {
		return this.staticAttributes;
	}

	/**
	 * Add static data to this view, exposed in each view.
	 * <p>"Static" attributes are fixed attributes that are specified in
	 * the View instance configuration. "Dynamic" attributes, on the other hand,
	 * are values passed in as part of the model.
	 * <p>Must be invoked before any calls to <code>render</code>.
	 * @param name the name of the attribute to expose
	 * @param value the attribute value to expose
	 * @see #render
	 */
	public void addStaticAttribute(String name, Object value) {
		this.staticAttributes.put(name, value);
	}

	/**
	 * Return the static attributes for this view. Handy for testing.
	 * <p>Returns an unmodifiable Map, as this is not intended for
	 * manipulating the Map but rather just for checking the contents.
	 * @return the static attributes in this view
	 */
	public Map getStaticAttributes() {
		return Collections.unmodifiableMap(this.staticAttributes);
	}


	/**
	 * Prepares the view given the specified model, merging it with static
	 * attributes and a RequestContext attribute, if necessary.
	 * Delegates to renderMergedOutputModel for the actual rendering.
	 * @see #renderMergedOutputModel
	 */
	public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception {
		if (logger.isDebugEnabled()) {
			logger.debug("Rendering view with name '" + this.beanName + "' with model " + model +
				" and static attributes " + this.staticAttributes);
		}

		// Consolidate static and dynamic model attributes.
		Map mergedModel = new HashMap(this.staticAttributes.size() + (model != null ? model.size() : 0));
		mergedModel.putAll(this.staticAttributes);
		if (model != null) {
			mergedModel.putAll(model);
		}

		// Expose RequestContext?
		if (this.requestContextAttribute != null) {
			mergedModel.put(this.requestContextAttribute, createRequestContext(request, mergedModel));
		}

		prepareResponse(request, response);
		renderMergedOutputModel(mergedModel, request, response);
	}

	/**
	 * Create a RequestContext to expose under the specified attribute name.
	 * <p>Default implementation creates a standard RequestContext instance for the
	 * given request and model. Can be overridden in subclasses for custom instances.
	 * @param request current HTTP request
	 * @param model combined output Map (never <code>null</code>),
	 * with dynamic values taking precedence over static attributes
	 * @return the RequestContext instance
	 * @see #setRequestContextAttribute
	 * @see org.springframework.web.servlet.support.RequestContext
	 */
	protected RequestContext createRequestContext(HttpServletRequest request, Map model) {
		return new RequestContext(request, getServletContext(), model);
	}

	/**
	 * Prepare the given response for rendering.
	 * <p>The default implementation applies a workaround for an IE bug
	 * when sending download content via HTTPS.
	 * @param request current HTTP request
	 * @param response current HTTP response
	 */
	protected void prepareResponse(HttpServletRequest request, HttpServletResponse response) {
		if (generatesDownloadContent()) {
			response.setHeader("Pragma", "private");
			response.setHeader("Cache-Control", "private, must-revalidate");
		}
	}

	/**
	 * Return whether this view generates download content
	 * (typically binary content like PDF or Excel files).
	 * <p>The default implementation returns <code>false</code>. Subclasses are
	 * encouraged to return <code>true</code> here if they know that they are
	 * generating download content that requires temporary caching on the
	 * client side, typically via the response OutputStream.
	 * @see #prepareResponse
	 * @see javax.servlet.http.HttpServletResponse#getOutputStream()
	 */
	protected boolean generatesDownloadContent() {
		return false;
	}

	/**
	 * Subclasses must implement this method to actually render the view.
	 * <p>The first step will be preparing the request: In the JSP case,
	 * this would mean setting model objects as request attributes.
	 * The second step will be the actual rendering of the view,
	 * for example including the JSP via a RequestDispatcher.
	 * @param model combined output Map (never <code>null</code>),
	 * with dynamic values taking precedence over static attributes
	 * @param request current HTTP request
	 * @param response current HTTP response
	 * @throws Exception if rendering failed
	 */
	protected abstract void renderMergedOutputModel(
			Map model, HttpServletRequest request, HttpServletResponse response) throws Exception;


	/**
	 * Expose the model objects in the given map as request attributes.
	 * Names will be taken from the model Map.
	 * This method is suitable for all resources reachable by {@link javax.servlet.RequestDispatcher}.
	 * @param model Map of model objects to expose
	 * @param request current HTTP request
	 */
	protected void exposeModelAsRequestAttributes(Map model, HttpServletRequest request) throws Exception {
		Iterator it = model.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry entry = (Map.Entry) it.next();
			if (!(entry.getKey() instanceof String)) {
				throw new IllegalArgumentException(
						"Invalid key [" + entry.getKey() + "] in model Map: only Strings allowed as model keys");
			}
			String modelName = (String) entry.getKey();
			Object modelValue = entry.getValue();
			if (modelValue != null) {
				request.setAttribute(modelName, modelValue);
				if (logger.isDebugEnabled()) {
					logger.debug("Added model object '" + modelName + "' of type [" + modelValue.getClass().getName() +
							"] to request in view with name '" + getBeanName() + "'");
				}
			}
			else {
				request.removeAttribute(modelName);
				if (logger.isDebugEnabled()) {
					logger.debug("Removed model object '" + modelName +
							"' from request in view with name '" + getBeanName() + "'");
				}
			}
		}
	}


	public String toString() {
		StringBuffer sb = new StringBuffer(getClass().getName());
		if (getBeanName() != null) {
			sb.append(": name '").append(getBeanName()).append("'");
		}
		else {
			sb.append(": unnamed");
		}
		return sb.toString();
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品一区蜜桃臀影院| 欧美在线观看你懂的| 精品粉嫩超白一线天av| 国产一区二区三区香蕉| 国产蜜臀97一区二区三区| av电影天堂一区二区在线观看| 亚洲视频1区2区| 欧美日韩久久一区二区| 麻豆免费精品视频| 日本一区二区免费在线观看视频| 成人黄色免费短视频| 亚洲精品第一国产综合野| 欧美福利电影网| 国产精品小仙女| 亚洲精品免费在线观看| 在线播放中文一区| 国产乱码精品一区二区三| 亚洲美女淫视频| 日韩精品中文字幕一区二区三区| 国产成人h网站| 亚洲成人av在线电影| 久久精品网站免费观看| 欧美日韩免费视频| 国产乱淫av一区二区三区| 一区二区三区视频在线看| 日韩亚洲欧美成人一区| 成人黄色av电影| 天天色 色综合| 国产精品麻豆久久久| 欧美日韩国产一二三| 国产xxx精品视频大全| 亚洲成人激情av| 中文字幕乱码日本亚洲一区二区| 欧美日本韩国一区| av在线综合网| 久久99国产精品成人| 一区二区三区美女视频| 久久久久国产免费免费| 欧美军同video69gay| 不卡一区中文字幕| 久久 天天综合| 亚洲午夜久久久久| 国产精品毛片久久久久久久| 日韩精品在线网站| 在线视频一区二区免费| 成人一道本在线| 极品销魂美女一区二区三区| 夜夜操天天操亚洲| 国产精品久久久久久久久久免费看 | 久久久99精品久久| 欧美肥妇free| 日本道色综合久久| 成人黄色在线视频| 国产91在线看| 国产专区综合网| 捆绑调教美女网站视频一区| 亚洲电影一区二区| 亚洲一区二区三区免费视频| 亚洲欧美日韩系列| 中文字幕在线不卡视频| 国产欧美日本一区二区三区| 久久影院午夜片一区| 日韩欧美黄色影院| 欧美亚一区二区| 在线视频你懂得一区二区三区| 成人免费av在线| 国产一区二区在线视频| 黄一区二区三区| 美女久久久精品| 日本成人在线一区| 日本v片在线高清不卡在线观看| 亚洲午夜精品久久久久久久久| 一区二区三区加勒比av| 亚洲黄色在线视频| 一区二区三区蜜桃网| 亚洲一区二区三区爽爽爽爽爽| 亚洲精品高清在线| 亚洲高清免费观看| 丝袜诱惑制服诱惑色一区在线观看| 亚洲一区二区3| 偷窥国产亚洲免费视频| 亚洲超碰精品一区二区| 日本亚洲天堂网| 老司机午夜精品99久久| 久久99久久精品| 国产电影一区在线| 不卡视频在线看| 欧美性欧美巨大黑白大战| 欧美色精品在线视频| 欧美一级搡bbbb搡bbbb| 精品国产乱码久久久久久蜜臀| 久久久99久久| 亚洲精品免费看| 午夜精品影院在线观看| 美女看a上一区| 成人开心网精品视频| 一本久道久久综合中文字幕| 欧美午夜宅男影院| 欧美videos中文字幕| 国产欧美一区二区三区鸳鸯浴| 国产精品大尺度| 日韩av午夜在线观看| 国产成人99久久亚洲综合精品| 色美美综合视频| 日韩美一区二区三区| 国产精品久久久久四虎| 午夜久久电影网| 国产 日韩 欧美大片| 欧美午夜电影在线播放| 精品国产91亚洲一区二区三区婷婷| 国产日韩精品一区二区三区在线| 亚洲精品中文字幕在线观看| 日韩在线卡一卡二| 成人精品gif动图一区| 欧美日产国产精品| 国产精品欧美极品| 天天色天天操综合| av一区二区三区| 日韩一区二区视频| 中文字幕佐山爱一区二区免费| 日日夜夜精品视频天天综合网| 国产成人av一区二区三区在线 | 91最新地址在线播放| 91麻豆精品国产91| 中文字幕在线视频一区| 久久99精品久久久久久| 欧美亚洲综合一区| 国产欧美1区2区3区| 免费亚洲电影在线| 色婷婷亚洲婷婷| 国产亚洲精品aa| 日本伊人色综合网| 91官网在线免费观看| 国产欧美日韩三区| 美女一区二区久久| 欧美剧情片在线观看| 亚洲精品国产第一综合99久久 | 国内外成人在线| 欧美二区乱c少妇| 亚洲免费资源在线播放| 国产福利一区二区三区视频| 欧美一区二区免费视频| 一区二区欧美国产| 成人av网站免费| 久久影院午夜论| 久久爱www久久做| 欧美肥妇free| 天天亚洲美女在线视频| 欧美日韩一区二区三区视频| 亚洲精品中文在线观看| 99r国产精品| 亚洲人成电影网站色mp4| 成人午夜av电影| 中文字幕欧美激情一区| 成人性生交大片免费看视频在线| 日韩免费电影一区| 久草精品在线观看| 这里是久久伊人| 日韩在线一二三区| 欧美精品一二三| 天堂久久久久va久久久久| 欧美三级电影精品| 亚洲成人激情综合网| 欧美久久一区二区| 午夜激情一区二区三区| 67194成人在线观看| 日本麻豆一区二区三区视频| 91精品国产综合久久久久| 日韩国产欧美视频| 精品区一区二区| 国产精品综合久久| 中文字幕不卡在线播放| 不卡视频一二三| 亚洲欧美另类图片小说| 欧美在线啊v一区| 午夜精品久久久久| 日韩一区二区三区av| 久久成人免费网| 国产日韩欧美高清| 色婷婷久久久综合中文字幕| 亚洲一卡二卡三卡四卡 | 免费在线一区观看| 亚洲欧美怡红院| 精品精品欲导航| 亚洲丝袜自拍清纯另类| 欧洲精品中文字幕| 日韩成人伦理电影在线观看| 精品国产一区二区三区久久久蜜月| 国产乱人伦偷精品视频免下载| 中文字幕中文字幕在线一区| 欧美色窝79yyyycom| 久久精品国产免费看久久精品| 久久午夜国产精品| 99久免费精品视频在线观看| 亚洲3atv精品一区二区三区| 欧美xxxxx牲另类人与| 97精品久久久久中文字幕 | 激情五月激情综合网| 中文字幕亚洲一区二区av在线| 欧美亚洲高清一区|