Running Apache Click with embedded Jetty

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Running Apache Click with embedded Jetty

Kiril Valev
Hi,

is it possible to run an Apache Click app with an embedded server like
Jetty? I want to create a stand alone application.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running Apache Click with embedded Jetty

Ernesto Celis
On Tue, Sep 17, 2013 at 6:24 AM, Kiril Valev <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running Apache Click with embedded Jetty

Bob Schellink
Administrator
In reply to this post by Kiril Valev
Hi,

Click is just a Servlet, so there should be no problems.

regards

Bob


On Tue, Sep 17, 2013 at 1:24 PM, Kiril Valev <[hidden email]> 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.

Thanks.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running Apache Click with embedded Jetty

Kiril Valev
Nice. Thank you!

2013/9/17 Bob Schellink <[hidden email]>:

> Hi,
>
> Click is just a Servlet, so there should be no problems.
>
> regards
>
> Bob
>
>
> On Tue, Sep 17, 2013 at 1:24 PM, Kiril Valev <[hidden email]> 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.
>>
>> Thanks.
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running Apache Click with embedded Jetty

gilbertoca
In reply to this post by Kiril Valev

I did it with Winstone[1]. See here[2].

Gilberto

[1] http://winstone.sourceforge.net/
[2] http://click.1134972.n2.nabble.com/Click-and-Winstone-Servlet-Container-td1135339.html

2013/9/17 Kiril Valev <[hidden email]>
Hi,

is it possible to run an Apache Click app with an embedded server like
Jetty? I want to create a stand alone application.

Thanks.

Loading...