Class UrlRewriteConfiguration

java.lang.Object
org.kiwiproject.config.UrlRewriteConfiguration

public class UrlRewriteConfiguration extends Object
Specifies URL rewriting configuration used by EndpointConfiguration. Currently, supports only a URL path prefix.

As this is a configuration class generally intended to be populated from external configuration, it is mutable and supports construction in a variety of ways - no argument constructor and setter methods, all-arguments constructor, or a builder. Once constructed, it is intended to be read-only, though this cannot be enforced and still have setter methods.

  • Constructor Details

    • UrlRewriteConfiguration

      public UrlRewriteConfiguration()
    • UrlRewriteConfiguration

      @ConstructorProperties("pathPrefix") public UrlRewriteConfiguration(String pathPrefix)
      Creates a new UrlRewriteConfiguration instance.
      Parameters:
      pathPrefix - If specified, then URIs/URLs generated by EndpointConfiguration will include this prefix, e.g. given a URL https://acme.com/order/12345 and a prefix of /my-proxy, the resulting URL is https://acme.com/my-proxy/order/12345.
  • Method Details

    • none

      public static UrlRewriteConfiguration none()
      Returns and instance that will not perform any URL rewriting. Useful as a default value.
      Returns:
      a new "no-rewriting" UrlRewriteConfiguration
    • shouldRewrite

      public boolean shouldRewrite()
      Whether URL rewrites will be performed.
      Returns:
      true if there is a path prefix, false otherwise
    • builder

    • getPathPrefix

      public String getPathPrefix()
      If specified, then URIs/URLs generated by EndpointConfiguration will include this prefix, e.g. given a URL https://acme.com/order/12345 and a prefix of /my-proxy, the resulting URL is https://acme.com/my-proxy/order/12345.
    • setPathPrefix

      public void setPathPrefix(String pathPrefix)
      If specified, then URIs/URLs generated by EndpointConfiguration will include this prefix, e.g. given a URL https://acme.com/order/12345 and a prefix of /my-proxy, the resulting URL is https://acme.com/my-proxy/order/12345.