License X:Forge Tag Reference Request Component SQL Component XSL Component | Request ComponentThe X:Forge Request Component provides an easy way to retrieve one or more parameters from the Request. This fundamental feature lets users build dynamic XML content based on multiple request parameters: a step beyond traditional static content publishing suitable for merging sources dynamically. ConfigurationDeclaration
The use of this tool needs a declaration in the X:Forge configuration file.
All this is simply achieved through the association of an alias for
<component-instance name="Request" class="org.bibop.xml.xforge.components.http.ServletRequestComponent" allowemptyparameters="false" logger="mylogger"/> UsageInvocationOnce declared and configured the component can be used straight away in XML documents by invoking it through an <xf:process> tag and passing to it a "Request" parameter that contains the chosen names for params. Let's have an example: <level> <xf:process using="Request"> <xf:parameter name="level">1</xforge:parameter> </xf:process> </level> Resulting XML
This code generates one parameter named 'level' whose value is set by the component
defined in the X:Forge configuration file through the alias 'Request' namely
<level>1</level> Simple but dynamic: the same XML file will include a different level depending on the parameter requested! ErrorsKnown Error Conditions
Error HandlingAll exceptions are thrown back to the caller. Here is an example: org.xml.sax.SAXException: No value / default value has been specified for request parameter level at org.bibop.xml.xforge.components.http.ServletRequestComponent .toSax(ServletRequestComponent.java:67) at org.bibop.xml.xforge.XForgeProcessElement.toSax(XForgeProcessElement.java:132) at org.bibop.xml.xforge.XForgeProcessor.endElement(XForgeProcessor.java:294) at org.apache.cocoon.xml.dom.DOMStreamer.setElement(DOMStreamer.java:204) at org.apache.cocoon.xml.dom.DOMStreamer.processNode(DOMStreamer.java:107) at org.apache.cocoon.xml.dom.DOMStreamer.processChildren(DOMStreamer.java:148) at org.apache.cocoon.xml.dom.DOMStreamer.setElement(DOMStreamer.java:203) at org.apache.cocoon.xml.dom.DOMStreamer.processNode(DOMStreamer.java:107) at org.apache.cocoon.xml.dom.DOMStreamer.processChildren(DOMStreamer.java:148) at org.apache.cocoon.xml.dom.DOMStreamer.setElement(DOMStreamer.java:203) at org.apache.cocoon.xml.dom.DOMStreamer.processNode(DOMStreamer.java:107) at org.apache.cocoon.xml.dom.DOMStreamer.processChildren(DOMStreamer.java:148) at org.apache.cocoon.xml.dom.DOMStreamer.setElement(DOMStreamer.java:203) at org.apache.cocoon.xml.dom.DOMStreamer.processNode(DOMStreamer.java:107) at org.apache.cocoon.xml.dom.DOMStreamer.processChildren(DOMStreamer.java:148) at org.apache.cocoon.xml.dom.DOMStreamer.setDocument(DOMStreamer.java:155) at org.apache.cocoon.xml.dom.DOMStreamer.processNode(DOMStreamer.java:101) at org.apache.cocoon.xml.dom.DOMStreamer.stream(DOMStreamer.java:87) at org.bibop.xml.xforge.XForgeProcessor.process(XForgeProcessor.java:145) at org.bibop.xml.xforge.helpers.XForgeC1Processor.process(XForgeC1Processor.java:90) at org.apache.cocoon.Engine.handle(Engine.java:359) at org.apache.cocoon.Cocoon.service(Cocoon.java:181) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.connector.Ajp12ConnectionHandler .processConnection(Ajp12ConnectionHandler.java:166) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) |