Package org.thymeleaf.context

Examples of org.thymeleaf.context.WebContext


    public static String escapeDots(String text) {
        return text.replaceAll("\\.", "\\\\\\\\.");
    }

    public static String getContextPath(Arguments arguments) {
        WebContext context = (WebContext) arguments.getContext();
        return context.getHttpServletRequest().getContextPath();
    }
View Full Code Here


      }

      ConformanceClient client = myCtx.newRestfulClient(ConformanceClient.class, myServerBase);
      Conformance conformance = client.getConformance();

      WebContext ctx = new WebContext(theReq, theResp, theReq.getServletContext(), theReq.getLocale());
      ctx.setVariable("conf", conformance);
      ctx.setVariable("base", myServerBase);
      ctx.setVariable("jsonEncodedConf", myCtx.newJsonParser().encodeResourceToString(conformance));
      myTemplateEngine.process(theReq.getPathInfo(), ctx, theResp.getWriter());
    } catch (Exception e) {
      ourLog.error("Failed to respond", e);
      theResp.sendError(500, e.getMessage());
    }
View Full Code Here

      }

      Header[] requestHeaders = applyHeaderFilters(lastRequest.getAllHeaders());
      Header[] responseHeaders = applyHeaderFilters(lastResponse.getAllHeaders());

      WebContext ctx = new WebContext(theReq, theResp, theReq.getServletContext(), theReq.getLocale());
      ctx.setVariable("base", myServerBase);
      ctx.setVariable("requestUrl", requestUrl);
      ctx.setVariable("action", action);
      ctx.setVariable("resultStatus", resultStatus);
      ctx.setVariable("requestBody", StringEscapeUtils.escapeHtml4(requestBody));
      ctx.setVariable("requestSyntaxHighlighterClass", requestSyntaxHighlighterClass);
      ctx.setVariable("resultBody", StringEscapeUtils.escapeHtml4(resultBody));
      ctx.setVariable("resultSyntaxHighlighterClass", resultSyntaxHighlighterClass);
      ctx.setVariable("requestHeaders", requestHeaders);
      ctx.setVariable("responseHeaders", responseHeaders);
      ctx.setVariable("narrative", narrativeString);

      myTemplateEngine.process(PUBLIC_TESTER_RESULT_HTML, ctx, theResp.getWriter());
    } catch (Exception e) {
      ourLog.error("Failure during processing", e);
      theResp.sendError(500, e.toString());
View Full Code Here

TOP

Related Classes of org.thymeleaf.context.WebContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.