Class HypermediaVerb

java.lang.Object
com.invirgance.convirgance.web.service.HypermediaVerb

@Wiring("verb") public class HypermediaVerb extends Object
Descriptor for handling Hypermedia REST requests using only GET and POST. A verb may provide a page to render for GET requests and a service to execute for POST requests. After the service is called, the client is redirected to a path without the verb by default. e.g. /owner/10/edit will redirect to /owner/10.

If an alternate redirect is desired, a redirect path can be set. The redirect path may contain parameters collected by the Hypermedia service or returned by the service configured to handle the POST request.
Author:
jbanes
  • Constructor Details

    • HypermediaVerb

      public HypermediaVerb()
  • Method Details

    • getName

      public String getName()
      The name of the verb to handle. e.g. "create", "edit", "add". Verbs are case-sensitive and are always the last component of the URL path.
      Returns:
      the name of the verb
    • setName

      public void setName(String name)
      Set the name of the verb to handle. e.g. "create", "edit", "add". Verbs are case-sensitive and are always the last component of the URL path.
      Parameters:
      name - the name this verb is to handle
    • getPage

      public String getPage()
      Path to a JSP page or Servlet to handle GET requests on the verb
      Returns:
      path to a JSP page or Servlet
    • setPage

      public void setPage(String page)
      Set the path to a JSP page or Servlet to handle GET requests on the verb
      Parameters:
      page - path to a JSP page or Servlet
    • getService

      public String getService()
      Path to a service for handling POST requests
      Returns:
      path to the service
    • setService

      public void setService(String service)
      Set path to a service for handling POST requests
      Parameters:
      service - path to the service
    • getMethod

      public String getMethod()
      HTTP method to use when calling the service for handling POST requests
      Returns:
      HTTP method or null if the method used to trigger the verb is to be passed through
    • setMethod

      public void setMethod(String method)
      Set HTTP method to use when calling the service for handling POST requests. Method must be upper case. e.g. POST, PUT, DELETE
      Parameters:
      method - upper case HTTP method
    • getRedirect

      public String getRedirect()
      If set, overrides the default redirect path after a POST request.
      Returns:
      redirect path if set, null otherwise
    • setRedirect

      public void setRedirect(String redirect)
      Sets the redirect path to use after a POST request. Paths can contain parameters collected by the Hypermedia service or returned by the service called to handle the POST. e.g. /owner/{ownerId}
      Parameters:
      redirect - path to redirect to after a POST request