Skip to content

Instantly share code, notes, and snippets.

@krasserm
Created July 5, 2011 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krasserm/1065413 to your computer and use it in GitHub Desktop.
Save krasserm/1065413 to your computer and use it in GitHub Desktop.
GAE client login example
import org.apache.http.client.methods.HttpPost
import org.apache.http.client.params.ClientPNames._
import org.apache.http.client.HttpClient
import org.apache.http.entity.StringEntity
// other imports omitted ...
object GCAuthExample {
def main(args:Array[String]) {
val cookie = ... // get cookie via glogin Camel component
withHttpClient { client => // an HttpClient
val httpPost = new HttpPost("https://camelcloud.appspot.com/camel/weather")
httpPost.addHeader("Cookie", cookie)
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded")
httpPost.setEntity(new StringEntity("city=Graz&mailtocurrent=on"))
client.execute(httpPost)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment