Class HypermediaService

java.lang.Object
com.invirgance.convirgance.web.service.HypermediaService
All Implemented Interfaces:
Service

@Wiring public class HypermediaService extends Object implements Service
Provides a Hypermedia view for a resource, including handling of REST-like calls routed through verbs to account for only GET/POST being supported by HTML forms. Verbs are computed as the last component of the path and optionally provide both a view and a service handler. POST requests to a verb will call a configured service to handle the request and then redirect to a GET request to complete the Hypermedia rendering.

Parameters configured by this service will be received by pages called as regular HTTP request parameters. This allows configured parameters to be accessed by JSP pages as if they were in the url query string. e.g. ${param.id}, <%= request.getParameter("id") %>, etc.
Author:
jbanes
  • Constructor Details

    • HypermediaService

      public HypermediaService()
  • Method Details

    • getParameters

      public List<Parameter> getParameters()
      Gets the list of parameters to extract from the request.
      Returns:
      The parameters list
    • setParameters

      public void setParameters(List<Parameter> parameters)
      Sets the list of parameters to extract from the request.
      Parameters:
      parameters - The parameters list
    • getPage

      public String getPage()
      The default JSP or Servlet path to render for GET requests. The page will receive all parameters configured by this service as request parameters.
      Returns:
      the path to the JSP or servlet or null if no page has been set
    • setPage

      public void setPage(String page)
      Set a path to the default JSP or Servlet to render for GET requests. The page will receive all parameters configured by this service as request parameters.
      Parameters:
      page - the path to a JSP or servlet
    • getVerbs

      public List<HypermediaVerb> getVerbs()
      List of configured verbs for handling special requests like editing and creating records.
      Returns:
      list of configured verbs
    • setVerbs

      public void setVerbs(List<HypermediaVerb> verbs)
      Set a list of configured verbs for handling special requests like editing and creating records.
      Parameters:
      verbs - list of verbs
    • execute

      public void execute(HttpRequest request, HttpResponse response)
      Description copied from interface: Service
      Executes the service, processing the HTTP request and generating a response.
      Specified by:
      execute in interface Service
      Parameters:
      request - The HTTP request to process
      response - The HTTP response to populate