• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with servlet streaming CSV files in WinXP SP2

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Alright, I have an interesting problem, which is only an issue with Windows XP SP2 and Internet Explorer.

We have a servlet which reads report files (both pdf and csv) from a directory outside of our EAR deployment. The servlet reads the files, and just writes it out to the browser.

This worked perfectly before, but since we upgraded to Windows XP SP2, along with an Internet Explorer update, the csv files come back messed up.

When the csv file opens, it opens inside Excel... inside the browser, which is what we want (and how it always worked).

However, now with the new upgrades, instead of being properly formatted (comma delimited fields are in separate cells), each line of data in the CSV file is jammed inside the first cell in Excel. The csv file itself is perfectly formatted, because if I open the csv in Excel or IE manually, it is displayed properly.

It is my understanding that with SP2, a 'fix' was added to remove a vulnerability with the MS Text engine, so 'strict' mime types are required.

We are currently doing:
response.setContentType( "text/csv" );
response.setHeader("Content-Disposition","filename=report.csv" );

I have also tried making the content type application/octet-stream with no luck.

This is a weird situation, and I can't find anything on Google about it.
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could try using
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

However, now with the new upgrades, instead of being properly formatted (comma delimited fields are in separate cells), each line of data in the CSV file is jammed inside the first cell in Excel. The csv file itself is perfectly formatted, because if I open the csv in Excel or IE manually, it is displayed properly.



IE opens the .csv file depending on a regional parameter. You can open "Regional Options", pick up the "Numbers" tab, and then configure "List Separator" to comma.

This works fine. However, it requires users do the same procedure on their computers, which seems impossible.

Another option is to create excel file instead of .csv file. You can use
POI from Apache.

Hope this helps.

Dan
 
Chris OBrien
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Annie Smith:
You could try using



Just tried this, it now brings up the Open/Save dialog instead of opening the file inline. Good news is, the file opens in Excel properly. Bad news is, we need it inline. This might have to do though, thanks.

Originally posted by danny liu:
IE opens the .csv file depending on a regional parameter. You can open "Regional Options", pick up the "Numbers" tab, and then configure "List Separator" to comma.

This works fine. However, it requires users do the same procedure on their computers, which seems impossible.

Another option is to create excel file instead of .csv file. You can use
POI from Apache.



I tried using the List separator in the regional options control panel, and it is already set to a comma, so that didn't do anything.

As far as creating an Excel file, that's definitely not going to work. This was a last minute find, and needed a quick fix. Something to look forward at in the future though, thanks.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change it to:
 
Chris OBrien
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:
Change it to:



Tried this as well, it does the same thing as before, opens the CSV file inline w/ Excel, but has all the data in the first cell of each row
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've got the same issue, and it seems that when the request goes through the weblogic apache plugin, the header gets stripped out of the attached file. Connecting to weblogic directly without using the plugin works fine. Have no clue how to solve it....which obviously doesn't help any.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I went through a similar incident a while back. Changing the delimiters got it to work in Excel but broke it for Open Office. I finally gave up and formatted with HTML tables. Both Open Office and Excel can read them and I haven't had a problem since.

The only downside is data bloat.
Also, the data I was working with never has HTML characters that need to be escaped.
 
I'm just a poor boy, I need no sympathy, because I'm easy come, easy go, little high, little low, little ad
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic