Class ControllerUtils
java.lang.Object
uk.ac.manchester.spinnaker.alloc.web.ControllerUtils
public abstract class ControllerUtils extends Object
Utilities to support MVC controllers.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ControllerUtils.ViewFactory
Creates aModelAndView
on demand. -
Field Summary
Fields Modifier and Type Field Description static String
CHANGE_PASSWORD_PATH
The URI path to use to change passwords.static String
CHANGE_PASSWORD_URI
The change password URI variable for JSP pages.static String
LOGIN_OIDC_PATH
The URI path to use to perform OIDC logins.static String
LOGIN_OIDC_URI
The OIDC URI variable for JSP pages.static String
LOGIN_PATH
The URI path to use to perform logins.static String
LOGIN_URI
The logout URI variable for JSP pages.static String
LOGOUT_PATH
The URI path to use to perform logouts.static String
LOGOUT_URI
The login URI variable for JSP pages.static String
MAIN_URI
The main URI variable for JSP pages.static String
MVC_ERROR
The name of the Spring MVC error view.static String
SPALLOC_CSS_PATH
The URI path of the Spalloc CSS file.static String
SPALLOC_CSS_URI
The Spalloc CSS URI variable for JSP pages.static String
SPALLOC_JS_PATH
The URI path of the Spalloc JS file.static String
SPALLOC_JS_URI
The Spalloc JS URI variable for JSP pages. -
Method Summary
Modifier and Type Method Description static ModelAndView
error(String message)
Create a view that shows an error to the user.static String
errorMessage(ObjectError error)
Convert a problem with validation into a user-suitable error message.static URI
uri(Object selfCall, Object... objects)
Convert the result of calling a component builder delegate into a URL.
-
Field Details
-
MVC_ERROR
The name of the Spring MVC error view.- See Also:
- Constant Field Values
-
MAIN_URI
The main URI variable for JSP pages.- See Also:
- Constant Field Values
-
CHANGE_PASSWORD_URI
The change password URI variable for JSP pages.- See Also:
- Constant Field Values
-
LOGOUT_URI
The login URI variable for JSP pages.- See Also:
- Constant Field Values
-
LOGIN_URI
The logout URI variable for JSP pages.- See Also:
- Constant Field Values
-
LOGIN_OIDC_URI
The OIDC URI variable for JSP pages.- See Also:
- Constant Field Values
-
SPALLOC_CSS_URI
The Spalloc CSS URI variable for JSP pages.- See Also:
- Constant Field Values
-
SPALLOC_JS_URI
The Spalloc JS URI variable for JSP pages.- See Also:
- Constant Field Values
-
LOGIN_PATH
The URI path to use to perform logins.- See Also:
- Constant Field Values
-
LOGIN_OIDC_PATH
The URI path to use to perform OIDC logins.- See Also:
- Constant Field Values
-
CHANGE_PASSWORD_PATH
The URI path to use to change passwords.- See Also:
- Constant Field Values
-
LOGOUT_PATH
The URI path to use to perform logouts.- See Also:
- Constant Field Values
-
SPALLOC_CSS_PATH
The URI path of the Spalloc CSS file.- See Also:
- Constant Field Values
-
SPALLOC_JS_PATH
The URI path of the Spalloc JS file.- See Also:
- Constant Field Values
-
-
Method Details
-
uri
Convert the result of calling a component builder delegate into a URL. Fixes the scheme tohttps
and always ignores the query part.Do not define a
static
variable holding the result ofMvcUriComponentsBuilder.on(Class)
; it tries to be request-aware, and that defeats it. Rely on the Spring MVC core to do the relevant object caching.- Parameters:
selfCall
- component builder delegate resultobjects
- Values to substitute into the template; can be none at all- Returns:
- URL that will invoke the method
- See Also:
MvcUriComponentsBuilder
-
error
Create a view that shows an error to the user.- Parameters:
message
- The error message.- Returns:
- The view.
-
errorMessage
Convert a problem with validation into a user-suitable error message.- Parameters:
error
- The error detail.- Returns:
- The message.
-