23 January 2015

Play framework 1.2.x excel export with I18n and custom filename

play-excel is very well written plugin of Play-framework for exporting excel from java objects.

I used this plugin for my requirement of generating the I18n supported xls with custom names. This blog will explain this in details so that I can use it later :).

Line# 4: will basically make the play-excel to take the render functionality in play. (you can also use xlsx instead of "xls")

Line# 5: Will set the exported filename to given name i.e. "downloadUsers.xls"

Line# 6&7: pick up the template from views//users_.xls.

2.  public static void users() {
3.          List users = User.findAll();
4.          request.format = "xls";
5.          renderArgs.put("__FILE_NAME__", "downloadUsers.xls");
6.          String template = "users-" + Lang.get() + ".xls";
7.          renderTemplate(template, users);
8.    }
That's it you are done. Happy coding :).

19 June 2014

Gear 2 and Gear 2 Neo working with Nexus 5

Gear 2 and Gear 2 Neo are working perfectly with Nexus 5. Please go to the following url:


and download "Galaxy Gear Manager" app on your phone.

Launch gear manager app and select your gear device and you are good to go. For receiving additional notifications, goto Gear Manager and select Notification item and select from the list of apps you want to receive notification from.

30 July 2013

Simplest iterative algorithm Post order traversal

public class POIterateSimple {
public static void main(String[] args) {
private static void pfIterate(Node root) {
    Node prev = null;
    Stack stack = new Stack<>();
    while (!stack.isEmpty()) {
        root = stack.pop();
        if (root.left == null && root.right == null) {
            System.out.print(root.data + " ");
            prev = root;
        } else if (prev == root.left || prev == root.right) {
            System.out.print(root.data + " ");
            prev = root;
        } else {
            if (root.right != null)
            if (root.left != null)

24 July 2013

How to inject multiple endpoint in SEI using Camel's @EndpointInject

By default you can inject annotation on single method of an interface like:

public interface MyListener {


    String sayHello(String name);


what if you need multiple methods like this with @EndpointInjection happening over them for each endpoint e.g.:

public interface MyListener {


    String sayHelloFoo(String name);


    String sayHelloBar(String name);


The simple solution i have working involved spring's FactoryBean implementation.

It need following steps:

<!-- Define route for which you need injection to happen -->

<bean id="r" class="MyListener" />

<!-- Define producer template having that route  -->  

<camelContext  xmlns="http://camel.apache.org/schema/spring">

        <template id="producerTemplate" />

        <routeBuilder ref="r"/>


 <!-- define FactoryBean for proxy instance --> 

<bean id="definedCamel" class="CamelFactoryBean">

        <constructor-arg index="0" value="MyListener" />

        <constructor-arg index="1" ref="producerTemplate" />


The FactoryBean will create instance of custom InvocationHandler and return it which will invoke the endpoint on the ProducerTemplate instance.

27 February 2013

Use recipientList for dynamic routes

I was writing the route in which "to" endpoint was need to be configured dynamically with the URL coming in the body.

I was trying to use simple expression language (e.g. ${in.header.test} where test is the property set in the in-message header) also with header method (e.g. header(test)). The routes for the same were:



after literally every thing i could have. I figured out recipientlist can do the trick e.g.




Hope this works for you too.

20 February 2013

Spring: implements interface not working in @Controller

Guys,  I had a @Controller in which I was trying to implement an interface. But i was getting the following error message:

PageNotFound WARN  No mapping found for HTTP request with URI [/test/form] in DispatcherServlet with name 'Spring MVC Dispatcher Servlet'

where "/test" (at class level) and "/form" (at method level) where my @RequestMapping args.

 The issue is described at following link:


Now you may not find anything wrong with your spring.xml but should check all the xml used by used in the project in out case metrics was causing the problem. 

The aop config was overridden by metrics here:


 By default JDK proxy are created using interface and if controller implements an interface the RequestMapping annotation gets ignored as the targetClass is not being using.


 So, fix required i my case is:

proxy-target-class="true" ... />

Hope this helps.

20 September 2012

60 days at expedia India

I am about to complete 60 days in expedia and till now the ride has been fun.

I joined expedia hoping challenging work, participating in building a good team and workplace full of geniuses. To be frank everything is as close to reality as i thought.

The experience is amazing, people are awesome, the new office is great, parties are crazy, but the most important think is freedom to express yourself and asking questions. And people around you listen and have enough patience to make you feel comfortable ;) .

Work wise finishing user stories (part of on-boarding process), building a team by interviewing brightest mind in the industry and ideating about new ideas to make it a better workplace. And to emphasis working on one of the biggest ecommerce platform is not easy. Its a great earning opportunity and even bigger to contributing in one of the fastest growing industry.

I hope this answers whether you should join here or not.

Looking forward to see on board ;).