Hello Chummar,
I am not using Yahoo Id but I already found a different way to connect
with delicious, using Base64 encoding instead Authenticator:
HttpURLConnection conn;
URL url = new URL(urlString);
conn = (HttpURLConnection) url.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setDefaultUseCaches(false);
conn.setAllowUserInteraction(true);
String userPassword = username + ":" + passwd;
String encoding = Base64.encode(userPassword.getBytes()); //
Instead Authenticator
conn.setRequestProperty ("Authorization", "Basic " +
encoding);
thanks so much!
Best,
LJ
On Mar 8, 4:07 pm, Chummar Maly <[email protected]> wrote:
> If you are using a Yahoo Id for authentication, then you'll have to use the
> v2 url and use Oauth. You can find more on this here :
>
> http://delicious.com/help/api
>
> <http://delicious.com/help/api>Hope this helps.
>
> Chummar
>
>
>
> On Mon, Mar 8, 2010 at 9:48 AM, ljgarcia <[email protected]> wrote:
> > Hello there,
>
> > Thanks for the answer. Here goes the code:
>
> > HttpURLConnection conn;
> > URL url = new URL("https://api.del.icio.us/v1/posts/all?");
> > conn = (HttpURLConnection) url.openConnection();
> > conn.setDoInput(true);
> > conn.setDoOutput(true);
> > conn.setUseCaches(false);
> > conn.setDefaultUseCaches(false);
> > conn.setAllowUserInteraction(true);
> > Authenticator.setDefault(new
> > DeliciousAuthenticator(username, passwd)); //This line shows the error
> > conn.setRequestMethod("GET");
> > System.out.println("response = " +
> > conn.getResponseMessage());
>
> > thanks so much.
>
> > Best,
>
> > LJ
>
> > On Mar 3, 6:53 pm, Chummar Maly <[email protected]> wrote:
> > > can you pls. post the code.
>
> > > On Wed, Mar 3, 2010 at 9:06 AM, ljgarcia <[email protected]> wrote:
> > > > Hello everybody,
>
> > > > I want to access Delicious via Resftul APIhttp://
> > delicious.com/help/api
> > > > so I am using a Restful Connection (RestConnection.java) and I get
> > > > this error:
>
> > > > java.security.AccessControlException: access denied
> > > > (java.net.NetPermission setDefaultAuthenticator)
> > > > at
>
> > java.security.AccessControlContext.checkPermission(AccessControlContext.java:
> > > > 264)
> > > > at
> > > > java.security.AccessController.checkPermission(AccessController.java:
> > > > 427)
> > > > at
> > java.lang.SecurityManager.checkPermission(SecurityManager.java:
> > > > 532)
> > > > at com.google.appengine.tools.development.DevAppServerFactory
> > > > $CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
> > > > at java.net.Authenticator.setDefault(Authenticator.java:110)
> > > > at java.net.Authenticator.setDefault(Authenticator.java:110)
> > > > at
> > > > org.netbeans.saas.RestConnection.setAuthenticator(RestConnection.java:
> > > > 69)
> > > > at
>
> > delicious.controller.AjaxController.divRetrieveTags(AjaxController.java:
> > > > 36)
> > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > > at
>
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> > > > 39)
> > > > at
>
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> > > > 25)
> > > > at java.lang.reflect.Method.invoke(Method.java:592)
> > > > at
>
> > com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:
> > > > 100)
> > > > at
>
> > org.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:
> > > > 34)
> > > > at org.directwebremoting.impl.DefaultRemoter
> > > > $1.doFilter(DefaultRemoter.java:427)
> > > > at
> > > > org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:
> > > > 430)
> > > > at
> > > > org.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:
> > > > 282)
> > > > at
>
> > org.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:
> > > > 52)
> > > > at
> > > > org.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:
> > > > 101)
> > > > at
> > org.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:
> > > > 146)
> > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
> > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> > > > at
> > > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > > > 487)
> > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > $CachedChain.doFilter(ServletHandler.java:1093)
> > > > at
>
> > com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
> > > > 51)
> > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > $CachedChain.doFilter(ServletHandler.java:1084)
> > > > at
>
> > com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> > > > 43)
> > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > $CachedChain.doFilter(ServletHandler.java:1084)
> > > > at
>
> > com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
> > > > 121)
> > > > at org.mortbay.jetty.servlet.ServletHandler
> > > > $CachedChain.doFilter(ServletHandler.java:1084)
> > > > at
> > > > org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> > > > 360)
> > > > at
> > > > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> > > > 216)
> > > > at
> > > > org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> > > > 181)
> > > > at
> > > > org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> > > > 712)
> > > > at
> > org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> > > > 405)
> > > > at
>
> > com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> > > > 70)
> > > > at
> > > > org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> > > > 139)
> > > > at com.google.appengine.tools.development.JettyContainerService
> > > > $ApiProxyHandler.handle(JettyContainerService.java:352)
> > > > 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.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> > > > 396)
> > > > at org.mortbay.thread.BoundedThreadPool
> > > > $PoolThread.run(BoundedThreadPool.java:442)
>
> > > > I already tried what says in
> > > >http://code.google.com/intl/zh-HK/appengine/kb/java.html#googledata
> > > > but it did not work.
>
> > > > I also tried to connect out Google App Engine and the connection works
> > > > fine.
>
> > > > Any ideas?
>
> > > > Thanks so much in advanced.
>
> > > > Best,
>
> > > > LJ
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Google App Engine for Java" group.
> > > > To post to this group, send email to
> > > > [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<google-appengine-java%[email protected]>
> > <google-appengine-java%[email protected]<google-appengine-java%[email protected]>
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> > > --
> > > Chummar Malyhttp://www.tricolormusic.com
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine-java%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Chummar Malyhttp://www.tricolormusic.com
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" 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-appengine-java?hl=en.