- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中httl.web.WebEngine
类的一些代码示例,展示了WebEngine
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebEngine
类的具体详情如下:
包路径:httl.web.WebEngine
类名称:WebEngine
[英]WebEngine (Integration, Singleton, ThreadSafe)
[中]WebEngine(集成、单例、线程安全)
代码示例来源:origin: httl/httl
public static String getTemplateSuffix() {
if (getServletContext() == null) {
return ".httl";
}
return getEngine().getProperty("template.suffix", new String[]{".httl"})[0];
}
代码示例来源:origin: com.github.httl/httl
public static String getTemplateSuffix(ServletContext servletContext) {
setServletContext(servletContext);
return getTemplateSuffix();
}
代码示例来源:origin: httl/httl
public void doFilter(HttpServletRequest request, HttpServletResponse response,
FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, response);
try {
WebEngine.setRequestAndResponse(request, response);
WebEngine.getEngine().getTemplate(getTemplatePath(request), request.getLocale()).render(response);
} catch (ParseException e) {
throw new ServletException(e.getMessage(), e);
}
}
代码示例来源:origin: httl/httl
@Override
public boolean checkResource(Locale locale) throws Exception {
WebEngine.setServletContext(getServletContext());
return WebEngine.getEngine().hasResource(getUrl(), locale);
}
代码示例来源:origin: httl/httl
public void init(FilterConfig config) throws ServletException {
suffix = WebEngine.getTemplateSuffix(config.getServletContext());
}
代码示例来源:origin: httl/httl
public static void setRequest(HttpServletRequest request) {
if (request != null && request.getSession() != null) {
setServletContext(request.getSession().getServletContext());
}
ServletResolver.setRequest(request);
}
代码示例来源:origin: httl/httl
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
WebEngine.setRequestAndResponse(request, response);
WebEngine.getEngine().getTemplate(getTemplatePath(request), request.getLocale()).render(response);
} catch (ParseException e) {
throw new ServletException(e.getMessage(), e);
}
}
代码示例来源:origin: httl/httl
WebEngine.setServletContext(servletContext);
try {
if (WebEngine.getEngine().hasResource(templateName)) {
template = WebEngine.getEngine().getTemplate(templateName);
break;
代码示例来源:origin: httl/httl
@Override
public void init() throws ServletException {
suffix = WebEngine.getTemplateSuffix(getServletContext());
}
代码示例来源:origin: com.github.httl/httl
public static void setRequest(HttpServletRequest request) {
if (request != null && request.getSession() != null) {
setServletContext(request.getSession().getServletContext());
}
ServletResolver.setRequest(request);
}
代码示例来源:origin: httl/httl
@Override
public void render() {
try {
WebEngine.setRequestAndResponse(request, response);
WebEngine.getEngine().getTemplate(this.view, request.getLocale()).render(response);
} catch (Exception e) {
throw new RenderException(e.getMessage(), e);
}
}
代码示例来源:origin: com.github.httl/httl
public static String getTemplateSuffix() {
if (getServletContext() == null) {
return ".httl";
}
return getEngine().getProperty("template.suffix", new String[] {".httl"})[0];
}
代码示例来源:origin: httl/httl
public static String getTemplateSuffix(ServletContext servletContext) {
setServletContext(servletContext);
return getTemplateSuffix();
}
代码示例来源:origin: httl/httl
protected String getTemplatePath(String path, HttpServletRequest request) {
String ext = WebEngine.getTemplateSuffix();
if (Strings.isBlank(path)) { // 空路径,采用默认规则
path = Files.renameSuffix(Mvcs.getRequestPath(request), ext);
if (! path.startsWith("/")) {
path = "/" + path;
}
} else if (path.charAt(0) == '/') { // 绝对路径 : 以 '/' 开头的路径不增加 '/WEB-INF'
if (! path.toLowerCase().endsWith(ext)) {
path += ext;
}
} else { // 包名形式的路径
path = path.replace('.', '/') + ext;
}
return path;
}
}
代码示例来源:origin: httl/httl
public static Engine getEngine() {
if (ENGINE == null) {
Object request = Context.getContext().get("request");
if (request instanceof HttpServletRequest && ((HttpServletRequest) request).getSession() != null) {
setServletContext(((HttpServletRequest) request).getSession().getServletContext());
} else {
setServletContext(ServletLoader.getAndCheckServletContext());
}
}
return ENGINE;
}
代码示例来源:origin: httl/httl
@Override
protected void renderMergedTemplateModel(Map<String, Object> model,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
WebEngine.setRequestAndResponse(request, response);
WebEngine.getEngine().getTemplate(getUrl(), request.getLocale(), model).render(model, response);
}
代码示例来源:origin: httl/httl
public boolean exists(String templateName) {
if (WebEngine.getServletContext() == null) {
return templateName.endsWith(getTemplateSuffix());
}
return WebEngine.getEngine().hasResource(getTemplatePath(templateName));
}
代码示例来源:origin: httl/httl
public void afterPropertiesSet() throws Exception {
WebEngine.setServletContext(getServletContext());
if (getSuffix() == null || getSuffix().length() == 0) {
super.setSuffix(WebEngine.getTemplateSuffix());
}
}
代码示例来源:origin: httl/httl
public String getViewExtension() {
return WebEngine.getTemplateSuffix(JFinal.me().getServletContext());
}
代码示例来源:origin: com.github.httl/httl
public static Engine getEngine() {
if (ENGINE == null) {
Object request = Context.getContext().get("request");
if (request instanceof HttpServletRequest && ((HttpServletRequest) request).getSession() != null) {
setServletContext(((HttpServletRequest) request).getSession().getServletContext());
} else {
setServletContext(ServletLoader.getAndCheckServletContext());
}
}
return ENGINE;
}
本文整理了Java中httl.web.WebEngine类的一些代码示例,展示了WebEngine类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一
本文整理了Java中httl.web.WebEngine.getEngine()方法的一些代码示例,展示了WebEngine.getEngine()的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中httl.web.WebEngine.getTemplateSuffix()方法的一些代码示例,展示了WebEngine.getTemplateSuffix()的具体用法。这些代码
本文整理了Java中httl.web.WebEngine.setServletContext()方法的一些代码示例,展示了WebEngine.setServletContext()的具体用法。这些代码
本文整理了Java中httl.web.WebEngine.setRequestAndResponse()方法的一些代码示例,展示了WebEngine.setRequestAndResponse()的具
我是一名优秀的程序员,十分优秀!