Tabnine Logo
WebContext.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.thymeleaf.context.WebContext
constructor

Best Java code snippets using org.thymeleaf.context.WebContext.<init> (Showing top 20 results out of 315)

origin: qiurunze123/miaosha

public String render(HttpServletRequest request, HttpServletResponse response, Model model, String tplName, KeyPrefix prefix, String key) {
  if(!pageCacheEnable) {
    return tplName;
  }
  //取缓存
  String html = redisService.get(prefix, key, String.class);
  if(!StringUtils.isEmpty(html)) {
    out(response, html);
    return null;
  }
  //手动渲染
  WebContext ctx = new WebContext(request,response,
      request.getServletContext(),request.getLocale(), model.asMap());
  html = thymeleafViewResolver.getTemplateEngine().process(tplName, ctx);
  if(!StringUtils.isEmpty(html)) {
    redisService.set(prefix, key, html);
  }
  out(response, html);
  return null;
}
origin: org.thymeleaf/thymeleaf-testing

protected IWebContext doCreateWebContextInstance(
    final ITest test,
    final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String,Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: thymeleaf/thymeleaf-testing

protected IWebContext doCreateWebContextInstance(
    final ITest test,
    final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String,Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: thymeleaf/thymeleaf-testing

public IWebContext versionSpecificCreateContextInstance(
    final ApplicationContext applicationContext, final HttpServletRequest request,
    final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String, Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: thymeleaf/thymeleaf-testing

public IWebContext versionSpecificCreateContextInstance(
    final ApplicationContext applicationContext, final HttpServletRequest request,
    final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String, Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: org.thymeleaf/thymeleaf-testing

public IWebContext versionSpecificCreateContextInstance(
    final ApplicationContext applicationContext, final HttpServletRequest request,
    final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String, Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: org.thymeleaf/thymeleaf-testing

public IWebContext versionSpecificCreateContextInstance(
    final ApplicationContext applicationContext, final HttpServletRequest request,
    final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String, Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: org.thymeleaf/thymeleaf-testing

public IWebContext versionSpecificCreateContextInstance(
    final ApplicationContext applicationContext, final HttpServletRequest request,
    final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String, Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: thymeleaf/thymeleaf-testing

public IWebContext versionSpecificCreateContextInstance(
    final ApplicationContext applicationContext, final HttpServletRequest request,
    final HttpServletResponse response, final ServletContext servletContext,
    final Locale locale, final Map<String, Object> variables) {
  return new WebContext(request, response, servletContext, locale, variables);
}
origin: org.crazyyak.dev/yak-dev-jersey-spring

 @Override
 public void writeTo(String templateReference, Viewable viewable, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream out) throws IOException {
  if (templateReference.startsWith("/") == false) {
   templateReference = "/"+templateReference;
  }

  Map<String,Object> variables = new HashMap<>();
  variables.put("it", viewable.getModel());

  WebContext webContext = new WebContext(request, response, servletContext, Locale.getDefault(), variables);
  String output = templateEngine.process(templateReference, webContext);
  out.write(output.getBytes());
 }
}
origin: nutzam/nutzboot

@Override
public void render(HttpServletRequest request, HttpServletResponse response, Object value) throws Exception {
  String path = evalPath(request, value);
  response.setContentType(contentType);
  response.setCharacterEncoding(encoding);
  try {
    Context ctx = createContext(request, value);
    WebContext context = new WebContext(request,
        response,
        Mvcs.getServletContext(),
        Locale.getDefault(),
        ctx.getInnerMap());
    templateEngine.process(path, context, response.getWriter());
  } catch (Exception e) {
    log.error("模板引擎错误", e);
    throw e;
  }
}
origin: justlive1/oxygen

public void handler(String path, Map<String, Object> data, Writer writer) {
 Request request = Request.current();
 templateEngine.process(path,
   new WebContext(request.getOriginalRequest(), Response.current().getOriginalResponse(),
     request.getOriginalRequest().getServletContext(), Locale.getDefault(), data), writer);
}
origin: com.oracle.ozark.ext/ozark-thymeleaf

  @Override
  public void processView(ViewEngineContext context) throws ViewEngineException {
    try {
      HttpServletRequest request = context.getRequest();
      HttpServletResponse response = context.getResponse();
      WebContext ctx = new WebContext(request, response, servletContext, request.getLocale());
      ctx.setVariables(context.getModels());
      engine.process(resolveView(context), ctx, response.getWriter());
    } catch (IOException e) {
      throw new ViewEngineException(e);
    }
  }
}
origin: ff4j/ff4j

/**
 * Invoked by dispatcher.
 *
 * @param req
 *      current request
 * @param res
 *      current response
 * @throws IOException
 *      error occured.
 */
public void post(HttpServletRequest req, HttpServletResponse res)
throws IOException {
  WebContext ctx = new WebContext(req, res,  req.getSession().getServletContext(), req.getLocale());
  ctx.setVariable("uptime",  getUptime());
  ctx.setVariable("version", ff4j.getVersion());
  // Adding attribute to response
  try {
    post(req, res, ctx);
  } catch(Throwable t) {
    ctx.setVariable("msgType", "error");
    ctx.setVariable("msgInfo", t.getMessage());
  }
  // Render to view
  templateEngine.process(getSuccessView(), ctx, res.getWriter());
}
origin: com.peterphi.std.guice/stdlib-guice-thymeleaf

  /**
   * Build a new IContext (exposing the HttpCallContext, where possible)
   *
   * @return
   */
  private IContext makeContext()
  {
    final HttpCallContext http = HttpCallContext.peek();

    if (http != null)
    {
      return new WebContext(http.getRequest(), http.getResponse(), http.getServletContext(), http.getRequest().getLocale());
    }
    else
    {
      return new Context();
    }
  }
}
origin: com.peterphi.std.guice/stdlib-guice-webapp

  /**
   * Build a new IContext (exposing the HttpCallContext, where possible)
   *
   * @return
   */
  protected IContext makeContext()
  {
    final HttpCallContext http = HttpCallContext.peek();

    if (http != null)
    {
      return new WebContext(http.getRequest(), http.getResponse(), http.getServletContext(), http.getRequest().getLocale());
    }
    else
    {
      return new Context();
    }
  }
}
origin: mkalus/segrada

WebContext context = new WebContext(requestInvoker.get(),
    responseInvoker.get(), servletContext, requestInvoker.get().getLocale());
if (viewable.getModel() != null) {
origin: com.github.dandelion/dandelion-thymeleaf

WebContext ctx = new WebContext(handlerContext.getRequest(), handlerContext.getResponse(), handlerContext
   .getRequest().getServletContext(), handlerContext.getRequest().getLocale());
origin: dandelion/dandelion

WebContext ctx = new WebContext(handlerContext.getRequest(), handlerContext.getResponse(), handlerContext
   .getRequest().getServletContext(), handlerContext.getRequest().getLocale());
origin: ff4j/ff4j

i18n(req, res);
WebContext ctx = new WebContext(req, res,  req.getSession().getServletContext(), res.getLocale());
ctx.setVariable("uptime",  getUptime());
ctx.setVariable("version", ff4j.getVersion());
org.thymeleaf.contextWebContext<init>

Javadoc

Create an instance without specifying a locale. Using this constructor, the default locale (Locale.getDefault()) will be used.

Popular methods of WebContext

  • setVariable
  • setVariables
  • getHttpServletRequest
  • getLocale
  • getRequest
  • getResponse
  • getSession
  • getVariables
  • getWebVariablesMap
  • setLocale

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Permission (java.security)
    Legacy security code; do not use.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Reference (javax.naming)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now