Re: Working with the query string within process()

0 views
Skip to first unread message

Tom Morris

unread,
Apr 13, 2012, 9:13:42 AM4/13/12
to google-refine-dev, google-refine
On Fri, Apr 13, 2012 at 12:10 AM, Ryan Mohr <ryan...@gmail.com> wrote:
> Within a controller's process() method I see that I can grab the query
> string using request.getQueryString().  Are there any helpers available for
> decomposing it into individual values?
>
> Coming from a rails background where I can just do a "value =
> params[:my_value]", it feels dirty to have to parse the string myself.

I'm guessing that you're talking about the Java source code? If so,
let's continue the conversation on the developer's list...

Tom

Tom Morris

unread,
Apr 13, 2012, 9:20:20 AM4/13/12
to google-refine-dev
On Fri, Apr 13, 2012 at 12:10 AM, Ryan Mohr <ryan...@gmail.com> wrote:
> Within a controller's process() method I see that I can grab the query
> string using request.getQueryString().  Are there any helpers available for
> decomposing it into individual values?

You don't provide much context, but for most of the places in stack
where you'd want to use the parameters (commands/operations, etc),
they're available in a map that gets passed in as part of the context.

There's also HttpServletRequest.getParameter().

If you can provide a little more context (module/class name, what
you're attempting, etc), perhaps we could provide more pertinent
advice.

Tom

Ryan Mohr

unread,
Apr 13, 2012, 5:03:04 PM4/13/12
to google-r...@googlegroups.com
Thanks Tom.  Wasn't aware there were two separate lists.

I'm referring to the "function process(path, request, response)" method within a module's controller.js.

-Ryan

Tom Morris

unread,
Apr 14, 2012, 1:01:15 PM4/14/12
to google-r...@googlegroups.com

The context at that point is provided by this module
http://code.google.com/p/simile-butterfly/source/browse/trunk/main/src/edu/mit/simile/butterfly/Butterfly.js
but of course you can include any Javascript libraries that you find
useful in your module.

Tom

Ryan Mohr

unread,
Apr 14, 2012, 2:32:11 PM4/14/12
to google-r...@googlegroups.com
Thanks.  Didn't want to start bringing in my own libraries if there were already built in libraries to handle this.

Where can I find good documentation on butterfly itself?  All I've been able to find is the user guide written back in 2010 (http://code.google.com/p/simile-butterfly/wiki/UserGuide) and the javadocs, both of which lack depth.

This was my favorite section from simile's user guide:  

entry = /
entry.skin = pretty
entry.foo = interesting

interesting = /
foo/
interesting
.skin = pretty

pretty
= /skin/

Very informative ;)

I thought I might find more information at http://code.google.com/p/google-refine/wiki/ClientSideArchitecture but only found a basic listing of the technologies used.

-Ryan

David Huynh

unread,
Apr 16, 2012, 5:51:47 PM4/16/12
to google-r...@googlegroups.com
Ryan,

Regarding your original question, request is an instance of


And so you can get specific parameters with this method


David

Ryan Mohr

unread,
Apr 16, 2012, 6:16:37 PM4/16/12
to google-r...@googlegroups.com
Thanks David.  That was an oversight on my part.  I had looked at the documentation for HttpServletRequest but overlooked the inherited methods.  getParameterMap is exactly what I was looking for.

With butterfly in general, which javascript files within a module are classic javascript files and which ones are java based?  I've never worked with butterfly before and it's an awkward concept for me to be writing javascript but working with java classes.

David Huynh

unread,
Apr 16, 2012, 6:21:05 PM4/16/12
to google-r...@googlegroups.com
On Mon, Apr 16, 2012 at 3:16 PM, Ryan Mohr <ryan...@gmail.com> wrote:
Thanks David.  That was an oversight on my part.  I had looked at the documentation for HttpServletRequest but overlooked the inherited methods.  getParameterMap is exactly what I was looking for.

With butterfly in general, which javascript files within a module are classic javascript files and which ones are java based?  I've never worked with butterfly before and it's an awkward concept for me to be writing javascript but working with java classes.

Only controller.js files in MOD-INF dirs are server-side Javascript.

David

Reply all
Reply to author
Forward
0 new messages