0

I'm having trouble writing an unmarshaller for an atom+xml feed. The feed is just XML, so I was hoping to be able to rely on the NodeSeqUnmarshaller, but that unmarshaller has content range (text/xml, application/xml, text/html, application/xhtml+xml) - i.e. application/atom+xml is not included in the list.

On the basis of @jrudolph's comment below, I attempted to solve the problem using Unmarshaller.delegate, like this:

implicit val atomUnmarshaller = 
    Unmarshaller.delegate[NodeSeq, NodeSeq]('application/atom+xml')(identity)

val pipeline: HttpRequest => Future[NodeSeq] = (
    sendReceive 
    ~> unmarshal[NodeSeq]
)

val response: Future[NodeSeq] = pipeline(request)

I'm seeing this exception message at runtime:

spray.httpx.PipelineException: UnsupportedContentType(Expected 'text/xml' or 
    'application/xml' or 'text/html' or 'application/xhtml+xml')

So, I'm stuck, and I'd be very grateful for any help that you might be able to render. Many thanks.

David
  • 5,184
  • 3
  • 41
  • 67

0 Answers0