public abstract class AbstractView extends Object implements IView
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Object> |
attributes |
protected static String |
baseViewPath |
protected String |
contentType |
protected HttpServletResponse |
response |
DEFAULT_CHARSET| Constructor and Description |
|---|
AbstractView() |
| Modifier and Type | Method and Description |
|---|---|
IView |
addAttribute(String name,
Object value)
添加视图属性
|
IView |
addAttributes(Map<String,Object> attributes)
添加视图属性
|
IView |
addDateHeader(String name,
long date)
设置请求回应头
|
IView |
addHeader(String name,
String value)
设置请求回应头
|
IView |
addIntHeader(String name,
int value)
设置请求回应头
|
protected String |
buildUrl(String url) |
protected String |
doProcessPath(String path,
String suffix,
boolean isJspView) |
protected abstract void |
doRenderView()
视图渲染具体操作
|
protected void |
doViewInit(IWebMvc owner)
初始化配置参数(全局)
|
<T> T |
getAttribute(String name)
获取视图对象属性key的值
|
Map<String,Object> |
getAttributes()
获取视图对象的属性映射
|
static String |
getBaseViewPath(IWebMvc owner) |
String |
getContentType()
获取视图内容类型
|
void |
render()
视图渲染动作
|
void |
render(OutputStream output)
视图渲染动作
|
IView |
setContentType(String contentType)
设置视图内容类型
|
protected static volatile String baseViewPath
protected HttpServletResponse response
protected String contentType
public IView addAttribute(String name, Object value)
IViewaddAttribute in interface IViewname - 属性名称value - 属性值public IView addAttributes(Map<String,Object> attributes)
IViewaddAttributes in interface IViewattributes - 属性映射public <T> T getAttribute(String name)
IViewgetAttribute in interface IViewT - 属性类型name - 属性名称public Map<String,Object> getAttributes()
IViewgetAttributes in interface IViewpublic String getContentType()
IViewgetContentType in interface IViewpublic IView setContentType(String contentType)
IViewsetContentType in interface IViewcontentType - 内容类型public IView addDateHeader(String name, long date)
IViewaddDateHeader in interface IViewname - Head名称date - 值public IView addHeader(String name, String value)
IViewpublic IView addIntHeader(String name, int value)
IViewaddIntHeader in interface IViewname - Head名称value - 值protected void doViewInit(IWebMvc owner)
owner - 所属WebMVC框架管理器protected abstract void doRenderView()
throws Exception
Exception - 抛出任何可能异常public void render(OutputStream output) throws Exception
IViewprotected String buildUrl(String url) throws UnsupportedEncodingException
url - 原始URL路径UnsupportedEncodingException - URL编码异常Copyright © 2022. All rights reserved.