Package com.medallia.spider.api

Examples of com.medallia.spider.api.StRenderer


  /** Pattern to extract the part of the class name preceding the "Task" postfix */
  private static final Pattern CLASS_NAME_PREFIX_PATTERN = Pattern.compile(".*\\.(.+)Task.*");

  /** @return the PostAction returned from {@link StRenderer#actionAndRender(ObjectProvider, Map)} on the given task */
  private PostAction render(ITask t, DynamicInputImpl dynamicInput, RequestHandler request, final List<EmbeddedContent> embeddedContent, final String relativeTemplatePath) {
    StRenderer renderer = new StRenderer(stringTemplateFactory, t) {
      @Override protected Pattern getClassNamePrefixPattern() {
        return CLASS_NAME_PREFIX_PATTERN;
      }
      @Override protected String getPageRelativePath() {
        return relativeTemplatePath;
      }
      @Override protected String renderFinal(StringTemplate st) {
        if (embeddedContent != null)
          addEmbedded(embeddedContent, st);
        return super.renderFinal(st);
      }
    };
   
    ObjectProvider injector = makeObjectProvider(request);

    long nt = System.nanoTime();
    PostAction po = renderer.actionAndRender(injector, makeLifecycleHandlerSet(request), dynamicInput);
    log.info("StRender of " + t.getClass().getSimpleName() + " in " + TimeUnit.MILLISECONDS.convert(System.nanoTime() - nt, TimeUnit.NANOSECONDS) + " ms");
    return po;
  }
View Full Code Here


  /** Pattern to extract the part of the class name preceding the "Task" postfix */
  private static final Pattern CLASS_NAME_PREFIX_PATTERN = Pattern.compile(".*\\.(.+)Task.*");

  /** @return the PostAction returned from {@link StRenderer#actionAndRender(ObjectProvider, Map)} on the given task */
  private PostAction render(ITask t, Map<String, String[]> reqParams, RequestHandler request, final List<EmbeddedContent> embeddedContent, final String relativeTemplatePath) {
    StRenderer renderer = new StRenderer(stringTemplateFactory, t) {
      @Override protected Pattern getClassNamePrefixPattern() {
        return CLASS_NAME_PREFIX_PATTERN;
      }
      @Override protected String getPageRelativePath() {
        return relativeTemplatePath;
      }
      @Override protected String renderFinal(StringTemplate st) {
        if (embeddedContent != null)
          addEmbedded(embeddedContent, st);
        return super.renderFinal(st);
      }
    };
    registerInputArgParser(renderer);
   
    ObjectProvider injector = makeObjectProvider(request);

    long nt = System.nanoTime();
    PostAction po = renderer.actionAndRender(injector, makeLifecycleHandlerSet(request), reqParams);
    log.info("StRender of " + t.getClass().getSimpleName() + " in " + TimeUnit.MILLISECONDS.convert(System.nanoTime() - nt, TimeUnit.NANOSECONDS) + " ms");
    return po;
  }
View Full Code Here

TOP

Related Classes of com.medallia.spider.api.StRenderer

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.