aspose file tools*
The moose likes Java Micro Edition and the fly likes How to send bytearray from Servlet to Midlet application? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to send bytearray from Servlet to Midlet application?" Watch "How to send bytearray from Servlet to Midlet application?" New topic
Author

How to send bytearray from Servlet to Midlet application?

Archana Maharjan
Greenhorn

Joined: Nov 12, 2010
Posts: 5
Hello everyone!
I'm trying to send bytes from servlet to midlet so that i could turn that bytes back to image and display in midlet.
Below are my codes!

//For Servlet


//For Midlet


What should I do in above codes to get screencapture in midlet application? Thanking in advance....
lokesh jain
Ranch Hand

Joined: Feb 21, 2009
Posts: 58
hi,
You need to treat midlet as the WebService client and you can call the method in the midlet then like this


here dbss.DB(DataQuery, UsrNam, Pswrd,FilNam) is the method of the web service .java file.

regards
Lokesh
Archana Maharjan
Greenhorn

Joined: Nov 12, 2010
Posts: 5
Dear Lokesh!
Is there any possible way to display that screencapture without using the database?
Is the way I've passed the bytearray into midlet application correct?
Is the way I'm getting the bytearray in midlet application through servlet correct?
And I want to draw that image in the canvas of the midlet.
I have ControlPCMidlet midlet application, LoginValidateThread where run thread invokes the invokeservlet.
Wht should I do?
lokesh jain
Ranch Hand

Joined: Feb 21, 2009
Posts: 58
hi Archana,
I have given you an example only, you can use the screen capture without use of Database things. To pass byteArray, you need to make the Midlet as client of the servlet. Yes, you can send byteArray from servlet to Midlet. You need to use Canvas class in midlet.
lokesh jain
Ranch Hand

Joined: Feb 21, 2009
Posts: 58
Hi, Here I would like to give you a link, which performs servlet to midlet communication. webpage

I think your doubt will be cleared.

regards
Lokesh
Archana Maharjan
Greenhorn

Joined: Nov 12, 2010
Posts: 5
Thank you Lokesh ji. It is solved now!
lokesh jain
Ranch Hand

Joined: Feb 21, 2009
Posts: 58
Hi,
That's good !! Can you tell me, how you did it. It will add to my knowledge base as well.


regards
Lokesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to send bytearray from Servlet to Midlet application?