XQJ: Global Extension Mechanism
Added by Anonymous almost 18 years ago
Legacy ID: #4062804 Legacy Poster: Monte Hansen (monte-hansen)
I wrote a HttpServlet to process XQuery files over HTTP. Is there a method for embedding a class instance for page processing? For instance, I would like to include a reference to an HttpRequest wrapper to the template. Not finding a native method, I did a work-around that binds a token to the template to lookup the instance via a static method to the wrapper (see below). While this method works, it means that an unorthodox instance lookup method is needed to support it. If there is support for this and I am not seeing it, I would love to know. Otherwise, you might consider it for future releases. declare namespace request="java:com.company.common.web.XQueryServlet"; declare variable $request-id as xs:string external; <page> { let $d := request:getRequestParameters( $request-id ) return $d } </page> Monte
Replies (2)
RE: XQJ: Global Extension Mechanism - Added by Anonymous almost 18 years ago
Legacy ID: #4062809 Legacy Poster: Monte Hansen (monte-hansen)
BTW: I thought I could use bindObject to bind an instance, but could find a suitable type.
RE: XQJ: Global Extension Mechanism - Added by Anonymous almost 18 years ago
Legacy ID: #4063427 Legacy Poster: Michael Kay (mhkay)
I don't understand why you are passing the request-id from your application to the query, and then calling back from the query to the application to get the request parameters. The usual technique is simply to read the query parameters within the Java application, and then pass them (typically as external variables, or if you prefer as an XML structure supplied as the context node) as input to the query. I don't see the need for a call back. Michael Kay http://www.saxonica.com/
Please register to reply