Wicketでは、以下のメソッドを使用してプロジェクトの ”
ルートコンテキスト
“を取得できます。
WebApplication.get().getServletContext().getServletContextName()
例えば、
public static String getRootContext(){
String rootContext = "";
WebApplication webApplication = WebApplication.get();
if(webApplication!=null){
ServletContext servletContext = webApplication.getServletContext();
if(servletContext!=null){
rootContext = servletContext.getServletContextName();
}else{
//do nothing
}
}else{
//do nothing
}
return rootContext;
}