commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <dmi...@apache.org>
Subject Re: [jxpath] disabling static method invocation [was: howto optimize]
Date Tue, 29 Jun 2004 21:11:59 GMT
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" <keesj@dds.nl>
To: <commons-user@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


Mime
View raw message