problem with HttpServletRequest.setheader

  • Follow


Hi all:    I have a problem when using the following code to push a file touser:    HttpServletRequest response;    filename = "foo bar.idx"    response.setContentType("application/mubot.bitmap");    response.setHeader(      "Content-disposition",      "attachment;filename=" + filename);    The file name show in the download dialogue is "foo", which isexpected to be "foo bar.idx", I think it may be caused by the spacebetween "foo" and "bar", so how can I fix it?    Appreciate your help!
0
Reply zhouchengly (30) 3/27/2007 9:29:35 AM

On Mar 27, 7:29 pm, "shellon" <zhouchen...@gmail.com> wrote:...>     The file name show in the download dialogue is "foo", which is> expected to be "foo bar.idx", I think it may be caused by the space> between "foo" and "bar", so how can I fix it?Note the output;<sscce>import java.io.File;class SpaceInName {  public static void main(String[] args) throws Exception {    File file = new File("foo bar.idx");    System.out.println( file.toURI().toURL() );  }}</sscce>HTHAndrew T.
0
Reply Andrew 3/27/2007 10:08:02 AM


1 Replies
203 Views

(page loaded in 0.063 seconds)

Similiar Articles:




7/9/2012 8:54:03 AM


Reply: