Saturday, October 29, 2011

SpringSocial and Tapestry. Let's be connected.

I've been working with connecting my applications to social services for last week. Didn't here anything about its APIs before. So, I started to look up for information about this and found this posts:
Good articles I want to say. And scibe-java library is a good choice for your application. It is very simple, has a lot of supported APIs and is very flexible(you can generated all needed requests by your own).
But there is an another choice - spring-social. It has not only request-response logic implementation but also full-featured facebook and twitter APIs. E.g. to update facebook status we just need do this:


The only thing we need is to get OAuth access token for needed social service. The way to do this is during application authorization process. All technical details you can find on oauth.net.

Friday, October 21, 2011

Secure application pages with tapestry5

Let's imagine that we have some application with auhentication and users separation by their authorities. There are also a set of allowed pages for every such authority.
E.g. we have such roles: anonymous, user and administrator. Anonymous is unauthorized user and can see only home page, user can see home and some other read-only pages, and administrator can see all pages. But how we can implement such logic to be sure that everybody can acces only allowed pages?
Let's create @Allow annotation that will define all necessary user authorities to access the page.


So our pages will look like this one:


Now the only thing we need is to throw security exception when user tries to acces page that are not allowed for him.

Friday, September 30, 2011

Thinking about jQuery-UI. Rendering buttons as is with Tapestry5.

Have you ever use a nice js library called jQuery-UI on your applications? Yes, it is realy easy to make some draft markup and then create all needed widgets using this library. For example:


This example will render button, submit and link and then will create ui-button widgets from it using js. As result we will see three pretty-styled buttons. But is everything clear in this example? Let's make some changes that will emulate slow page rendering.


As result we have three unstyled buttons that then flashes to jquery-ui styles(look). Is it so pretty now? And do you think such behavior is correct or you agree with opinion that all page elements should be rendered as is from the beginning? And if you have chosen the second variant let's continue.