Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting file extension

 
Aron Daburn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am needing to send a simple text file, but with a .license extension.

My code is as follows:




It is saving the file with .txt. I tried removing the response.setContentType and it saved it with .html. How do you set the extension on a file to .license?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MSIE is great at ignoring things like this.
Did you try setting the content type to 'text/license'?

If that doesn't work set the content type to something that the browser has never heard of like 'xxx/xxxx' and it will throw up a prompt saying that MSIE doesn't know what to do with this, Save or Open With?...
 
Aron Daburn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I just tried setting its content type as the company name followed by '-license' and then that caused it to save it as a .license.

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic