Skip to main content

Posts

Showing posts from August, 2008

Stepping out.

I am stepping off from professional chores for some more time. I am not following Olympics either. I have to visit India to take care of my father, who is undergoing a diagnosis for a tumor. Thanks for all those who have given me thier support. I shall start writing again soon.

Abhinav Bhindra - The First Individial Olympics Gold medalist for India

I am off until olympics, I will catch up later.. And I am blogging this Historical moment.. Thanks to Abhinav Bindra who did India proud

Using Spring XML Schema based bean definitions

Spring's bean definitions (and configuration files) may go very verbose after your projects goes two or three iterations old. By verbose I mean, too many bean definitions, and complex injection graph. And many a times, these xml files go fat because of common definition types - props, lists, etc. These beans are generally configured using FactoryBean s. To reduce this verbatim Spring provides XML schema based configuration, for various types of FactoryBeans. There are some shortcuts presented in that appendix, I frequently use. I recomend those to others too. Here are some of those. <!-- creates a java.util.Properties instance with values loaded from the supplied location --> <bean id="jdbcConfiguration" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location" value="classpath:com/foo/jdbc-production.properties"/> </bean> Could be written as <!-- creates a java.uti...

Moving on to Ivy.

Maven has its share of success, at the same time it has some shortcomings. Many felt the Idea was right, the implementation was not. There were a few rants too. Project Ivy was started on that note . Today, Everyone is talking about Ivy and How Ivy can fix your woes from maven . So, I began to test drive Ivy. Ivy has got pretty good documentation. And the edge over maven is, that you dont have to adapt your project to it (like maven). You can make ivy adapt to your project. All you need to start is a jar to put in your ant lib folder. The examples list a mighty hard way of starting with ivy - So I modified a little bit to get it easy and install ivy automatically. Also this can be used as a template build.xml file for starting from scratch :) <!-- Use namespace even before bootstrap --> <project xmlns:ivy="antlib:org.apache.ivy.ant" default="build" name="SarathPOC"> <property file="build.properties" /> <path id=...

Acegi onSuccessfulAuthentication

Some time back, I raised a jira in Acegi, which was turned down. There was no adequate response from spring team. Here I am writing about it, so other spring users (read gurus) may pitch in. //Edited to short and precise protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, Authentication authResult) throws IOException { SecurityContextHolder.getContext().setAuthentication(authResult); String targetUrl = (String) request.getSession() .getAttribute(ACEGI_SECURITY_TARGET_URL_KEY); request.getSession().removeAttribute(ACEGI_SECURITY_TARGET_URL_KEY); if (alwaysUseDefaultTargetUrl == true) { targetUrl = null; } if (targetUrl == null) { targetUrl = request.getContextPath() + defaultTargetUrl; } // user call back hook onSuccessfulAuthentication (request, response, authResult); //... response.sendRedirect(response.encodeRedirectURL(targetUrl)); } The Acegi fr...

Are we really Going Green

When I bought my Hybrid, I donated my old car. At that time, I thought, If I am buying a Hybrid, I am reducing my carbon foot print. But, Someone else is getting that old car and driving it for another 3 years. So am I really reducing the foot print? We want to use paper bags instead of plastic ones, but the earlier weighs a lot more than the latter - so transporting them burns more carbon. Same applies to using paper towels or Blow Driers. Who is calculating the trade offs? how do we know we are really going Green? Be sure of that next time.. For now, on a lighter note - Catch a bit of Colbert's Report.