Package spark

Class Redirect

java.lang.Object
spark.Redirect

public final class Redirect extends Object
Provides redirect utility methods.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The available redirect status codes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Routable
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    any(String fromPath, String toPath)
    Redirects any HTTP request of type GET, POST, PUT, DELETE on 'fromPath' to 'toPath'
    void
    any(String fromPath, String toPath, Redirect.Status status)
    Redirects any HTTP request of type GET, POST, PUT, DELETE on 'fromPath' to 'toPath' with the provided redirect 'status' code.
    (package private) static Redirect
    Creates a `Redirect` instance
    void
    delete(String fromPath, String toPath)
    Redirects any HTTP request of type DELETE on 'fromPath' to 'toPath'
    void
    delete(String fromPath, String toPath, Redirect.Status status)
    Redirects any HTTP request of type DELETE on 'fromPath' to 'toPath' with the provided redirect 'status' code.
    void
    get(String fromPath, String toPath)
    Redirects any HTTP request of type GET on 'fromPath' to 'toPath'
    void
    get(String fromPath, String toPath, Redirect.Status status)
    Redirects any HTTP request of type GET on 'fromPath' to 'toPath' with the provided redirect 'status' code.
    void
    post(String fromPath, String toPath)
    Redirects any HTTP request of type POST on 'fromPath' to 'toPath'
    void
    post(String fromPath, String toPath, Redirect.Status status)
    Redirects any HTTP request of type POST on 'fromPath' to 'toPath' with the provided redirect 'status' code.
    void
    put(String fromPath, String toPath)
    Redirects any HTTP request of type PUT on 'fromPath' to 'toPath'
    void
    put(String fromPath, String toPath, Redirect.Status status)
    Redirects any HTTP request of type PUT on 'fromPath' to 'toPath' with the provided redirect 'status' code.
    private static Route
     

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • Redirect

      private Redirect(Routable http)
  • Method Details

    • create

      static Redirect create(Routable http)
      Creates a `Redirect` instance
    • any

      public void any(String fromPath, String toPath)
      Redirects any HTTP request of type GET, POST, PUT, DELETE on 'fromPath' to 'toPath'
      Parameters:
      fromPath - from path
      toPath - to path
    • get

      public void get(String fromPath, String toPath)
      Redirects any HTTP request of type GET on 'fromPath' to 'toPath'
      Parameters:
      fromPath - from path
      toPath - to path
    • post

      public void post(String fromPath, String toPath)
      Redirects any HTTP request of type POST on 'fromPath' to 'toPath'
      Parameters:
      fromPath - from path
      toPath - to path
    • put

      public void put(String fromPath, String toPath)
      Redirects any HTTP request of type PUT on 'fromPath' to 'toPath'
      Parameters:
      fromPath - from path
      toPath - to path
    • delete

      public void delete(String fromPath, String toPath)
      Redirects any HTTP request of type DELETE on 'fromPath' to 'toPath'
      Parameters:
      fromPath - from path
      toPath - to path
    • any

      public void any(String fromPath, String toPath, Redirect.Status status)
      Redirects any HTTP request of type GET, POST, PUT, DELETE on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      Parameters:
      fromPath - from path
      toPath - to path
      status - status code
    • get

      public void get(String fromPath, String toPath, Redirect.Status status)
      Redirects any HTTP request of type GET on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      Parameters:
      fromPath - from path
      toPath - to path
      status - status code
    • post

      public void post(String fromPath, String toPath, Redirect.Status status)
      Redirects any HTTP request of type POST on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      Parameters:
      fromPath - from path
      toPath - to path
      status - status code
    • put

      public void put(String fromPath, String toPath, Redirect.Status status)
      Redirects any HTTP request of type PUT on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      Parameters:
      fromPath - from path
      toPath - to path
      status - status code
    • delete

      public void delete(String fromPath, String toPath, Redirect.Status status)
      Redirects any HTTP request of type DELETE on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      Parameters:
      fromPath - from path
      toPath - to path
      status - status code
    • redirectRoute

      private static Route redirectRoute(String toPath, Redirect.Status status)