You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Dmitri Plotnikov <dm...@apache.org> on 2004/06/29 23:11:59 UTC

Re: [jxpath] disabling static method invocation [was: howto optimize]

Kees,

The answer to your second question: "is there a way I can disable the jxpath
feature that enables it to call static
methods?", the answer is yes.  Just set an empty implementation of the
Functions interface on the JXPathContext like this:

context.setFunctions(new Functions(){
       public Set getUsedNamespaces() { return Collections.EMPTY_SET; }
       public Function getFunction(String namespace, String name, Object[]
parameters) { return null; }
});

I hope this helps

- Dmitri

----- Original Message ----- 
From: "Kees Jongenburger" <ke...@dds.nl>
To: <co...@jakarta.apache.org>
Sent: Sunday, June 20, 2004 4:56 PM
Subject: [jxpath] howto optimize


> Hi
>
> I am in  the process of learing jxpath and I wonder if it is possible to
> optimize results.
> (I am programming against the mmbase bridge)
> http://www.mmbase.org/api/org/mmbase/bridge/Cloud.html
>
> and have this jxpah query
>
> JXPathContext context = JXPathContext.newContext(cloud);
> NodeManager nodeManager = (NodeManager)
context.getValue("nodeManagers[name =
> 'news' ]/.");
>
> This of course gets all "nodeManagers" and iterates though the result. Now
the
> Cloud interface also has a method getNodeManager(String name);
> that I called via jxpath
> JXPathContext context = JXPathContext.newContext(cloud);
> context.getVariables().declareVariable("cloud", cloud);
> NodeManager nodeManager
> =(NodeManager)context.getValue("getNodeManager($cloud,'news')");
>
> This of course looks to much like java code:)
>
> can sombody tell me is it's possible  for jxpath to delegate some
"constraints
> (like name = "news") to an other class?
>
>
> my second question:
> is there a way I can disable the jxpath feature that enables it to call
static
> methods? I would like to use jxpah to provice access to mmbase from a
remote
> location but
> JXPathContext context = JXPathContext.newContext(new String());
> context.getValue("java.lang.System.exit(1)");
>
> scares me :)
>
> greeting and (for me sleepless nights).
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org