Dispatch on App Engine

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Dispatch on App Engine

pr1001
I'm trying to use Dispatch on App Engine (maybe silly, I know) and I'm getting the following error:

javax.net.ssl.HttpsURLConnection is a restricted class. Please see the Google App Engine developer's guide for more details.

So, I imagine this means that Dispatch cannot do HTTPS requests on App Engine? This seems to be because only the java.io.* methods are allowed (http://code.google.com/appengine/docs/java/jrewhitelist.html) in the URLFetch service (http://code.google.com/appengine/docs/java/urlfetch/overview.html).

Am I stuck, considering that I can only request the URL in question using HTTPS?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

n8han
Administrator
Not silly, in fact we have support for appengine coming in version 0.8. Should have a fresh beta of it later this week.
Nathan

"pr1001 [via Databinder]" <[hidden email]> wrote:
I'm trying to use Dispatch on App Engine (maybe silly, I know) and I'm getting the following error:

javax.net.ssl.HttpsURLConnection is a restricted class. Please see the Google App Engine developer's guide for more details.

So, I imagine this means that Dispatch cannot do HTTPS requests on App Engine? This seems to be because only the java.io.* methods are allowed (http://code.google.com/appengine/docs/java/jrewhitelist.html) in the URLFetch service (http://code.google.com/appengine/docs/java/urlfetch/overview.html).

Am I stuck, considering that I can only request the URL in question using HTTPS?

Thanks,
Peter



If you reply to this email, your message will be added to the discussion below:
http://databinder.3617998.n2.nabble.com/Dispatch-on-App-Engine-tp6002399p6002399.html
To start a new topic under Databinder, email [hidden email]
To unsubscribe from Databinder, click here.
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

pr1001
That'd be great, as then I wouldn't need to drop Dispatch. What's the best way to using the 0.8 betas? Build from source? Or is there a snapshot repo?

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

n8han
Administrator
The latest published artifact is Beta2:
http://scala-tools.org/repo-releases/net/databinder/dispatch-http-gae_2.8.1/0.8.0.Beta2/

As I mentioned I'm refactoring quite a bit for Beta3, but if you're eager to get started now the migration shouldn't be too painful to do later. We've used Beta2 in a number of appengine sites and it works without issue. Here's one example usage:
https://github.com/meetup/peacemeeter/blob/master/src/main/scala/App.scala#L14

Project defined as:
https://github.com/meetup/peacemeeter/blob/master/project/build/Project.scala

Nathan

On 02/09/2011 11:39 AM, pr1001 [via Databinder] wrote:
That'd be great, as then I wouldn't need to drop Dispatch. What's the best way to using the 0.8 betas? Build from source? Or is there a snapshot repo?

Peter


If you reply to this email, your message will be added to the discussion below:
http://databinder.3617998.n2.nabble.com/Dispatch-on-App-Engine-tp6002399p6008486.html
To start a new topic under Databinder, email [hidden email]
To unsubscribe from Databinder, click here.

Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

pr1001
Thanks, Nathan. Upgrading is ok except for the fact that << no longer seems to take my String that I was giving it before (a serialized JSON string, to be exact).

To give an example, this no longer compiles:

val req = pushReq / "" << write(message) <:< Map("Content-Type" -> "application/json") as (app_token, secret)

Suggestions?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

pr1001
I posted too soon. I see I know how to give a Content-Type when giving a string to be posted: http://sourced.implicit.ly/net.databinder/dispatch-core/0.8.0.Beta3/dispatch/requests.scala.html#25608
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

n8han
Administrator
In reply to this post by pr1001
Oh man... that was some refactoring roadkill, did not mean to actually remove it. I just put that method back into the 080 branch but for now you can call

<< (write(message), "utf-8")

for the same effect.

Nathan

On 02/14/2011 07:04 PM, pr1001 [via Databinder] wrote:
Thanks, Nathan. Upgrading is ok except for the fact that << no longer seems to take my String that I was giving it before (a serialized JSON string, to be exact).

To give an example, this no longer compiles:

val req = pushReq / "" << write(message) <:< Map("Content-Type" -> "application/json") as (app_token, secret)

Suggestions?

Thanks,
Peter


If you reply to this email, your message will be added to the discussion below:
http://databinder.3617998.n2.nabble.com/Dispatch-on-App-Engine-tp6002399p6025767.html
To start a new topic under Databinder, email [hidden email]
To unsubscribe from Databinder, click here.

Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

pr1001
Just to confirm, that should be "application/json", not "utf-8", right? Because the default charset is already used in the method when creating the new RefStringEntity.

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

n8han
Administrator
Sorry. I'm trying to answer questions too fast here, and introducing bugs in the process. You're right. Do you know if the old method set a default content-type, which you then had to override with that <:< or did it just post with no content-type header?

Nathan

On 02/14/2011 07:15 PM, pr1001 [via Databinder] wrote:
Just to confirm, that should be "application/json", not "utf-8", right? Because the default charset is already used in the method when creating the new RefStringEntity.

Peter


If you reply to this email, your message will be added to the discussion below:
http://databinder.3617998.n2.nabble.com/Dispatch-on-App-Engine-tp6002399p6025800.html
To start a new topic under Databinder, email [hidden email]
To unsubscribe from Databinder, click here.

Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

pr1001
I'm afraid I don't remember, but Git does. ;-)

https://github.com/n8han/Databinder-Dispatch/blob/0.7.8/http/src/main/scala/dispatch/Http.scala#L257

So no, no content-type is being set in this method.

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

n8han
Administrator
Well, what I'm worried about is that maybe HttpPost or something was setting one, but I'll just try it myself later to see.

On 02/14/2011 07:32 PM, pr1001 [via Databinder] wrote:
I'm afraid I don't remember, but Git does. ;-)

https://github.com/n8han/Databinder-Dispatch/blob/0.7.8/http/src/main/scala/dispatch/Http.scala#L257

So no, no content-type is being set in this method.

Peter


If you reply to this email, your message will be added to the discussion below:
http://databinder.3617998.n2.nabble.com/Dispatch-on-App-Engine-tp6002399p6025836.html
To start a new topic under Databinder, email [hidden email]
To unsubscribe from Databinder, click here.

Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

pr1001
While we're on the topic on 0.8 and App Engine, does this warning mean anything elseful?

Feb 15, 2011 1:22:32 AM org.apache.commons.httpclient.HttpMethodBase getResponseBody
WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
Feb 15, 2011 1:22:32 AM org.apache.commons.httpclient.HttpMethodBase getResponseBody
WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.

Namely, could and should a stream be used?

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

n8han
Administrator
What response handler is that for?
Nathan
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

pr1001
I think it's referring to >#, from JsHttp.
Reply | Threaded
Open this post in threaded view
|

Re: Dispatch on App Engine

n8han
Administrator
All right, opened a bug for that:
https://github.com/n8han/databinder-dispatch/issues#issue/16

On 02/15/2011 01:58 AM, pr1001 [via Databinder] wrote:
I think it's referring to >#, from JsHttp.


If you reply to this email, your message will be added to the discussion below:
http://databinder.3617998.n2.nabble.com/Dispatch-on-App-Engine-tp6002399p6026493.html
To start a new topic under Databinder, email [hidden email]
To unsubscribe from Databinder, click here.