On Mar 19, 11:26 am, Mark Porter <[email protected]> wrote:
> try this:
>
> cx.getWrapFactory().setJavaPrimitiveWrap(false);
>
> Where "cx" is your Context reference. This tells Rhino to convert
> String, Number, Boolean and Character into their JavaScript
> equivalents when returning from a Java function
>
> ----------------------------------------------------------
> Mark Porter
>
> Myna JavaScript Application Server
> Easy server-side JS on a Java platformhttp://www.mynajs.org
>
> On Mar 17, 9:19 am, wolffiex <[email protected]> wrote:
>
>
>
> > hi list,
> > When I do this:
> > request = ...//java servletrequest object
> > var s = request.getParamter("p");
>
> > I want s to be a javascript string, not a java string. I want typeof s
> > == "string", not object.
>
> > A number of posts suggest that I want to implement something like
> > PrimitiveWrapFactory to do 
> > this:http://mxr.mozilla.org/mozilla/source/js/rhino/examples/PrimitiveWrap...
>
> > I've installed a wrap factory like this and verified that it is
> > (sometimes) called, but it doesn't appear to be invoked when, I say,
> > call getParameter on a java servlet request object. Can someone give
> > me a hint about what I'm doing wrong? Thanks,
> > A

Thanks for the reply Mark. I tried various versions of this but
couldn't get them to work. I'll post code if this is working for
everyone else. What I see is that my wrap factory gets invoked if I do
like:

var s = request.getParameter("s");
s = String(s);

But I don't want to force callers to remember that Java strings need
to be explicitly converted.

A
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to