|
View:
New views
11 Messages
—
Rating Filter:
Alert me
|
|
|
A minimal Atom serverHello,
I just discover Abdera and I'm very impressed! Thank you to all committers to this project. So I downloaded the 0.4 version and tried to launch a minimal atom pub server, using source code found in the employee folder: it contains AppServer.java, Employee.java, and EmployeeCollectionAdapter.java. AppServer has the main method and starts a Jetty web server that listens on the 9002 port. Using NetBenas 6.1 and these three sources I can start the server. With a browser I can navigate to the URL http://localhost:9002/employee that returns an empty list but a correct response (a Atom document). But when I navigate to the URL http://localhost:9002/ in order to get the service document I get an empty document (0 byte)! I try also to add a new employee using a post command with the following code in Groovy language: def abdera = new Abdera() def factory = abdera.factory def client = new AbderaClient(abdera) def entry = factory.newEntry() entry.addAuthor('Bertrand') entry.setContent('<p>...</p>') entry.setSummary('...') entry.setTitle('...') entry.setUpdated(new Date()) def response = client.post("http://localhost:9002/employee", entry) println "POST : $response.type" println response.inputStream.text But the response type is CLIENT_ERROR and the response text is empty; on the server side I don't have any trace. When debugging the EmployeeCollectionAdapter.postEntry is not called. With the client, if I call the put method, EmployeeCollectionAdapter.putEntry is well called. So, why I can't get the service document, and what is wrong with my client code? Thank you for your help. Bertrand http://www.odelia-technologies.com |
|
|
Re: A minimal Atom serverHi Bertrand,
I think you should use the trunk version from the repository. I'd say we've solved a bunch of bugs and perhaps you won't these problems. Regards On Fri, Oct 3, 2008 at 9:43 AM, Goetzmann Bertrand < Bertrand.Goetzmann@...> wrote: > Hello, > > I just discover Abdera and I'm very impressed! Thank you to all > committers to this project. > > So I downloaded the 0.4 version and tried to launch a minimal atom pub > server, using source code found in the employee folder: it contains > AppServer.java, Employee.java, and EmployeeCollectionAdapter.java. > > AppServer has the main method and starts a Jetty web server that listens > on the 9002 port. > > Using NetBenas 6.1 and these three sources I can start the server. > > With a browser I can navigate to the URL http://localhost:9002/employee > that returns an empty list but a correct response (a Atom document). > > But when I navigate to the URL http://localhost:9002/ in order to get > the service document I get an empty document (0 byte)! > I try also to add a new employee using a post command with the following > code in Groovy language: > > def abdera = new Abdera() > def factory = abdera.factory > def client = new AbderaClient(abdera) > > > def entry = factory.newEntry() > entry.addAuthor('Bertrand') > entry.setContent('<p>...</p>') > entry.setSummary('...') > entry.setTitle('...') > entry.setUpdated(new Date()) > > def response = client.post("http://localhost:9002/employee", entry) > println "POST : $response.type" > println response.inputStream.text > > > But the response type is CLIENT_ERROR and the response text is empty; on > the server side I don't have any trace. When debugging the > EmployeeCollectionAdapter.postEntry is not called. > With the client, if I call the put method, > EmployeeCollectionAdapter.putEntry is well called. > > > So, why I can't get the service document, and what is wrong with my > client code? > > Thank you for your help. > > > Bertrand > http://www.odelia-technologies.com > -- David Calavera http://www.thinkincode.net |
|
|
|
|
|
Re: A minimal Atom serverCan you send the stack trace?
On Fri, Oct 3, 2008 at 3:21 PM, Goetzmann Bertrand < Bertrand.Goetzmann@...> wrote: > Thank you David, > > I used the trunk version, and build Abdera with Maven. > > Now I get the correct service document! > > But with my Groovy client I get the same error when trying to post an entry > (status 400, Bad Request). > I also tried the same thing with Poster, the FireFox's plugin, and get an > exception on the server side and the response indicates an internal error. > > What can I try now? > I don't succeed to have a finer grained log4j traces. > > > Bertrand. > > > -----Message d'origine----- > De : David Calavera [mailto:david.calavera@...] > Envoyé : vendredi 3 octobre 2008 12:34 > À : abdera-user@... > Objet : Re: A minimal Atom server > > Hi Bertrand, > > I think you should use the trunk version from the repository. I'd say we've > solved a bunch of bugs and perhaps you won't these problems. > > Regards > > On Fri, Oct 3, 2008 at 9:43 AM, Goetzmann Bertrand < > Bertrand.Goetzmann@...> wrote: > > > Hello, > > > > I just discover Abdera and I'm very impressed! Thank you to all > > committers to this project. > > > > So I downloaded the 0.4 version and tried to launch a minimal atom pub > > server, using source code found in the employee folder: it contains > > AppServer.java, Employee.java, and EmployeeCollectionAdapter.java. > > > > AppServer has the main method and starts a Jetty web server that listens > > on the 9002 port. > > > > Using NetBenas 6.1 and these three sources I can start the server. > > > > With a browser I can navigate to the URL http://localhost:9002/employee > > that returns an empty list but a correct response (a Atom document). > > > > But when I navigate to the URL http://localhost:9002/ in order to get > > the service document I get an empty document (0 byte)! > > I try also to add a new employee using a post command with the following > > code in Groovy language: > > > > def abdera = new Abdera() > > def factory = abdera.factory > > def client = new AbderaClient(abdera) > > > > > > def entry = factory.newEntry() > > entry.addAuthor('Bertrand') > > entry.setContent('<p>...</p>') > > entry.setSummary('...') > > entry.setTitle('...') > > entry.setUpdated(new Date()) > > > > def response = client.post("http://localhost:9002/employee", entry) > > println "POST : $response.type" > > println response.inputStream.text > > > > > > But the response type is CLIENT_ERROR and the response text is empty; on > > the server side I don't have any trace. When debugging the > > EmployeeCollectionAdapter.postEntry is not called. > > With the client, if I call the put method, > > EmployeeCollectionAdapter.putEntry is well called. > > > > > > So, why I can't get the service document, and what is wrong with my > > client code? > > > > Thank you for your help. > > > > > > Bertrand > > http://www.odelia-technologies.com > > > > > > -- > David Calavera > http://www.thinkincode.net > -- David Calavera http://www.thinkincode.net |
|
|
|
|
|
RE: A minimal Atom serverHi David,
Seeing how many bugs are fixed on trunk, is their an ETA on a 0.5.0 release? Thanks and Regards, Jeff -----Original Message----- From: David Calavera [mailto:david.calavera@...] Sent: Friday, October 03, 2008 3:34 AM To: abdera-user@... Subject: Re: A minimal Atom server Hi Bertrand, I think you should use the trunk version from the repository. I'd say we've solved a bunch of bugs and perhaps you won't these problems. Regards On Fri, Oct 3, 2008 at 9:43 AM, Goetzmann Bertrand < Bertrand.Goetzmann@...> wrote: > Hello, > > I just discover Abdera and I'm very impressed! Thank you to all > committers to this project. > > So I downloaded the 0.4 version and tried to launch a minimal atom pub > server, using source code found in the employee folder: it contains > AppServer.java, Employee.java, and EmployeeCollectionAdapter.java. > > AppServer has the main method and starts a Jetty web server that > listens on the 9002 port. > > Using NetBenas 6.1 and these three sources I can start the server. > > With a browser I can navigate to the URL > http://localhost:9002/employee that returns an empty list but a > > But when I navigate to the URL http://localhost:9002/ in order to get > the service document I get an empty document (0 byte)! > I try also to add a new employee using a post command with the > following code in Groovy language: > > def abdera = new Abdera() > def factory = abdera.factory > def client = new AbderaClient(abdera) > > > def entry = factory.newEntry() > entry.addAuthor('Bertrand') > entry.setContent('<p>...</p>') > entry.setSummary('...') > entry.setTitle('...') > entry.setUpdated(new Date()) > > def response = client.post("http://localhost:9002/employee", entry) > println "POST : $response.type" > println response.inputStream.text > > > But the response type is CLIENT_ERROR and the response text is empty; > on the server side I don't have any trace. When debugging the > EmployeeCollectionAdapter.postEntry is not called. > With the client, if I call the put method, > EmployeeCollectionAdapter.putEntry is well called. > > > So, why I can't get the service document, and what is wrong with my > client code? > > Thank you for your help. > > > Bertrand > http://www.odelia-technologies.com > -- David Calavera http://www.thinkincode.net |
|
|
Re: A minimal Atom server2008/10/3 Goetzmann Bertrand <Bertrand.Goetzmann@...>:
> 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 |
|
|
|
|
|
Re: A minimal Atom server2008/10/6 Goetzmann Bertrand <Bertrand.Goetzmann@...>:
> Hello James, > > Thank you for your response! > When I get the document service, I can see that the collection "Acme Employee Database" accepts "application/atom+xml". > With Poster, I also try "application/atom" and "text/xml" as content type: I get the same error! > > > Cheers, > > Bertrand. > Hi Bertrand, I'm not very familiar with the client API, so apologies if this is a silly question. Do you get the same issue when you POST application/atom+xml? Regards, James |
|
|
|
|
|
Re: A minimal Atom serverHello, Bertrand
I am new to Abdera and face the problem you get. could u post the trunk version u used? cuz i used the svn trunk version and still didn't work for me. Thanks, Mahmoud Ismaiel
|
| Free embeddable forum powered by Nabble | Forum Help |