more details on what is happening (AbstractResourceTemplate extends the
ServerResource class):
public class ResourceTUM extends AbstractResourceTemplate {
@Override
protected void doInit(){
super.doInit();
getVariants().add(new Variant(MediaType.TEXT_ALL));
getVariants().add(new Variant(MediaType.TEXT_HTML));
}
@Get
public Representation getRepresentation(Variant var) {
List<Variant> variants = getVariants();
Iterator<Variant> it = variants.iterator();
while(it.hasNext()){
Variant v = it.next();
System.out.println("MT: " + v.getMediaType().getName());
}
...
}
This prints out nothing, meaning no Variants are available and throws a
405 (which should be a 415 maybe).
If I use @Get("html"), the text/html Variant is available. What am I
doing wrong on the getVariants() part in the doInit() method?
best regards,
Tobias
On Wed, 2010-10-13 at 11:59 +0200, Tobias Girschick wrote:
> I'm a little bit lost on variants, so one further question to the
> migration:
> Is it still possible to handle multiple variants in the ServerResource
> in one method? Like in restlet 1.x? E.g.:
>
> @Get
> public Representation getRepresentation(Variant var) {
> if(var.MediaType......
> }
>
> If yes, how would I set the accapted variants and how would such a
> method look like?
>
> Or do I have to have one method for one MediaType with annotations like
> @Get("html") or @Get("rdf")?
>
> Best regards,
> Tobias
>
> On Mon, 2010-08-16 at 14:50 +0200, Tobias Girschick wrote:
> > consider this last msg "unsent". I got it running with the RC4 zip.
> >
> > Best regards,
> > Tobias
> >
> > On Mon, 2010-08-16 at 14:48 +0200, Tobias Girschick wrote:
> > > sorry for not replying for so long...which release would I have to use
> > > to get the fix? Is it in one of the zip downloads or is it only
> > > available via svn or smth. similar?
> > >
> > > Best regards,
> > > Tobias Girschick
> > >
> > > On Fri, 2010-04-09 at 04:14 -0700, Thierry Boileau wrote:
> > > > Hello Tobias,
> > > >
> > > > I think that this bug has been fixed. Could you try it?
> > > >
> > > > Best regards,
> > > > Thierry Boileau
> > > >
> > > > ------------------------------------------------------
> > > > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2531414
> > >
> >
>
--
Dipl.-Bioinf. Tobias Girschick
Technische Universität München
Institut für Informatik
Lehrstuhl I12 - Bioinformatik
Bolzmannstr. 3
85748 Garching b. München, Germany
Room: MI 01.09.042
Phone: +49 (89) 289-18002
Email: [email protected]
Web: http://wwwkramer.in.tum.de/girschick
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2671223