I have the following code:
server server = new server (9 090); Final URL warUrl = main.clash.get classloader (). GetResource ("com / domain / webapps / app"); The final string warUrlString = warUrl.toExternalForm (); WebAppContext wac = New WebAppContext (warUrlString, "/ app"); Server.setHandler (WAC); I have the main class com.domain package. jsp and html have com.domain.webapps.app package. The application works perfectly when Netbeans (or java-cp & lt; classpath> com.domain.main ) exploded. If I run jar ( java -jar app.jar ), then the contents of com.domain.webapps. App is drawn to / tmp / jetty_something / webapp / , so the absolute path is / tmp / jetty_something / webapp / com / domain / webapps / app / But when I request for http: // localhost: 9090 / app / file.jsp , jtake / tmp / jetty_something / Webapp / file .jsp (Incorrect location :-() Where can I do that?
Jetty version is 6.1.26
Take a look at the article.The URL has been detected
securitydomain securitydomain = Start.cla ss .getProtectionDomain (); URL Than = Protection Domain.GetcodeSource (). GetLocation (); This works for me in a war project and maybe your jar In case of use.
Comments
Post a Comment