Package org.zkoss.web.servlet.dsp
Class Interpreter
java.lang.Object
org.zkoss.web.servlet.dsp.Interpreter
The interpreter of the DSP file.
Note: we recognize only <%, <\%, %>, %\>, ${ and $\{.
Unlike JSP, we don't recognize \${ or \$\{.
- Author:
- tomyeh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final StringgetContentType(String path) Returns the content type by specifying a path, or null if no content type is available or path is null.final voidinterpret(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Writer out, String content, String ctype, org.zkoss.util.resource.Locator locator) Interprets the specified content based on the HTTP request.final voidinterpret(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String content, String ctype, org.zkoss.util.resource.Locator locator) Interprets the specified content based on the HTTP request.final voidinterpret(DspContext dc, String content, String ctype, org.zkoss.xel.XelContext xelc) Interprets the specified content and generates the result to the output specified inDspContext.final Interpretationparse(String content, String ctype, org.zkoss.xel.XelContext xelc, org.zkoss.util.resource.Locator loc) Parses a content to a meta format calledInterpretation.
-
Constructor Details
-
Interpreter
public Interpreter()Constructor.
-
-
Method Details
-
getContentType
Returns the content type by specifying a path, or null if no content type is available or path is null.It determines the content type by looking the extension. Note: it considers the extension of "a.css.dsp" as "css".
-
parse
public final Interpretation parse(String content, String ctype, org.zkoss.xel.XelContext xelc, org.zkoss.util.resource.Locator loc) throws DspException, IOException, org.zkoss.xel.XelException Parses a content to a meta format calledInterpretation.- Parameters:
xelc- the context formation for evaluating ZUL expressions. It can be null, in which case no additional functions and variable resolvers are initialized at the beginning.ctype- the content type. Optional. It is used only if no page action at all. If it is not specified and not page action, "text/html" is assumed.- Throws:
DspExceptionIOExceptionorg.zkoss.xel.XelException- Since:
- 3.0.0
-
interpret
public final void interpret(DspContext dc, String content, String ctype, org.zkoss.xel.XelContext xelc) throws DspException, IOException, org.zkoss.xel.XelException Interprets the specified content and generates the result to the output specified inDspContext.- Parameters:
dc- the interpreter context; never null.content- the content of DSP to interpretctype- the content type. Optional. It is used only if no page action at all. If it is not specified and not page action, "text/html" is assumed.- Throws:
DspExceptionIOExceptionorg.zkoss.xel.XelException- Since:
- 3.0.0
-
interpret
public final void interpret(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String content, String ctype, org.zkoss.util.resource.Locator locator) throws DspException, IOException, org.zkoss.xel.XelException Interprets the specified content based on the HTTP request. It actually wraps the HTTP request intoDspContextand then invokeinterpret(DspContext, String, String, XelContext).- Parameters:
locator- used to locate resources, such as taglib. If null is specified, the locator for the specified servlet context is used. (In other words, we useServletContextLocatorif locator is null).ctype- the content type. Optional. It is used only if no page action at all. If it is not specified and not page action, "text/html" is assumed.- Throws:
DspExceptionIOExceptionorg.zkoss.xel.XelException
-
interpret
public final void interpret(jakarta.servlet.ServletContext ctx, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Writer out, String content, String ctype, org.zkoss.util.resource.Locator locator) throws DspException, IOException, org.zkoss.xel.XelException Interprets the specified content based on the HTTP request. It actually wraps the HTTP request intoDspContextand then invokeinterpret(DspContext, String, String, XelContext).- Parameters:
locator- used to locate resources, such as taglib. If null is specified, the locator for the specified servlet context is used. (In other words, we useServletContextLocatorif locator is null).ctype- the content type. Optional. It is used only if no page action at all. If it is not specified and not page action, "text/html" is assumed.out- the output to generate the result. If null, it is the same asinterpret(ServletContext,HttpServletRequest,HttpServletResponse,String,String,Locator)In other words, response.getWriter() is used.- Throws:
DspExceptionIOExceptionorg.zkoss.xel.XelException- Since:
- 2.4.1
-