I have one variable with return url from payment gateway.
private static String response_url = "http://1.1.1.1:8001/abc/xyz.html";
// private static String response_url = "http://www.something.com/xyz.html";
First variable is for local server and the second one is of production environment, I comment and un-comment and uncomment the variable according to the environment.
<action name="viewResponseFile" class="controller.RAction" method="viewResponseFile">
<result name="success">somepage.jsp</result>
</action>
controller is mapped on that xyz.html
and it is return URL from payment gateway
. Now I want to make it generic.
What I am planning to do is set that variable on existing Listener class.
<listener>
<listener-class>in.com.Initializer</listener-class>
</listener>
I tried to create HttpServletRequest
using ServletRequestAware
to get RequestURI
but had no success.
public class Initializer implements ServletContextListener
{
ServletContext context;
public Initializer()
{
}
public void contextInitialized(ServletContextEvent contextEvent)
{
// set-up code
}
public void contextDestroyed(ServletContextEvent contextEvent)
{
}
}
So how can achieve these requirements?