Please createca Jira issue.

Martijn

On 12/31/08, Arie Fishler <[email protected]> wrote:
> Hi,
>
> I am 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"). Any idea?
>
>
> 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*);
>


-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to