Class ControllerUtils

java.lang.Object
uk.ac.manchester.spinnaker.alloc.web.ControllerUtils

public abstract class ControllerUtils extends Object
Utilities to support MVC controllers.
  • Field Details

  • Method Details

    • uri

      public static URI uri(Object selfCall, Object... objects)
      Convert the result of calling a component builder delegate into a URL. Fixes the scheme to https and always ignores the query part.

      Do not define a static variable holding the result of MvcUriComponentsBuilder.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 result
      objects - Values to substitute into the template; can be none at all
      Returns:
      URL that will invoke the method
      See Also:
    • error

      public static ModelAndView error(String message)
      Create a view that shows an error to the user.
      Parameters:
      message - The error message.
      Returns:
      The view.
    • errorMessage

      public static String errorMessage(ObjectError error)
      Convert a problem with validation into a user-suitable error message.
      Parameters:
      error - The error detail.
      Returns:
      The message.