mind serializer and weblog
[ start | index | login ]
start > midlet.post

midlet.post

Created by case. Last edited by case, 4 years and 338 days ago. Viewed 464 times. #1
[edit] [rdf]
labels
attachments

Motivation

For the WorkingTime midlet I needed HTTP POST to get data from my mobile to the outer world. As the internet offers open formmail cgi scripts and services, I thought this would be easy to use…

Trap

All my emulators worked fine with code as below having the output stream flushed in the end. On my device and within the Sun J2ME Toolkit, the cgi call failed, because the server complained about content-length and chunked data… I searched a lot and finally got the info, that flush() within device implementations might cause unforseen data changing… So simply leave it away. It worked on my Nokia 6610 quite fine after that change, even 'larger' (600 Bytes) ones worked.

c = (HttpConnection) Connector.open(POST_URL);
c.setRequestMethod(HttpConnection.POST);
c.setRequestProperty(
   "IF-Modified-Since",
   "25 Nov 2001 15:17:19 GMT");
c.setRequestProperty(
   "User-Agent",
   "Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-CA");
c.setRequestProperty(
   "Content-Type",
   "application/x-www-form-urlencoded");
os = c.openOutputStream();
os.write(postmsg);
// flush will cause message to be chunked on device! Webserver rejects!
//os.flush();
os.close();
no comments | post comment
Quick Links
WhatIsThis about?
Midlets (mobile apps)
TimeLine
Charley a dog's life
MovieReview
Impressum
Project (internal)

Logged in Users: (2)
… and 3 Guests.

< May 2008 >
SunMonTueWedThuFriSat
123
45678910
11121314151617
18192021222324
25262728293031

Icon-Snip more changes...

Blogs
>>++ vox.machina ++
>>Zitate - Sprüche - Aphorismen
>>Wil Wheaton
>>Mathematische Kleinigkeiten
>>William Gibson
>>instant-thinking
>>Over heard in NY

nearby  sites
link=http://www.mozilla.org/products/firefox/central.html
link=http://www.nutellausa.com/
link=http://snipsnap.org
link=http://www.amazon.de/exec/obidos/registry/wishlist/ref=cs_nav_top_2/028-7651535-0049343
RSS Feed RSS Feed
post to del.icio.us

Stats: 1169 snips by 16 users
created 5 years and 121 days ago

Powered by
>>SnipSnap 1.0b2-uttoxeter
with SnipScale 1.1.0



This work is licensed under a
>>Creative Commons License.

SEARCH