[ 
https://issues.apache.org/jira/browse/WICKET-1999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660065#action_12660065
 ] 

Arie Fishler commented on WICKET-1999:
--------------------------------------

Might be that I am missing something...but before getting into some more code I 
would just comment that this code is in a ctor extending WebPage.

Assuming it is supposed to work is it possible that wicket overrides my 
contentType setting just after I set the response? 

I would say that I assume that page returns to client after my code but there 
is nothing specific I instruct it to do in order to terminate the regular page 
flow and return.

> Modifying the response content type does not take effect
> --------------------------------------------------------
>
>                 Key: WICKET-1999
>                 URL: https://issues.apache.org/jira/browse/WICKET-1999
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: Win XP, Tomcat 6
>            Reporter: Arie Fishler
>
> Trying to stream an image to the response and setting the proper mime type to 
> it prior to writing the stream to the output.
>  
> The file exists and is written but the mime type of the response is not set 
> according to what I expect it to be ("image/png"). Mime type stays text/html
>  
> WebResponse response = (WebResponse)getRequestCycle().getResponse();
> if (imagePath != null) { 
> try { 
> File imageFile = 
> new File(imagePath); 
> FileInputStream inputStream = 
> new FileInputStream(imageFile); 
> response.setContentType(
> DEFAULT_MIME_TYPE); 
> Streams.copy(inputStream, response.getOutputStream());
> return; 
> } 
> catch (FileNotFoundException e) { 
> }
> catch (IOException e) { 
> }
> }
> // 404 
> response.getHttpServletResponse().setStatus(
> NOT_FOUND);

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to