abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: exception handling post response
Date Tue, 20 Nov 2007 21:42:48 GMT
A couple of weeks ago I checked in some code to trunk that allows
QName-aliases to be registered, allowing the obsolete feed and entry
elements, for instance,  to be registered as aliases of the standard
feed and entry elements.  That should be enough to get you most of the
way there, but you'll need to register aliases for each of the QName's
you're interested in and there's no guarantee that the API will map
exactly correct do to the format differences.

Of course, the absolute best answer would be to put pressure on those
feed producers to generate proper Atom feeds.

- James

Gautham Pai wrote:
> A lot of sites still use the purl.org namespace:
> <feed version="0.3" xmlns="http://purl.org/atom/ns#"
> xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
> 
> Is there an example showing how this can be accommodated?
> 
> Thanks,
> Gautham
> 
> 
> James M Snell wrote:
>> You could create an ExtensionFactory that could handle this
>> transparently.  I'll see if I can work up an example a bit later today.
>>
>> - James
>>
>> Woody Anderson wrote:
>>> hmm.. ok thanks.
>>>
>>> is there anyway overcome that? can i provide a map this broken ns to
>>> the correct one?
>>> with the parser? or by doing a "trivial" subclass of the parser that
>>> would be used to deal with the response.
>>>
>>> i doubt they fix this "soon", so just wondering what i can do to get
>>> the url response.
>>>
>>> Also, is there a standard for the "public url" of what you just posted
>>> via APP?
>>>
>>> i sorta asked this earlier, and you indicated ContentSrc(), which sounded
>>> good.
>>> Unfortunately, this response doesn't that info there.
>>>
>>> also the Location header uses the protected edit link etc.
>>>
>>> so the url i'm looking for in this response is:
>>>   <link xmlns="http://purl.org/atom/ns#" rel="alternate"
>>> href="http://example.typepad.com/eg/2007/10/example-title.html"
>>> title="HTML" type="text/html"/>
>>>
>>> so, in general is there a standard for this info?
>>> typepad seems rather busted (as per wrong ns to begin with), but i
>>> don't have the experience to know if there is some standard location
>>> (where it's *supposed* to be) that i'm unaware of, or if this kind of
>>> information is particular to each and every server impl, and each is
>>> considered compliant (aside from the ns issue).
>>>
>>> thanks
>>> -w
>>>
>>>
>>> On 10/25/07, James M Snell <jasnell@gmail.com> wrote:
>>>> The response from typepad is invalid.  The namespace is wrong; it is
>>>> supposed to be http://www.w3.org/2005/Atom
>>>>
>>>>> <entry xmlns="http://purl.org/atom/ns#"
>>>> - James
>>>>
>>>> Woody Anderson wrote:
>>>>> Hello, so i'm currently posting directly to a typepad.com url (can't
>>>>> seem to get introspection working with typepad, which is a separate
>>>>> issue)
>>>>>
>>>>> so i create a post:
>>>>>
>>>>>        response = client.post(.....);
>>>>>        org.apache.abdera.model.Document<Entry> doc =
>>>>> response.getDocument();
>>>>>        Entry entry = doc.getRoot();
>>>>>
>>>>> so i get this exception:
>>>>> java.lang.ClassCastException:
>>>>> org.apache.abdera.parser.stax.FOMExtensibleElement
>>>>> at the "entry = getRoot()" line
>>>>>
>>>>> which is pretty odd i think.
>>>>>
>>>>> i get back a 201 "created" response: Headers follow:
>>>>> HTTP/1.1 201 Created
>>>>> Date: Thu, 25 Oct 2007 19:28:18 GMT
>>>>> Server: Apache
>>>>> Location:
>>>>> http://www.typepad.com/t/atom/weblog/blog_id=123456789/entry_id=40686808
>>>>> Expires: Mon, 26 Jul 1997 05:00:00 GMT
>>>>> Last-Modified: Thu, 25 Oct 2007 19:28:20 GMT
>>>>> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>>>>> pre-check=0
>>>>> Content-Type: application/atom+xml
>>>>> Via: 1.1 www.typepad.com (Apache/2.2.3)
>>>>> Vary: Accept-Encoding,User-Agent
>>>>> Content-Encoding: gzip
>>>>> Content-Length: 501
>>>>> Connection: close
>>>>>
>>>>>
>>>>> here's the wireshark'd response payload:
>>>>>
>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>> <entry xmlns="http://purl.org/atom/ns#"
>>>>> xmlns:default="http://www.w3.org/1999/xhtml"
>>>>> xmlns:post="http://sixapart.com/atom/post#">
>>>>>   <title xmlns="http://purl.org/atom/ns#">Example Title</title>
>>>>>   <summary xmlns="http://purl.org/atom/ns#"></summary>
>>>>>   <content xmlns="http://purl.org/atom/ns#"
>>>>> xmlns:default="http://www.w3.org/1999/xhtml" mode="xml">
>>>>>     <div xmlns="http://www.w3.org/1999/xhtml"><p>Example
>>>>> Text</p>null</div>
>>>>>   </content>
>>>>>   <issued
>>>>> xmlns="http://purl.org/atom/ns#">2007-10-25T12:20:05-07:00</issued>
>>>>>   <link xmlns="http://purl.org/atom/ns#" rel="alternate"
>>>>> href="http://example.typepad.com/eg/2007/10/example-title.html"
>>>>> title="HTML" type="text/html"/>
>>>>>   <id
>>>>> xmlns="http://purl.org/atom/ns#">tag:typepad.com,2003:post-40686452</id>
>>>>>   <post:convertLineBreaks
>>>>> xmlns:post="http://sixapart.com/atom/post#">true</post:convertLineBreaks>
>>>>>   <author xmlns="http://purl.org/atom/ns#">
>>>>>     <name xmlns="http://purl.org/atom/ns#">joey joe joe</name>
>>>>>   </author>
>>>>>   <link xmlns="http://purl.org/atom/ns#" rel="service.edit"
>>>>> href="http://www.typepad.com/t/atom/weblog/blog_id=123456789/entry_id=40686452"
>>>>> title="Example Title" type="application/atom+xml"/>
>>>>> </entry>
>>>>>
>>>>>
>>>>> which seems quite parseable and looks to be an Entry to me.
>>>>> any thoughts?
>>>>>
>>>>> oh, and i'm using release .6
>>>>> -w
>>>>>
>>
> 

Mime
View raw message