Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Suportar unmarshalling

#7

r = Restfulie.at(...).accepts(type).get
cliente = r.resource

Ao chamar accepts(type), o header Accept vai com type.
Ao receber o resultado de QUALQUER tipo de requisicao, devemos disponibilizar o metodo resource.
Ao invocar o metodo resource, veja o header "Content-type" da RESPONSE e pegue o converter adequado, unmarshalleando:

def resource
converter = marshallers[headers["Content-type"]] converter.unmarshal(body) end

Reported by Guilherme Silveira · October 25th, 2010 @ 09:34 AM

State: resolved
Milestone: none
Assigned to: Alexandre Atoji Alexandre Atoji

Activity

  1. Guilherme Silveira
    Guilherme Silveira
    • Assigned user set to Alexandre Atoji

    Esse eh o caminho inverso do enviar dados, eh o de receber.
    Isto eh, ao falar o accepts, eu estou falando o media type que eu aceito entaou m header deve ser adicionado.

    Ai em qualquer requisicao, ao receber o resultado, ele deve ter um metodo chamado resource que deserializa ele (como o codigo acima)

    November 16th, 2010 @ 09:27 AM

  2. Alexandre Atoji
    Alexandre Atoji
    • State changed from new to resolved

    December 21st, 2010 @ 12:24 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.