blobstore redirects?

24 views
Skip to first unread message

pgio

unread,
Jul 26, 2010, 3:31:02 PM7/26/10
to appenginejs
Anyone having success working with the blobstore? I'm correctly
generating upload URLs and getting data (images) into the blobstore,
but my handler for the uploaded blobs isn't working, instead
returning:

HTTP ERROR 500

Problem accessing /save. Reason:

Expected a redirect, tried to write content instead.

The function I'm using is this (and remember this is the Ringo request/
response):

exports.save = function save(req) {
var blob = blobstore.getUploadedBlobs(req);
res.status = ("303");
res.setHeader =("Location", "/serve?key=" + blob.file.toString())

return redirectResponse("/serve?key=" + blob.file.toString());
}

Doesn't seem to matter what I put in the function or try to return.
Any ideas?
Thanks,
Pete

George Moschovitis

unread,
Jul 26, 2010, 5:39:53 PM7/26/10
to appen...@googlegroups.com
perhaps Ringo's redirect sets the response body...

try something like (in JSGI parlance):

return {status: 303, headers: {}, body []} 

if you still have problems let me know, and I 'll give it a look...

-g.

pgio

unread,
Jul 26, 2010, 10:02:00 PM7/26/10
to appenginejs
Ringo's redirect does set the body; I tried with an edited
redirectResponse() with an empty body; same thing.
Tried the direct return like you suggested. Returns the same error.
There's also this in the trace if it helps:

SEVERE: TypeError: Cannot read property "jack.servlet_request" from
undefined (google/appengine/api/blobstore.js#53)
Script stack:
at google/appengine/api/blobstore.js:53 (anonymous)

Thanks,
Pete

George Moschovitis

unread,
Jul 27, 2010, 12:33:26 AM7/27/10
to appen...@googlegroups.com
ah...yes...

this is old, narwhal code... will fix this shortly.

-g.

Hannes Wallnoefer

unread,
Jul 28, 2010, 7:18:26 AM7/28/10
to appen...@googlegroups.com
2010/7/27 pgio <pete.gi...@gmail.com>:

> Ringo's redirect does set the body; I tried with an edited
> redirectResponse() with an empty body; same thing.
> Tried the direct return like you suggested. Returns the same error.

I think the error is thrown already when
servletResponse.getOutputStream() is called, which is why it happens
even with an empty body. I just pushed a ringojs commit that might fix
this (depending on what appenginejs exactly does):

http://github.com/ringo/ringojs/commit/e13db993738252cf6f060a6a32d18546503372cb

hannes

George Moschovitis

unread,
Jul 28, 2010, 4:40:56 PM7/28/10
to appen...@googlegroups.com
I pushed some changed that *may* fix the problem.
Also pull the latest version of Ringo.

Give it a try and let me know if it works...

I 'll better test it tomorrow.

-g.


On Tue, Jul 27, 2010 at 5:02 AM, pgio <pete.gi...@gmail.com> wrote:

pgio

unread,
Jul 28, 2010, 11:33:01 PM7/28/10
to appenginejs

Pulled down the newest ringo, built it. Tried to build a new appengine
app but that failed on copying ringo.jar (even though it was built and
sitting there). So I had to fix that by copying over the bin
directory. Tried to install appenginejs (missing zipball error) so I
pulled down that source and installed the package manually,
transferred over my app and static directories, and on appengine
startup I get a 503 Service Unavailable.

If I just take the latest version of blobstore.js and replace the old
one in the current version of the app, I get the same error I got
before about expecting a redirect.

Don't know if the contortions I had to go through led to that 503 or
what. Gonna back away from the computer now...

Pete

George Moschovitis

unread,
Jul 29, 2010, 12:36:05 AM7/29/10
to appen...@googlegroups.com
Pulled down the newest ringo, built it. Tried to build a new appengine
app but that failed on copying ringo.jar (even though it was built and
sitting there). So I had to fix that by copying over the bin
directory.  Tried to install appenginejs (missing zipball error) so I

how did you try to install appenginejs?


> If I just take the latest version of blobstore.js and replace the old
> one in the current version of the app, I get the same error I got
> before about expecting a redirect.

OK, will update the appengine-blog-example with a blobstore example.

I 'll let you know when I have this ready.

-g.

pgio

unread,
Jul 29, 2010, 8:28:23 AM7/29/10
to appenginejs
ringo-admin install gmosx/appenginejs

On Jul 28, 11:36 pm, George Moschovitis <george.moschovi...@gmail.com>
wrote:

George Moschovitis

unread,
Jul 30, 2010, 12:00:09 PM7/30/10
to appenginejs
OK,

it took a little bit longer than expected but the blobstore API is now
compatible with Ringo.

you can see a demonstration in the updated appengine-blog-example:

http://www.nitrojs.org/appenginejs/appengine-blog-example.tar.gz

let me know if it works for you now.

-g.

PS: you need to pull the latest ringo and run: ant jar

PS2: thanks to hannes for helping with this fix.
Reply all
Reply to author
Forward
0 new messages