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

[jira] Resolved: (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:all-tabpanel ]

Igor Vaynberg resolved WICKET-1999.
-----------------------------------

    Resolution: Invalid
      Assignee: Igor Vaynberg

this code doesnt make any sense inside a constructor of a page. it should be inside an irequesttarget.respond(requestcycle) there are plenty examples of this on the mailing list and wiki.

> 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
>            Assignee: Igor Vaynberg
>
> 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.