Class FreemarkerURLHelper

java.lang.Object
com.peterphi.std.guice.freemarker.FreemarkerURLHelper
Direct Known Subclasses:
DebugPerRequestFreemarkerURLHelper

public class FreemarkerURLHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    FreemarkerURLHelper(URI restEndpoint, URI webappEndpoint)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    javax.ws.rs.core.UriBuilder
    Return a UriBuilder for an absolute URI
    protected String
     
    javax.ws.rs.core.UriBuilder
     
    Returns a URL for a resource from the context path
    Return only the path for a given URL
    Returns a relative URL for a resource from the REST path, assuming it is relative to another path on the same server.
    Similar to the relativeRest method, however this performs concatenation using String operations rather than UriBuilder, allowing the representation of URLs which are technically invalid (e.g.
    javax.ws.rs.core.UriBuilder
     
    rest(String path)
    Returns a URL for a resource from the REST path (which may be different from the context path)
    Similar to the rest method, however this performs concatenation using String operations rather than UriBuilder, allowing the representation of URLs which are technically invalid (e.g.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FreemarkerURLHelper

      public FreemarkerURLHelper(URI restEndpoint, URI webappEndpoint)
  • Method Details

    • context

      public javax.ws.rs.core.UriBuilder context()
    • rest

      public javax.ws.rs.core.UriBuilder rest()
    • context

      public String context(String path)
      Returns a URL for a resource from the context path
      Parameters:
      path -
      Returns:
    • rest

      public String rest(String path)
      Returns a URL for a resource from the REST path (which may be different from the context path)
      Parameters:
      path -
      Returns:
    • relativeRest

      public String relativeRest(String path)
      Returns a relative URL for a resource from the REST path, assuming it is relative to another path on the same server.
      Parameters:
      path -
      Returns:
    • restConcat

      public String restConcat(String path)
      Similar to the rest method, however this performs concatenation using String operations rather than UriBuilder, allowing the representation of URLs which are technically invalid (e.g. using templates)
      Parameters:
      path -
      Returns:
    • relativeRestConcat

      public String relativeRestConcat(String path)
      Similar to the relativeRest method, however this performs concatenation using String operations rather than UriBuilder, allowing the representation of URLs which are technically invalid (e.g. using templates)
      Parameters:
      path -
      Returns:
    • absolute

      public javax.ws.rs.core.UriBuilder absolute(String path)
      Return a UriBuilder for an absolute URI
      Parameters:
      path -
      Returns:
    • relative

      public String relative(String url)
      Return only the path for a given URL
      Parameters:
      url -
      Returns:
    • concat

      protected String concat(String a, String b)