How can I post a comment to a blog anonymously?
The following code works but authenticates the person posting the
comment where as on the real blogger.com i can post comments
anonymously, as well.
// assume context is an obect i have setup to have the
appropriate values
GoogleService myService =
new GoogleService("blogger", context.getGoogleAppId());
myService.setUserCredentials(context.getGoogleLogin(),
context.getGooglePassword());
URL commentsUrl = new URL(blog.getCommentsUrl());
Entry e = new Entry();
e.setContent(new PlainTextConstruct("Why, helloooooo
worl!"));
e.setTitle(new PlainTextConstruct("the title of a new
comment"));
Person p=new Person("Anon" ,null, null );
e.getAuthors().add(p) ;
Entry entry = myService.insert(commentsUrl, e);
It doesnt seem to matter what I put in the Person object, the comment's
poster is always going to be whover gets logged in through
myService.setUserCredentials( .. , ... )
Is there a way to acheive "Anonymous" posting on the blog?
If I remove the setUseCredentials call, thent he blog posting fails
altogether with,
-------------------------------------------------------------------------------
Test set: basic
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 6.219
sec <<< FAILURE!
testPostingAComment Time elapsed: 2.484 sec <<< FAILURE!
com.google.gdata.util.AuthenticationException: Unauthorized
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(Unknown
Source)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(Unknown
Source)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(Unknown
Source)
at com.google.gdata.client.http.HttpGDataRequest.execute(Unknown
Source)
at com.google.gdata.client.http.GoogleGDataRequest.execute(Unknown
Source)
at com.google.gdata.client.Service.insert(Unknown Source)
at com.google.gdata.client.GoogleService.insert(Unknown Source)
at ...
Thanks in advance for any help, and happy new year for those who
haven't crossed yet!
Joshua Long
Sun Certified Java Developer
J2EE Developer Specializing in Spring, Tapestry, Maven and Java
technologies
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google
Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---