You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by Woody Anderson <wo...@xoopit.com> on 2007/10/25 21:43:56 UTC

exception handling post response

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

Re: exception handling post response

Posted by Woody Anderson <wo...@xoopit.com>.
sweet.

btw, has anyone (in the public space) written something that'll take a
username and a blog url
and attempt to find the introspection url / or baring that the listed
service.post entries etc. for the prevailing blog systems?

this isn't exactly app, it's more like getting the initial information
set before using app.

i'm basically attempting to do this now, and if there is a framework
for it i'd love to use/contrib etc.
the main issue i'm having is that most systems (with pleasant
exception of wordpress) don't advertise consumable introspection
documents.
and the location of the introspection document is completely varied.

some systems embed this in the www.blog-url.com/ page, others typepad
put a url there, that you must access with x-wsse auth to get a
non-introspection document that kinda indicates where to go if you
look at it just right.

anyway,  once i've found the post url or the introspection url, abdera
seems to be working quite nicely for me.
but the bulk of my work actually comes in trying to attempt to give
abdera the correct starting place, as most systems do not have a
predictable location for any of the introspection or service.post type
urls.

am i reinventing things or is this just as messed up as it seems?
-w


On 10/25/07, James M Snell <ja...@gmail.com> 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 <ja...@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
> >>>
> >
>

Re: exception handling post response

Posted by Gautham Pai <bu...@gmail.com>.
My personal opinion is that parsers should be as accommodating as possible.
This is especially true, if we intend to use Abdera within a service used by
others and we do not have direct control on the feeds that will be parsed by
the service.

I will look into the QName aliases option. I assume this code is still in
trunk?

Thanks,
Gautham.


James M Snell wrote:
> 
> 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 <ja...@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
>>>>>>
>>>
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/exception-handling-post-response-tf4693186.html#a13866706
Sent from the abdera-user mailing list archive at Nabble.com.


Re: exception handling post response

Posted by James M Snell <ja...@gmail.com>.
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 <ja...@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
>>>>>
>>
> 

Re: exception handling post response

Posted by Gautham Pai <bu...@gmail.com>.
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 <ja...@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
>>>>
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/exception-handling-post-response-tf4693186.html#a13866147
Sent from the abdera-user mailing list archive at Nabble.com.


Re: exception handling post response

Posted by James M Snell <ja...@gmail.com>.
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 <ja...@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
>>>
> 

Re: exception handling post response

Posted by Woody Anderson <wo...@xoopit.com>.
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 <ja...@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
> >
>

Re: exception handling post response

Posted by James M Snell <ja...@gmail.com>.
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
>