Hello, I am trying to create an application for the mobile phone from which you can download a Java ME application.
I have gotten so far that I can download the .jad file but the only thing that happens is that the content it is presented on the screen like this: MIDlet-1: WLListenerMIDlet,,WLListenerMIDlet MIDlet-Jar-Size: 44641 MIDlet-Jar-URL: MobileTrainer.jar MIDlet-Name: MobileTrainer MIDlet-Vendor: Vendor MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.1 MicroEdition-Profile: MIDP-2.1 I.e, the actual application (.jar) is not downloaded. The URL when this is presented is ending with "downloadMobileTrainer.action", i.e. not the actual file. When accessing the .jad file directly it works. I am in a need of help because I am stuck and are getting no further. I also wonder if this is the correct way of doing it, if it is possible at all using StreamResult for my purpose. I would really like to use Struts2 built in feature for this if possible. Here is my code: My download form in the jsp page: struts.xml: text/vnd.sun.j2me.app-descriptor ../../jsp/mobile/error.jsp Extended StreamResult class: public class DownloadInterceptor extends StreamResult{ protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { String downloadedFileName = "MobileTraining.jad"; contentDisposition = "filename=\"MobileTraining.jad"; contentLength = ""+ invocation.getStack().findValue(conditionalParse("size", invocation)); // contentType = "text/vnd.sun.j2me.app-descriptor"; super.doExecute(finalLocation, invocation); } } My action class: public class DownloadMTAction extends ActionSupport { private File mobileTrainer; private String contentType; private String filename; private InputStream inputStream; public InputStream getInputStream() { try{ inputStream = new FileInputStream(new File("C:\\\\Users\\Niklas\\Documents\\JavaMESDKProjects\\MobileTrainer\\dist\\MobileTrainer.jad")); }catch(Exception e){ System.out.println("Error in DownladMTAction " + e.getMessage()); e.printStackTrace(); }return inputStream; } public void setInputStream(InputStream inputStream){ this.inputStream = inputStream; } public void setMobileTrainer(File mobileTrainer) { this.mobileTrainer = mobileTrainer; } public void setMobileTrainerContentType(String contentType) { this.contentType = contentType; } public void setMobileTrainerFileName(String filename) { this.filename = filename; } public String execute() { this.inputStream = getInputStream(); if(inputStream !=null) { return Action.SUCCESS; } else { return Action.ERROR; } } } I have tried to set the content-type in both my struts.xml file and the extended StreamResult class above (now commented out there). Thank you in advance! Regards, Niklas _________________________________________________________________ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org