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 12:11:06 +0100

Yes you can (and should) have different GET methods in the same class.
I think what you're looking for is having two get methods on the same path
with different produced mime types ? should work fine.

2007/12/6, guilhem legal <guilhem.legal_at_geomatys.fr>:
>
> I'm working on the implementation of an OGC so i my query must be :
> http://localhost:8080/WMServerJ/wms?param1=value&param2...... (in GET
> only)
>
> I really begin with jersey , can we do 2 @HttpMethod("GET") in a same
> class and how we can specify that a want to enter in some function and
> not in another?
>
> Guilhem Legal
>
> Christian a écrit :
> > 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
> >>
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>