You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Juergen Donnerstag (JIRA)" <ji...@apache.org> on 2009/01/25 00:13:59 UTC

[jira] Commented: (WICKET-1999) Modifying the response content type does not take effect

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

Juergen Donnerstag commented on WICKET-1999:
--------------------------------------------

During WebPage.configureResponse() the content type will be determined and set. By default the content type is derived from getMarkupType(). You can not set the content type in the ctor of the page.


> 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.