On Tue, Sep 17, 2013 at 6:24 AM, Kiril Valev <[email protected]> wrote:
> Hi,
>
> is it possible to run an Apache Click app with an embedded server like
> Jetty? I want to create a stand alone application.
>
Yes, you only need to bundle the jetty .jars and a class which will serve
as entry point to your app, all in one .jar file. Below you'll find a
snippet of code I use to do it. I didn't wrote the original, found it
somewhere in the interwebs, so I make no claims whatsoever on this code.
You should export your webapp to a .war file and bundle this .war file
along with everything else.
>
> Thanks.
>
8X---- StartServer Begins ----X8
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
public class StartServer {
public static void main(String[] args) throws Exception {
String jetty_home = FileSystem.getUserHome() + "/badges/";
Server server = new Server(8080);
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/badges");
webapp.setWar(jetty_home + "badges.war");
server.setHandler(webapp);
server.start();
server.join();
}
}
--
Saludos
Ernesto Celis (Usuario Linux #323140)
Google Voice: +1 678-632-2645
C*NET: 1-333-1106