users@jersey.java.net

Re: return different Mime type from the same method

From: Christian <christian.rivasseau_at_gmail.com>
Date: Thu, 6 Dec 2007 11:56:46 +0100

Hi Guilhem,

I don't know if changing the mime type programmatically is possible or not,
you will want to hear the response from other users.
But I guess it would be better practice to have different functions serving
the different response anyway.
Is there anything that prevents you from doing so ?


2007/12/6, guilhem legal <guilhem.legal_at_geomatys.fr>:
>
> hi!
> I am a beginner with jersey and i have a little issue :
>
> i would like to return different Mime type from the same method
> (image/png or text/xml).
> if i put this @ProduceMime("image/png") on my method this work when i
> return a File, but i can't return xml.
> if i put @ProduceMime("text/xml") i can't return image.
> and if i put @ProduceMime("*/*) and i return a file this works for both
> but the browser does not open the file and ask me to download it.
>
> can we change dynamically the ProduceMime Type?
> or can we adjust the return type with @ProduceMime("*/*) to display an
> image? (for xml i can return string but for image?)
>
> if you have a solution to my probleme please reply me.
>
> thanks
> Guilhem Legal
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>