Class ViewResource

java.lang.Object
org.apache.juneau.rest.server.servlet.RestResource
org.apache.juneau.rest.server.view.ViewResource
Direct Known Subclasses:
FreemarkerResource, JspResource, MustacheResource, ThymeleafResource

public abstract class ViewResource extends RestResource
Abstract base for the child-resource flavors of the view mixin resources.

Mirror of ViewServlet for routed-child deployment: each per-engine bridge module ships a thin <Engine>Resource subclass that declares its own subtree mount via @Rest(path) (e.g. "/jsp") and supplies the per-engine RawTemplateDispatcher (the matching flavor-neutral <Engine>Dispatcher worker) via dispatcher().

The single greedy op declared here (@RestGet(path="/*")) captures the trailing remainder under the child's subtree mount and delegates straight to the shared RawTemplateDispatcher, so the mixin, servlet, and child forms cannot drift.

See Also:
Since:
10.0.0
  • Constructor Details

  • Method Details

    • dispatcher

      protected abstract RawTemplateDispatcher dispatcher()
      Returns the per-engine RawTemplateDispatcher this child delegates raw template dispatch to.

      Typically the matching flavor-neutral <Engine>Dispatcher worker (which implements RawTemplateDispatcher). Never null.

      Returns:
      The raw-template dispatcher. Never null.
    • render

      public void render(@Path("/*") String path, RestRequest req, RestResponse res) throws IOException
      [GET /*] — render the raw template identified by the trailing path under this child's subtree mount.
      Parameters:
      path - The trailing path segment after the mount prefix.
      req - The current REST request.
      res - The current REST response.
      Throws:
      IOException - If the underlying response writer fails.