Class StreamOrLocalURIToURLConverter

java.lang.Object
com.helger.photon.app.url.StreamOrLocalURIToURLConverter
All Implemented Interfaces:
IWebURIToURLConverter

public class StreamOrLocalURIToURLConverter extends Object implements IWebURIToURLConverter
The default implementation of IWebURIToURLConverter that uses LinkHelper.getStreamURL(IRequestWebScopeWithoutResponse, String) to convert relative URIs to URLs. If you are using a different stream servlet path, you may need to provide your own implementation and use it!
Author:
Philip Helger
  • Constructor Details

    • StreamOrLocalURIToURLConverter

      public StreamOrLocalURIToURLConverter()
  • Method Details

    • isProjectRelativeURI

      public static final boolean isProjectRelativeURI(@Nonnull @Nonempty String sURI)
      Absolute paths are project relative files and therefore are relative to the servlet context directory
      Parameters:
      sURI - The String to check. May neither be null nor empty.
      Returns:
      true if the URI starts with '/'
    • getAsResource

      @Nonnull public com.helger.commons.io.resource.IReadableResource getAsResource(@Nonnull @Nonempty String sURI)
      Description copied from interface: IWebURIToURLConverter
      Convert the passed URI to a resource.
      Specified by:
      getAsResource in interface IWebURIToURLConverter
      Parameters:
      sURI - The URI to be converted. May neither be null nor empty.
      Returns:
      The created resource and never null.
    • getAsResourceStatic

      @Nonnull public static com.helger.commons.io.resource.IReadableResource getAsResourceStatic(@Nonnull @Nonempty String sURI)
    • getAsURL

      @Nonnull public com.helger.commons.url.SimpleURL getAsURL(@Nonnull @Nonempty String sURI)
      Description copied from interface: IWebURIToURLConverter
      Convert the passed URI to a URL.
      Specified by:
      getAsURL in interface IWebURIToURLConverter
      Parameters:
      sURI - The URI to be converted. May neither be null nor empty.
      Returns:
      The created URL.
    • getAsURLStatic

      @Nonnull public static com.helger.commons.url.SimpleURL getAsURLStatic(@Nonnull @Nonempty String sURI)
    • getAsURL

      @Nonnull public com.helger.commons.url.SimpleURL getAsURL(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull @Nonempty String sURI)
      Description copied from interface: IWebURIToURLConverter
      Convert the passed URI to a URL.
      Specified by:
      getAsURL in interface IWebURIToURLConverter
      Parameters:
      aRequestScope - The request web scope to be used. Required for cookie-less handling. May not be null.
      sURI - The URI to be converted.
      Returns:
      The created URL.
    • getAsURLStatic

      @Nonnull public static com.helger.commons.url.SimpleURL getAsURLStatic(@Nonnull com.helger.web.scope.IRequestWebScopeWithoutResponse aRequestScope, @Nonnull @Nonempty String sURI)