|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
WAP download problem
I am developing a ring tones download website. After a
user click a link to download a midi file, the WAP browser will stay in the current card. Is there any workaround where the user can go to the next card to display a download complete message? I am using jsp to generate wml code. |
|
#2
|
||||
|
||||
|
I don't know anything about jsp but I know form our own download wap site that having the same card on screen is a bonus as you can echo out links you want the customer to click.
The other way of doing it would be to refresh to the content after x seconds then have the downloading of the content update a database, then have another refresh after xx seconds to a script which checks that the updated table value has been modded, if not it redirects back else it shows thanks for your download., Apologies if this is garbled but I'm just in a bit of a rush to get some stuff sorted today. Good luck with it, all the best Andy
__________________
Andy Moore << oh no it's got a blog..... Word Press WAP Plugin with Ad Mob Advertising revenue PHP developer deploying ringtones, mp3 downloads and realtones I'm a geek who's obsessed with stats and gadgets |
|
#3
|
|||
|
|||
|
Quote:
Perhaps I explain more. I wanted to make sure the file is downloaded complete before I jump to a new card say download complete instead of returning to the orginal card with all the download links. Example: <wml> <card id="download"> <a href="song.midi">Song 1</a><br/> </card> <card id="complete"> Download complete </card> </wml> How can I jump to complete card after I am sure the user downloaded song.midi instead of returning to download card? |
|
#4
|
||||
|
||||
|
WML can't know whether a file has been downloaded or not. You will need to do a little research into Java to se if you can write a JSP that can redirect after download is complete.
|
|
#5
|
|||
|
|||
|
Quote:
I am in the same problem, As for me, you can not do what you want to do... The only way that you can do any operation after the download is using a Direct Download (without link) like this : protected void doGet(HttpServletRequest req, HttpServletResponse resp) { String fileToFind = req.getParameter("file"); System.out.println("Parameter:"+fileToFind); if(fileToFind == null) { System.out.println("Error - No parameter"); return; } else System.out.println("parameter OK"); File fname = new File(fileToFind); if(!fname.exists()) { System.out.println("el archivo no existe"); return; } else System.out.println("el archivo existe"); FileInputStream istr = null; OutputStream ostr = null; String contentType=getContentType(fname.getName()); String name = fname.getName().substring(fname.getName().lastIndexOf("/") + 1,fname.getName().length()); int fileLength=(int)fname.length(); resp.setContentType(contentType); resp.setContentLength(fileLength); System.out.println("El tipo del archivo es :"+contentType); System.out.println("El tamaņo del archivo es :"+fileLength+" Bytes"); System.out.println("El archivo sera guardado como:"+name); resp.setHeader("Content-Transfer-Encoding", "binary"); resp.setHeader("Content-Disposition", "attachment; filename=\"" + name + "\";"); try { istr = new FileInputStream(fname); ostr = resp.getOutputStream(); int curByte=-1; while( (curByte=istr.read()) !=-1) ostr.write(curByte); ostr.flush(); } catch(Exception ex){ ex.printStackTrace(System.out); } finally{ try { if(istr!=null) istr.close(); if(ostr!=null) ostr.close(); } catch(Exception ex){ System.out.println("Major Error Releasing Streams: "+ex.toString()); } } try { resp.flushBuffer(); } catch(Exception ex){ System.out.println("Error flushing the Response: "+ex.toString()); } System.out.println("Transfert Complete !!!"); } |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > WAP Programming > WAP download problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|