Example #1
0
  @Test
  public void testWithResourceSecure() throws Exception {
    IResourceContext ctx = ResourceRuntimeContext.ctx().getResourceContext();

    ctx.setSecure(true);

    String template = "Hello, ${res.img.local.eBayLogo_gif} and ${res.img.shared.eBayLogo_gif}!";
    String expected = "Hello, /test/img/eBayLogo.gif and /test/f/img/shared/eBayLogo.gif!";

    checkTemplate(template, expected);
  }
Example #2
0
  @Override
  public String build(IResourceContext ctx, IJs js) {
    prepare(js.getMeta().getUrn());

    StringBuilder sb = new StringBuilder(128);

    if (m_contextPath != null) {
      sb.append(m_contextPath);
    }

    if (m_jsBase != null) {
      sb.append(m_jsBase);
    }

    if (ctx.getPermutation() != null && !ctx.isFallbackPermutation()) {
      sb.append('/').append(ctx.getPermutation().toExternal());
    }

    sb.append(js.getMeta().getUrn().getPathInfo());

    return sb.toString();
  }