Thursday Apr 15, 2010

JavaFX + OAuth


As usual will start off with Wikipedia - OAuth (Open Authorization) - is an open standard that allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site without having to hand out their username and password. With more and more services moving to OAuth model, I think we need to try to have a generic implementation. Here is an attempt...

I prefer not to duplicate all those details available in various resources, so suggest to read few articles if you are not familiar with concepts of OAuth. Yahoo has a very detailed article outlining the flow of OAuth authorization or Beginner's Guide to OAuth from Hueniverse. Please refer to same for more info..

You can try out yourself with demo below. You need to get consumer-key and consumer-secret from respective service providers - Twitter, LinkedIn or Yahoo

<script src="http://dl.javafx.com/1.2/dtfx.js"></script><script src="http://javafxdemos.googlecode.com/hg/resource/JavaFXOAuth/JavaFXOAuth.js"></script>


To launch click on above image or

First enter oauth_consumer_key and oauth_secret_key, click "Request Token" button. If key is proper, you will receive a message in log with a URL. Copy and paste that URL in browser and follow the instructions. Once you grant access to your application, it will return a number. Copy the number and paste it as oauth_verifier. Now click on "Access Token" button. It will return you oauth_token and oauth_token_secret which can be used for all subsequent communication.

Yes its a bit difficult to understand the overall flow and implementation. I have tried my best to simplify it. The API may be simplified a bit more. I have signed up for contributing to JFXtras long time back, but haven't done anything yet. My objective was to pull in the various parsers that are used in different samples and create a library. I think all these can be incorporated into that...

Usage:

def oauthAPI = OAuthAPI.getInstance(
    <Service-Provider>, 
    <oauth_consumer_key>,
    <oauth_consumer_secret>
);

// Request Token Callback
oauthAPI.onRequestToken = function(response:String: Void {

}

// Access Token Callback
oauthAPI.onAccessToken = function(response:String: Void {

}

// Request Token
oauthAPI.requestToken();

// Access Token
oauthAPI.accessToken(<oauth_verifier>);
 

Refer to LinkedInAPI.fx to get an idea on how we can extend the implementation to have fulll fledged support.

Please try it out and let me know your suggestions and feedback..


<script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="http://javafxdemos.googlecode.com/hg/resource/JavaFXOAuth/zoneit.js"></script>

Thursday Feb 25, 2010

JavaFX + Yahoo Weather


JavaFX Composer preview is available. You can install this plugin. In NetBeans IDE, goto "Tools" -> "Plugins" -> "Available Plugins". Select "JavaFX Composer" and install the Plugin. Please refer to NetBeans JavaFX Composer and JavaFX Composer Blogs for more information.

Summer has set in like a flick of a switch! So couldn't think of anything else other than Weather. Developed a simple Weather application using Yahoo Weather RSS Feed. It was much easier to visualize and develop using JavaFX Composer, especially for small widget like applications. Soon we will be able to develop complex application using this...

<script src="http://dl.javafx.com/1.2/dtfx.js"></script> <script src="http://javafxdemos.googlecode.com/hg/resource/Weather/Weather.js"></script>


To launch click on above image or

The city is set to Bangalore by default. Double click on the widget to enable the TextBox, in which you can enter your ZipCode or City and press "Enter" key. Ideally I must persist this information using Storage APIs, but I leave that task to you!

For getting the information from Yahoo, we need to first identify the Where On Earth ID - WOEID of the city using its ZipCode or Name. Please refer to Yahoo WOEID documentation for more information. Once we identify the WOEID, we can use forecastrss feed for getting the weather information.

Please try it out and let me know feedback..


<script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="http://javafxdemos.googlecode.com/hg/resource/Weather/zoneit.js"></script>

Wednesday Jun 10, 2009

JavaFX + Yahoo Placemaker + Maps


I have my travel itinerary or a document with list of cities, such as Seven Wonders of the World. I would like to retrieve the list of cities and the location information associated with it. How to do this??

Yahoo! released new Yahoo! Placemaker APIs. These APIs search for name of places in plain text document and returns the latitude and longitude associated with the place. You can either provide a text or a URL as input to the API. The output can be obtained in XML or RSS format.

Combine above information with Yahoo! Maps will return the maps associated with all places mentioned in specified document! Itn't that cool?! :)

May be I must write more applications and publish at Java-Store!

<script src="http://dl.javafx.com/1.2/dtfx.js"></script><script src="/rakeshmenonp/resource/PlaceList/PlaceList.js"></script>

For Applet mode, click on above image

For standalone mode

In above application we provide a URL which the Placemaker API will parse and returns the list of places. This information is given to Map Image API to retrieve the image. Any valid http URL can be provided as input. There is currently a 50 kbs limit for documents processed by Placemaker. Documents above this length are rejected and returns status 413. Please enter a new URL in textfield and press enter to load new places.

Source:

<script type="text/javascript">var dzone_url = "http://blogs.sun.com/rakeshmenonp/entry/javafx_yahoo_placemaker_yahoo_maps";</script> <script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script>
<script type="text/javascript"> digg_skin = 'compact'; digg_window = 'new'; </script> <script language="javascript" src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
<script src="http://slashdot.org/slashdot-it.js" type="text/javascript"></script>

Friday Feb 13, 2009

JavaFX - Yahoo! Shopping



Shopping Service is a JavaFX application that search and displays products using Yahoo! Shopping Web Services API. It can search for product offerings using text string queries.

Visit JavaFX Samples website for source code.
http://javafx.com/samples/ShoppingService/
<script src="http://dl.javafx.com/1.1/dtfx.js"></script><script src="/rakeshmenonp/resource/YahooShopping/YahooShopping.js"></script>


For Applet mode, click on above image

For standalone mode

For more JavaFX samples refer to http://www.javafx.com/samples/

About


The views expressed on this blog are my own and do not necessarily reflect that of my organization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today