-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi Folks,
Currently I'm using the following method to retrieve the context path of my app:
public static String getApplicationContext(HttpServletRequest req){ String protocol = "http"; String server = req.getServerName(); String port = ""+req.getServerPort(); String context = req.getContextPath(); String webContext = protocol+"://"+server+":"+port+context; return webContext; }
Is there any method/way in zk that could give me the same information?
Thank you
I think this could help (Executions.getCurrent().getContextPath())
Well, you have another methods in that class like:
- getServerName()
- getServerPort()
So you can write something as you did:
public static String getApplicationContext(){ StringBuilder sb = new StringBuilder(1024); sb.append("http://"); sb.append(Executions.getCurrent().getServerName()).append(":"); sb.append(Executions.getCurrent()..getServerPort()); sb.append(Executions.getCurrent().getContextPath()); return sb.toString(); }
Asked: 2009-06-17 14:55:20 +0800
Seen: 407 times
Last updated: Jun 17 '09