aspose file tools*
The moose likes Servlets and the fly likes Content-Disposition is replaces the parent window in IPAD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Content-Disposition is replaces the parent window in IPAD" Watch "Content-Disposition is replaces the parent window in IPAD" New topic
Author

Content-Disposition is replaces the parent window in IPAD

nishanth shanmugam
Greenhorn

Joined: Dec 16, 2011
Posts: 5
Hi I was trying to download a .csv file from my web application using Content-Disposition
here is my code

response.setContentType("application/octet-stream");
}

filename = filename.concat(downloadType);
response.setHeader("Content-Disposition","attachment; filename="+filename+";");
//response.setHeader("Content-Disposition","application/octet-stream; filename="+filename+";");


String source = (String)ivHttpRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")) {
source = Utils.decodeHtmlEntities(source);
}
byte [] byteArray;

if(source == null)
{
// use ivRequest instead
String source2 = (String)ivRequest.getAttribute("downloadFile");
if(downloadType.equals(".txt")){
source2 = Utils.decodeHtmlEntities(source2);
}
byteArray = source2.getBytes();
}
else
{
byteArray = source.getBytes();
}
ServletOutputStream out = response.getOutputStream();
out.write(byteArray);
out.close();
I'm able to download the file in all the browsers, But while using IPAD the content of the file replaces the existing window (Parent Window) without asking for Save or Open
Please let me know is there any special content type or anythinmg else i have to chanage..
THe problem i faced only with IPAD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

As the iPad (not IPAD) has no user-accessible file system, what else would you expect it to do?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
nishanth shanmugam
Greenhorn

Joined: Dec 16, 2011
Posts: 5
Bear Bibeault wrote:As the iPad (not IPAD) has no user-accessible file system, what else would you expect it to do?


Thanks For Correcting Me.. In iPad i'm just trying to download a .csv file for a button action. But the csv file just replaaces the parent window. How can i force it to display a save or open promt before downloading it... (Or please tell me whether we can do it or not) or atleast i need it to opened in a new browser window
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

Again, where would it download it to?
nishanth shanmugam
Greenhorn

Joined: Dec 16, 2011
Posts: 5
Bear Bibeault wrote:Again, where would it download it to?

If downloading is not possinble means, just opening it in a new window is enough for me.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Does the iPad even support more than 1 (browser) window at a time?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
nishanth shanmugam
Greenhorn

Joined: Dec 16, 2011
Posts: 5
Rob Spoor wrote:Does the iPad even support more than 1 (browser) window at a time?

New Tab is possible right?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

I don't know, I don't own an iPhone, iPod or iPad (or any other device that starts with i). All I know is that some mobile devices (in which category I place iPads) have some limitations as far as multiple windows are concerned.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

You cannot "download" to an iPad and do anything else but display the file because there is no user-visible file system to write to.
nishanth shanmugam
Greenhorn

Joined: Dec 16, 2011
Posts: 5
Bear Bibeault wrote:You cannot "download" to an iPad and do anything else but display the file because there is no user-visible file system to write to.

ok.. but need to display it in a new tab (iPad can support new tabs right)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61199
    
  66

That has nothing to do with the iPad, but with the mobile browser being used. You can try sending the request to a new window or tab via target="_blank" on a link, but the browser will do what it will with that.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Content-Disposition is replaces the parent window in IPAD