Package spark

Class Redirect


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

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

      Fields 
      Modifier and Type Field Description
      private Routable http  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Redirect​(Routable http)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void any​(java.lang.String fromPath, java.lang.String toPath)
      Redirects any HTTP request of type GET, POST, PUT, DELETE on 'fromPath' to 'toPath'
      void any​(java.lang.String fromPath, java.lang.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 create​(Routable http)
      Creates a `Redirect` instance
      void delete​(java.lang.String fromPath, java.lang.String toPath)
      Redirects any HTTP request of type DELETE on 'fromPath' to 'toPath'
      void delete​(java.lang.String fromPath, java.lang.String toPath, Redirect.Status status)
      Redirects any HTTP request of type DELETE on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      void get​(java.lang.String fromPath, java.lang.String toPath)
      Redirects any HTTP request of type GET on 'fromPath' to 'toPath'
      void get​(java.lang.String fromPath, java.lang.String toPath, Redirect.Status status)
      Redirects any HTTP request of type GET on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      void post​(java.lang.String fromPath, java.lang.String toPath)
      Redirects any HTTP request of type POST on 'fromPath' to 'toPath'
      void post​(java.lang.String fromPath, java.lang.String toPath, Redirect.Status status)
      Redirects any HTTP request of type POST on 'fromPath' to 'toPath' with the provided redirect 'status' code.
      void put​(java.lang.String fromPath, java.lang.String toPath)
      Redirects any HTTP request of type PUT on 'fromPath' to 'toPath'
      void put​(java.lang.String fromPath, java.lang.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 redirectRoute​(java.lang.String toPath, Redirect.Status status)  
      • Methods inherited from class java.lang.Object

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

      • Redirect

        private Redirect​(Routable http)
    • Method Detail

      • create

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

        public void any​(java.lang.String fromPath,
                        java.lang.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​(java.lang.String fromPath,
                        java.lang.String toPath)
        Redirects any HTTP request of type GET on 'fromPath' to 'toPath'
        Parameters:
        fromPath - from path
        toPath - to path
      • post

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

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

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

        public void any​(java.lang.String fromPath,
                        java.lang.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​(java.lang.String fromPath,
                        java.lang.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​(java.lang.String fromPath,
                         java.lang.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​(java.lang.String fromPath,
                        java.lang.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​(java.lang.String fromPath,
                           java.lang.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​(java.lang.String toPath,
                                           Redirect.Status status)