abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Abley" <james.ab...@gmail.com>
Subject Re: A minimal Atom server
Date Mon, 06 Oct 2008 07:32:30 GMT
2008/10/3 Goetzmann Bertrand <Bertrand.Goetzmann@lasersymag.com>:
> OK.
> With Poster, I send the following request:
> - URL: http://localhost:9002/employee
> - ContentType: application/xml
> - POST
> - Content:
>
> <entry xmlns="http://www.w3.org/2005/Atom">
>   <title type="text">titre</title>
>   <author><name>Bertrand</name></author>
>   <updated>2008-05-02T21:22:06.122Z</updated>
>   <content type="application/xml">
>      <test/>
>   </content>
> </entry>
>
> Poster responds with a 500 status, and the following content:
>
> <?xml version="1.0"?><error><code>500</code><message>Server
Error</message></error>
>
>
> Here the stack trace on the server side:
>
> 3 oct. 2008 16:05:48 org.apache.abdera.protocol.server.impl.AbstractProvider process
> GRAVE: java.lang.UnsupportedOperationException
> 3 oct. 2008 16:05:48 org.apache.abdera.protocol.server.ProviderHelper servererror
> INFO: Server error
> java.lang.UnsupportedOperationException
>        at org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter.postMedia(AbstractEntityCollectionAdapter.java:202)
>        at org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter.createMediaEntry(AbstractEntityCollectionAdapter.java:638)
>        at org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter.postMedia(AbstractEntityCollectionAdapter.java:82)
>        at org.apache.abdera.protocol.server.processors.CollectionRequestProcessor.processCollection(CollectionRequestProcessor.java:47)
>        at org.apache.abdera.protocol.server.processors.CollectionRequestProcessor.process(CollectionRequestProcessor.java:38)
>        at org.apache.abdera.protocol.server.impl.AbstractProvider.process(AbstractProvider.java:136)
>        at org.apache.abdera.protocol.server.FilterChain.next(FilterChain.java:42)
>        at org.apache.abdera.protocol.server.servlet.AbderaServlet.service(AbderaServlet.java:90)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
>        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
>        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
>        at org.mortbay.jetty.Server.handle(Server.java:313)
>        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
>        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
>        at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:227)
>        at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
>
>
> Hope this helps!
>
> Bertrand.

Hi Betrand,

If you're trying to create a new Atom Entry, I think your Content-Type
header is wrong. From the stack trace, Abdera is trying to create a
Media Entry and by default that operation isn't supported. From the
code for
AbstractEntityCollectionAdapter.java:

/**
   * Post a new media resource to the collection.  By default, this method is
   * not supported. Implementations must override this method to support posting
   * media resources
   * @param mimeType The mime-type of the resource
   * @param slug The value of the Slug header
   * @param inputStream An InputStream providing access to the request payload
   * @param request The request context
   */
  public T postMedia(
    MimeType mimeType,
    String slug,
    InputStream inputStream,
    RequestContext request)
      throws ResponseContextException {
    throw new UnsupportedOperationException();
  }

Cheers,

James

Mime
View raw message