本文整理汇总了Java中javax.mvc.Models类的典型用法代码示例。如果您正苦于以下问题:Java Models类的具体用法?Java Models怎么用?Java Models使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Models类属于javax.mvc包,在下文中一共展示了Models类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processView
import javax.mvc.Models; //导入依赖的package包/类
@Override
public void processView(ViewEngineContext context) throws ViewEngineException {
Models models = context.getModels();
try (PrintWriter writer = context.getResponse().getWriter();
InputStream resourceAsStream = servletContext.getResourceAsStream(resolveView(context));
InputStreamReader in = new InputStreamReader(resourceAsStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(in);) {
String viewContent = bufferedReader.lines().collect(Collectors.joining());
Template template = handlebars.compileInline(viewContent);
template.apply(models, writer);
} catch (IOException e) {
throw new ViewEngineException(e);
}
}
示例2: processView
import javax.mvc.Models; //导入依赖的package包/类
@Override
public void processView(ViewEngineContext context)
throws ViewEngineException {
try {
Models models = context.getModels();
models.put("request", context.getRequest());
models.put("locale", context.getRequest().getLocale());
Writer writer = context.getResponse().getWriter();
engine.getMustache(context.getView()).render(writer, models);
writer.flush();
} catch (IOException e) {
throw new ViewEngineException(e);
}
}
示例3: getModels
import javax.mvc.Models; //导入依赖的package包/类
@Override
public Models getModels() {
return models;
}
示例4: MVCWebContext
import javax.mvc.Models; //导入依赖的package包/类
protected MVCWebContext(final HttpServletRequest request, final HttpServletResponse response,
final BeanManager beanManager, final ServletContext servletContext, final Models models) {
super(request, response, beanManager, servletContext);
this.models = models;
}
示例5: ViewEngineContextImpl
import javax.mvc.Models; //导入依赖的package包/类
/**
* Constructor for view engine contexts.
*
* @param view Name of view.
* @param models Instance of models.
* @param request HTTP servlet request.
* @param response HTTP servlet response.
* @param uriInfo URI info about the request.
* @param resourceInfo Resource matched info.
* @param configuration the configuration.
*/
public ViewEngineContextImpl(String view, Models models, HttpServletRequest request, HttpServletResponse response,
UriInfo uriInfo, ResourceInfo resourceInfo, Configuration configuration) {
this.view = view;
this.models = models;
this.request = request;
this.response = response;
this.uriInfo = uriInfo;
this.resourceInfo = resourceInfo;
this.configuration = configuration;
}
示例6: Viewable
import javax.mvc.Models; //导入依赖的package包/类
/**
* Constructs an instance using a view and a models instance.
*
* @param view the view.
* @param models the models instance.
*/
public Viewable(String view, Models models) {
this(view, models, null);
}
示例7: getModels
import javax.mvc.Models; //导入依赖的package包/类
/**
* Get the models instance.
*
* @return the models instance or {@code null}.
*/
public Models getModels() {
return models;
}
示例8: setModels
import javax.mvc.Models; //导入依赖的package包/类
/**
* Set the models instance.
*
* @param models the new models instance.
*/
public void setModels(Models models) {
this.models = models;
}