Created
July 5, 2011 17:53
-
-
Save krasserm/1065413 to your computer and use it in GitHub Desktop.
GAE client login example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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