Class HypermediaVerb
java.lang.Object
com.invirgance.convirgance.web.service.HypermediaVerb
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.
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.
/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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionHTTP method to use when calling the service for handling POST requestsgetName()
The name of the verb to handle. e.g.getPage()
Path to a JSP page or Servlet to handle GET requests on the verbIf set, overrides the default redirect path after a POST request.Path to a service for handling POST requestsvoid
Set HTTP method to use when calling the service for handling POST requests.void
Set the name of the verb to handle. e.g.void
Set the path to a JSP page or Servlet to handle GET requests on the verbvoid
setRedirect
(String redirect) Sets the redirect path to use after a POST request.void
setService
(String service) Set path to a service for handling POST requests
-
Constructor Details
-
HypermediaVerb
public HypermediaVerb()
-
-
Method Details
-
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
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
Path to a JSP page or Servlet to handle GET requests on the verb- Returns:
- path to a JSP page or Servlet
-
setPage
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
Path to a service for handling POST requests- Returns:
- path to the service
-
setService
Set path to a service for handling POST requests- Parameters:
service
- path to the service
-
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
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
If set, overrides the default redirect path after a POST request.- Returns:
- redirect path if set, null otherwise
-
setRedirect
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
-