Package org.apache.juneau.rest.server.view.jsp
juneau-rest-server-view-jsp module.
Provides three sibling pieces that together let a Juneau REST resource render JSP templates:
JspMixin— mixin that serves raw.jspresources from the importer's classpath under/jsp/*.JspView— immutable value class (implements the coreViewinterface) returned from@RestOpmethods to ask the framework to render a JSP.JspViewRenderer—ResponseProcessorthat detectsJspViewreturns and dispatches viaServletContext.getRequestDispatcher(...).forward(...).
Note: by default a host's own @RestOp methods only see the host's own
@Rest(responseProcessors=...) chain
— a mixin's contributed processors apply only to the mixin's own endpoints (e.g.
JspMixin's /jsp/* route), not to the host's. To have the host's own @RestOp
methods dispatch JspView returns through the JSP
engine, the host opts in via
@Mixin(mergeIntoHost=true) (recommended —
folds JspMixin's responseProcessors into the host's own chain, see the example below), or
alternatively lists
JspViewRenderer.class explicitly in its own
@Rest(responseProcessors=...).
Composition example (microservice):
Engine-agnostic packaging:
The bridge module's main POM declares only the JSP API + JSTL impl in provided
scope — no JSP engine ships here. Consumers add the engine matching their
container:
- Jetty 12 EE11 (microservice-jetty, Spring Boot embedded Jetty):
org.eclipse.jetty.ee11:jetty-ee11-apache-jsp. - Embedded Tomcat (Spring Boot default):
org.apache.tomcat.embed:tomcat-embed-jasper. - External-WAR deployments (Tomcat / JBoss / WildFly): engine is already on the container's classpath; no additional dependency required.
When no engine is on the classpath, the renderer surfaces a clear diagnostic naming the
missing dependency and linking to the "Choosing a JSP engine" matrix in
JspViewSupport.md.
See Also:
- Since:
- 10.0.0
-
ClassesClassDescriptionFlavor-neutral worker bean carrying the JSP raw-template-dispatch logic shared by the
JspMixinmixin, theJspServletservlet, and theJspResourcechild flavors.Builder forJspDispatcher.Mixin that wires JSP view-rendering onto any Juneau REST resource.Builder forJspMixin.Child-resource flavor of theJspMixinmixin.Standalone servlet companion of theJspMixinmixin.Immutable value class returned from@RestOp-annotated methods to ask the framework to render a JSP template.ResponseProcessorthat detectsJspView-typed return values and dispatches them to the underlying JSP engine viaServletContext.getRequestDispatcher(...).forward(...).