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)
IView
addAttribute
in interface IView
name
- 属性名称value
- 属性值public IView addAttributes(Map<String,Object> attributes)
IView
addAttributes
in interface IView
attributes
- 属性映射public <T> T getAttribute(String name)
IView
getAttribute
in interface IView
T
- 属性类型name
- 属性名称public Map<String,Object> getAttributes()
IView
getAttributes
in interface IView
public String getContentType()
IView
getContentType
in interface IView
public IView setContentType(String contentType)
IView
setContentType
in interface IView
contentType
- 内容类型public IView addDateHeader(String name, long date)
IView
addDateHeader
in interface IView
name
- Head名称date
- 值public IView addHeader(String name, String value)
IView
public IView addIntHeader(String name, int value)
IView
addIntHeader
in interface IView
name
- Head名称value
- 值protected void doViewInit(IWebMvc owner)
owner
- 所属WebMVC框架管理器protected abstract void doRenderView() throws Exception
Exception
- 抛出任何可能异常public void render(OutputStream output) throws Exception
IView
protected String buildUrl(String url) throws UnsupportedEncodingException
url
- 原始URL路径UnsupportedEncodingException
- URL编码异常Copyright © 2022. All rights reserved.