wood burning stoves 2.0*
The moose likes Java Micro Edition and the fly likes Its about uniqueIDs again! Problems with downloading modified jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Its about uniqueIDs again! Problems with downloading modified jar files" Watch "Its about uniqueIDs again! Problems with downloading modified jar files" New topic
Author

Its about uniqueIDs again! Problems with downloading modified jar files

Ian Strain
Ranch Hand

Joined: Jun 30, 2004
Posts: 49
Ok I created a game. When a user goes to the wap site to download the game I have created a servlet that generates a uniqueID and then creates a java file with the uniqueID in it..
public final class GameProperties {
public final static long userID = 23423526;
public final static int gameID = 1;

public long getUserID(){ return userID;
}
}

I then compile this java file on the server and then add it to the games jar file. This works!
The problem is when I have created the jar file I use an outputstream to send the file to the phone. It works on most of the phones I use to test on, Nokia 6230, Nokia 3510i, Sony Ericsson K700i, Motorolo V80 and Motorola V500. But on the Sony Ericsson T630i I get the error "You client is not allowed to access the requested object" and on the Sharp GX-30 I get "unsupported content type"
So instead I tried to store the modified jar file on the server and use the jad file to send a request to the servlet to modify the jar file. This doesn't work on any phone. Would it be because the file size in the jad file is different from the actual size of the jar file?

I think this is the only possible way of giving a user a unique ID from the server. If anyone has any other way that will stop me having to modify the jar file (I've already tried modifying the jad file and its no good cos some phones don't download them) it would be a great help


"its bad luck to be superstitious....."
Punit Raizada
Ranch Hand

Joined: Mar 20, 2004
Posts: 156
The size of the Jar mentioned in the Jad MUST be the size of the actual jar on the server for OTA to work.

As for the unique ID .. this is a real issue ... but depends on your implementation.. i am lucky in a way that i can ask the downloading user for his/her ID in the WML page before showing them the Jad to download the MIDlet.

Is it possible for you to do it this way ? I really am not sure
- User accesses WAP page.
- Selects link to download Jad
- Now in the earlier step when the user click on Download Jad.. that request is sent to the server. The server creates a new jar file ... gets its size .. writes the new size into the jad ... and then shoots back another WML ( or xHTML) page to the phone having a link "GET IT NOW"
- When the user clicks on GET IT NOW .. they download the new Jad and Jar..

I know this is not the best way .. but it can work .. i.e. if you are willing to add another step from the users perspective ( going to the GET IT NOW page) to the download process..


QUESTION >> Dont all the devices have to download the Jad file during OTA... I am under the impression that this part of the OTA specification.. Can anyone please clear my doubt.


Regards


SCJP 1.4
Everything that can go wrong will go wrong -Murphy
Ian Strain
Ranch Hand

Joined: Jun 30, 2004
Posts: 49
I'm looking into modifying the jad file after creating a new jar file. Seems like the only way about it.
From what I've seen, the Sony Ericsson phones do not download the jad files. I discovered this by trying to put the userID in a user defined key in the jad file is have the midlet retrieve the userID from the jad. It was not possible to do this with Sony Ericsson. Why they have decided to do this is beyond me! Also, can't understand why Motorola phones are so crap, don't they compare them to other phones?! Not just talking about their Java capabilites but eveything else is so slow. It would be nice if every phone manufacter would just copy Nokia!!
Punit Raizada
Ranch Hand

Joined: Mar 20, 2004
Posts: 156
hmmmm....

something just occurred to me .. Do the SE phones send the install-notify and more important delete-notify messages ???

did u ever try this out ???

Regards
Ian Strain
Ranch Hand

Joined: Jun 30, 2004
Posts: 49
Yeah they do send install notify. I think they read from the jad file and gets the file info for the download and then downloads the jar but not the jad.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
SE phones read from the MANIFEST file. I was able to modify the jars for SE before download. Since it reads from MANIFEST, no size problem since no such information there.
Ian Strain
Ranch Hand

Joined: Jun 30, 2004
Posts: 49
Good one. Bit late now cos I've got all that sorted. But I'll know in future. Still having problems with downloading images. Can't get a response from the server. Think it might be a provider thing cos it works on some phones.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Its about uniqueIDs again! Problems with downloading modified jar files