Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Sending images over HTTP  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to send images over a HTTP connection from MIDP 2.0. I'm receiving the images on a Tomcat 5.0 server. I have successfully sent an image that is 2016 bytes in size, but as soon as the image is larger than that the servlet refuses to accept it. Can anyone help me. It's the last thing I have to do for this current project. I've studied this post with no success http://www.coderanch.com/t/227896/JME/Mobile/sending-image-server-HTTP-connection

Client Side-
DataOutputStream os = new DataOutputStream(hc.openOutputStream());
os.write(sendData, 0, sendData.length);
os.close();

Server Side-
int len = req.getContentLength();
byte[] b = new byte[len];
ServletInputStream in = req.getInputStream();
DataInputStream din = new DataInputStream(in);
din.read(b, 0, len);
File f = new File("c:/test.png");
FileImageOutputStream imout = new FileImageOutputStream(f);
imout.write(b,0,len);
imout.close();
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jari,

I'm sorry i don't have a solution to ur problem, but i have a doubt.
were u able to display images of size more than 10 KB.
i am using a resize function which does not allow me to do so.
 
Jari Kemppinen
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joel,

I am displaying an image that is 20k in size no problem currently on emulators. Waiting for the Nokia 6630 before I test the application on a real phone. If anyone can help me out with the http transfer that would be appreciated. Thanks.
 
Jari Kemppinen
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Revisited Michael Yuan's code and got image transfer working great with Tomcat5. If you read this Michael, thanks man, your a legend
 
author
Ranch Hand
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is cool. Thanks for the complement. I am glad that my writing is helpful!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there i might be a bit of subject but i need help! i bought a nokia 6630 an i have got a virus on it called [yuan] does anybody no how to remove it??? if u do plz e-mail me at marcus_russell@hotmail.co.uk thatnxs a lot ppl!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!