How to social enable your web site using SocialSite - a quick primer
As we informed you earlier, we are working on better documentation. Very early drafts for some of the documents are available at our Project Wiki. What we have now are very early drafts and they are undergoing review and updates as we write this blog. Meanwhile, for immediate help, project member Bobby Bissett has put together this short screencast that can serve as a good primer on social-enabling your website using Project SocialSite.

hi, I think you types the wiki's link as"http://wikis.glassfish.org/socialsite/".
I can't open it. I think the right link should be "http://wiki.glassfish.org/socialsite/"
Posted by Alexandra Zhang on September 24, 2008 at 02:08 PM EDT #
The link works for me. The site was down a bit yesterday - can you please try again and let us know - Thanks
Posted by Vijay Ramachandran on September 24, 2008 at 07:17 PM EDT #
yeah, you are right. The time I tried it was down. So interesting.
Now it's working.
Posted by Alexandra Zhang on September 26, 2008 at 05:02 PM EDT #
Thank you very much for the screencast. Very informative.
We are trying to do something similar to what you had mentioned in the screencast.
We have a simple 1 page application written in Tapestry5, which will load socialsite information from socialsite server hosted on the same GlassFish server.
We have created a user called 'admin' and followed the instructions as mentioned in the screencast, but with just one difference.
we hard coded the viewerId in the socialsite_context.jsp and use no authentication mechanism.
Everytime when the page gets loaded, i see the Dashboard, but no data....all i see is 'Loading dashboard'. If I understand it right, since i have not not authenticated the user. You had explicitly mentioned that we need to authenticate the user.
But from actual socialsite's standpoint, all it needs is the socialsite_context information right? like your ruby application? I am under the impression that if i just specify the context information in a file and make that file available to the main java script snippet that talks to socialsite server, we should be able to retrieve all the social site information related to viewId specified in the context.
Since I am new to web development, please help me understand what I am doing wrong.
Here is the content of my socialsite_context.jsp
<%@ page language="java" %>
<%@ page contentType="application/json" %>
{
'timeout': 3600,
'attributes': {
'viewerId': 'admin'
}
}
And the tapestry page that display the dashboard has the following javascript code.
<script type="text/javascript" src="http://localhost:8080/socialsite/js/consumer.jsp"></script>
<script type="text/javascript">
socialsite.setContext({
'attributes': {
'ownerId':'admin'
},
'delegate': {
'method': 'GET',
'url': 'http://localhost:8080/preppa/socialsite_context.jsp',
'headers': {
'cookie': document.cookie
}
}
});
</script>
..........
This is inside the body
<script type="text/javascript">
socialsite.addGadget({'spec':'/local_gadgets/dashboard.xml', 'removable':false});
</script>
Also, if possible is there a way you can explain/publish the code that does custom authentication? maybe that will help me understand what I am missing or can you publish the filter that sets the userid variable within the context when ever the ror page requests any information?
Thank you in advance
Posted by prashanth galisukumar on September 30, 2008 at 11:13 PM EDT #
Hi Prashanth,
I think your case of hard-coding the user name should work, though obviously for only one user! I'm going to write more information about this today and will try that. It may be that there's some other problem going on, for instance that the 'admin' user has no profile associated with it in the SocialSite server.
As for the custom authentication code that I wrote, it's available in the Ruby on Rails sample under socialsite/examples/ror. Here's a link to where the example code is stored (though it's probably easier to download the workspace to view the files):
https://socialsite.dev.java.net/source/browse/socialsite/trunk/examples
For a Java EE example, you can see how the authentication works in the SocialSite war file by checking out the security information in sun-web.xml and web.xml (in socialsite/web/WEB-INF), but checking out the Java EE tutorial would probably be more helpful.
Cheers
Posted by Bobby Bissett on October 01, 2008 at 10:50 AM EDT #
I've added more information about integrating gadgets here:
http://blogs.sun.com/socialsite/entry/how_to_social_enable_your1
I hope it help!
Posted by Bobby Bissett on October 01, 2008 at 05:38 PM EDT #