Thanks @Baadshah but I am using Spring on the server side. By the way I got the solution and I am posting if someone is facing similar problem.
First we need to add following entry in web.xml
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
RequestContextListener is a listener that exposes the request to the current thread.
and then we can use @Autowired annotation.
@Autowired
private HttpServletRequest httpServletRequest;
and in processing method we can session from this httpServletRequest using getSession method.