Slepetc / jappstart

Automatically exported from code.google.com/p/jappstart
0 stars 0 forks source link

blobstore and jappstart not playing nice together #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am trying to implement the Blobstore with this framework. 

I created a controller to handle the destination action that occurs after the 
upload. The annotation specifies a POST however the following exception is 
thrown: 

"Exception: org.springframework.web.HttpRequestMethodNotSupportedException: 
Request method 'GET' not supported"

I image something in the filter stack is not forwarding correctly, but that is 
just a guess at this point. Let me know if you need more info. 

Original issue reported on code.google.com by incredib...@gmail.com on 14 Oct 2011 at 2:18

GoogleCodeExporter commented 8 years ago
This sounds like an error in how your controller is configured. The controller 
will not handle a GET request if it's marked as POST.

Original comment by tlees...@gmail.com on 14 Oct 2011 at 2:35

GoogleCodeExporter commented 8 years ago

Original comment by tlees...@gmail.com on 14 Oct 2011 at 2:36

GoogleCodeExporter commented 8 years ago
I think it is configured correctly - see snippet:

@RequestMapping(value = "/addImg", method = RequestMethod.POST)
public final void addImgPost(HttpServletRequest req, HttpServletResponse res){ 
... }

The destination url is passed in during the blobstore url creation - 
blobstoreService.createUploadUrl("/addImg");

The error makes no sense. Have you ever used the blobstore with this framework? 
I would like to hear it is possible by someone who has done it before I chase 
my tail. 

Original comment by incredib...@gmail.com on 14 Oct 2011 at 2:45

GoogleCodeExporter commented 8 years ago
If you are sending a GET to /addImg when it expects a POST then the error does 
make sense. I checked the API docs (see below). It sounds like the request to 
the callback URL would be a GET and would fail since you marked it as POST 
which directly corresponds to the error message you are seeing. The callback 
URL is basically there to notify you when the upload is successful. Not handle 
the actual upload of the BLOB so it makes sense that it requires a GET.

createUploadUrl

java.lang.String createUploadUrl(java.lang.String successPath)
Create an absolute URL that can be used by a user to asynchronously upload a 
large blob. Upon completion of the upload, a callback is made to the specified 
URL.
Parameters:
successPath - A relative URL which will be invoked after the user successfully 
uploads a blob.
Throws:
java.lang.IllegalArgumentException - If successPath was not valid.
BlobstoreFailureException - If an error occurred while communicating with the 
blobstore.

Original comment by tlees...@gmail.com on 14 Oct 2011 at 2:55

GoogleCodeExporter commented 8 years ago
Ok - if I go to a GET - the follow exception is thrown - 
java.lang.IllegalStateException: Must be called from a blob upload callback 
request. I am not switching protocols [http only]

Do you recall any filter that may be redirecting, as opposed to forwarding?

Original comment by incredib...@gmail.com on 14 Oct 2011 at 3:03

GoogleCodeExporter commented 8 years ago
Hmm, hard to say what your issue is without seeing the code. The following are 
important things to understand with jappstart if you aren't familiar with them.

https://github.com/tleese22/google-app-engine-jappstart/blob/master/src/main/web
app/WEB-INF/applicationContext-security.xml
https://github.com/tleese22/google-app-engine-jappstart/blob/master/src/main/web
app/WEB-INF/web.xml

Original comment by tlees...@gmail.com on 14 Oct 2011 at 3:14

GoogleCodeExporter commented 8 years ago
I have gone through that code.

I think the quickest way to confirm this is to give it a try. Please implement 
the following into your framework: 
http://code.google.com/appengine/docs/java/blobstore/overview.html#Complete_Samp
le_App 

If all goes well, great, let me know how you did it - should take 30 min.

One last thing, I get a 404 on the generated upload url if i start the server 
with jRebel. 

Original comment by incredib...@gmail.com on 14 Oct 2011 at 4:32

GoogleCodeExporter commented 8 years ago
I have no immediate plans to implement blobstore support unless there is more 
interest. The errors you have described do not imply anything is wrong with 
jappstart. They just seem like implementation errors.

Original comment by tlees...@gmail.com on 14 Oct 2011 at 5:28

GoogleCodeExporter commented 8 years ago
in that case, i will take you up on your previous offer to see the code. I 
prepared a watered down version of the blobstore example that is based on a 
base install of jappstart. there are only 2 new files - addImg.jsp and 
showImg.jsp - links to addImg are in index and login. i look forward to hearing 
your thoughts. 

Original comment by incredib...@gmail.com on 14 Oct 2011 at 5:39

Attachments:

GoogleCodeExporter commented 8 years ago
Please let me know what your issue is and what you think is wrong with 
jappstart or I plan to close this issue. I don't have the time to debug things 
that aren't jappstart issues.

Original comment by tlees...@gmail.com on 24 Oct 2011 at 8:01

GoogleCodeExporter commented 8 years ago

Original comment by tlees...@gmail.com on 24 Nov 2011 at 6:21

GoogleCodeExporter commented 8 years ago
how did you prove it was invalid?

Original comment by incredib...@gmail.com on 24 Nov 2011 at 7:05