public abstract class AbstractMixer2XhtmlView
extends org.springframework.web.servlet.view.AbstractUrlBasedView
use this class with Mixer2XhtmlViewResolver
public class HelloWorldView extends AbstractMixer2XhtmlView {
@Autowired
private FooBar fooBar;
@Override
protected Html renderHtml(Html html, Map<String, Object> model, HttpServletRequest request,
HttpServletResponse response) throws TagTypeUnmatchException {
@SuppressWarnings("unchecked")
String message = (String) model.get("helloMessage");
Div div = html.getById("message", Div.class);
div.unsetContent();
div.getContent().add(message);
return html;
}
You NEED NOT to add "@Component" annotation because
Mixer2XhtmlViewResolver
instantiate the view class
through AutowireCapableBeanFactory.
Modifier and Type | Field and Description |
---|---|
protected String |
docType |
protected Mixer2Engine |
mixer2Engine |
protected org.springframework.core.io.ResourceLoader |
resourceLoader |
Constructor and Description |
---|
AbstractMixer2XhtmlView() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
static AbstractMixer2XhtmlView |
createDefaultView() |
String |
getDocType() |
Mixer2Engine |
getMixer2Engine() |
protected String |
modifyHtmlStringHook(String htmlString)
Override this method if you modify html as string right before http response.
|
protected abstract Html |
renderHtml(Html html,
Map<String,Object> model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Need implementation.
|
protected void |
renderMergedOutputModel(Map<String,Object> model,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected void |
responseHtml(Html renderedHtml,
javax.servlet.http.HttpServletResponse response) |
void |
setDocType(String docType) |
void |
setMixer2Engine(Mixer2Engine mixer2Engine) |
org.springframework.core.io.ResourceLoader |
setResourceLoader() |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
checkResource, getUrl, isUrlRequired, setUrl, toString
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, generatesDownloadContent, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getRequestToExpose, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposeContextBeansAsAttributes, setExposedContextBeanNames, setExposePathVariables, setRequestContextAttribute, setResponseContentType, writeToResponse
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
protected org.springframework.core.io.ResourceLoader resourceLoader
protected String docType
protected Mixer2Engine mixer2Engine
public static final AbstractMixer2XhtmlView createDefaultView()
public void setDocType(String docType)
public String getDocType()
public void setMixer2Engine(Mixer2Engine mixer2Engine)
public Mixer2Engine getMixer2Engine()
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
public org.springframework.core.io.ResourceLoader setResourceLoader()
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class org.springframework.web.servlet.view.AbstractUrlBasedView
Exception
protected void renderMergedOutputModel(Map<String,Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
renderMergedOutputModel
in class org.springframework.web.servlet.view.AbstractView
Exception
protected void responseHtml(Html renderedHtml, javax.servlet.http.HttpServletResponse response) throws IOException
IOException
protected String modifyHtmlStringHook(String htmlString)
htmlString
- String object that is saveToString()ed by mixer2Engine.protected abstract Html renderHtml(Html html, Map<String,Object> model, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
html
- Html
instance of xhtml
template that is loaded by Mixer2XhtmlViewResolver
.model
- request
- response
- Exception
- Mixer2XhtmlViewResolver
Copyright © 2021 Project Mixer2. All rights reserved.