Package spark
Class Redirect
- java.lang.Object
-
- spark.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.
-
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` instancevoid
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)
-
-
-
Field Detail
-
http
private Routable http
-
-
Constructor Detail
-
Redirect
private Redirect(Routable http)
-
-
Method Detail
-
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 pathtoPath
- 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 pathtoPath
- 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 pathtoPath
- 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 pathtoPath
- 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 pathtoPath
- 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 pathtoPath
- to pathstatus
- 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 pathtoPath
- to pathstatus
- 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 pathtoPath
- to pathstatus
- 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 pathtoPath
- to pathstatus
- 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 pathtoPath
- to pathstatus
- status code
-
redirectRoute
private static Route redirectRoute(java.lang.String toPath, Redirect.Status status)
-
-