Questions tagged [embedded-jetty]

Jetty is a widely used web container (server) written in Java and produced by Eclipse.

Jetty is a widely used web container written in Java. Jetty has a slogan, "Don't deploy your application in Jetty, deploy Jetty in your application."

What this means is that as an alternative to bundling your application as a standard WAR to be deployed in Jetty, Jetty is designed to be a software component that can be instantiated and used in a Java program just like any POJO. Put another way, running Jetty in embedded mode means putting an HTTP module into your application, rather than putting your application into an HTTP server.

You can find extra information for Jetty at Codehaus.

1375 questions
8
votes
1 answer

Where do I put my jetty.xml file with Jetty embedded?

I am just getting started with Jetty (Jetty 6 w/ Java 6). Using the example files with Jetty 6, I place my xml configuration file. in the same directory as my java file. But when I run the project I get this error. Exception in thread "main"…
Norm
  • 659
  • 3
  • 10
  • 20
8
votes
3 answers

How do I configure embedded Jetty to handle OPTIONS preflight requests?

I am working on a project which is using embedded Jetty (unfortunately I just "inherited" the server side of the project and am not very familiar with the use of Jetty and its configuration). An odd case just popped up - I'll do my best to…
Jer
  • 5,468
  • 8
  • 34
  • 41
8
votes
3 answers

Publish JAX-WS endpoint with embedded Jetty 7

Can anybody help with this? I want to use an embedded Jetty 7 as Endpoint. This is what I tried: public class MiniTestJetty { @WebService(targetNamespace = "http") public static class Calculator { @Resource WebServiceContext context; …
axelrose
  • 556
  • 5
  • 17
8
votes
1 answer

Where does GWT's Hosted Mode Jetty Run From?

I'm trying to call a web service in my back end java code when it's running in hosted mode. Everything loads fine, the GWT RPC call works and I can see it on the server, then as soon as it tries to call an external web service (using jax-ws) the…
rustyshelf
  • 44,963
  • 37
  • 98
  • 104
8
votes
2 answers

Starting up embedded jetty server for a JAR file

What I am trying to do, is to build an executable JAR file which will contain my project. I have included its dependencies right next to it, also in JAR files, so my directory listing looks something like…
Milad Naseri
  • 4,053
  • 1
  • 27
  • 39
7
votes
1 answer

How do I set up static resources and custom services with embedded Jetty?

I'm trying to set up a simple webservice for my application by embedding Jetty. I'd like to have two different web services available, a simple HTTP server that just serves up static content (which will eventually be a GWT app) and a custom servlet…
Collin
  • 11,977
  • 2
  • 46
  • 60
7
votes
2 answers

Exclude Gradle classpath runtime when launching JettyRun

I have your basic run of the mill Gradle web application project and it works ok but I noticed that Gradle's runtime classpath is being included in the jetty one which has the potential to conflict with the web applications. Notice below that gradle…
Kirk Rasmussen
  • 231
  • 4
  • 9
7
votes
1 answer

How to configure Denial of Service filters in ODL controller

I am new to ODL controller and the embedded jetty. I would like to add the DoSFilter in jetty.xml to throttle the REST requests if there is a request flooding. I tried searching the internet, but has lot of examples for configuring it in web.xml…
Loganathan Mohanraj
  • 1,736
  • 1
  • 13
  • 22
7
votes
3 answers

Programmatic Jetty shutdown

How to programmatically shutdown embedded jetty server? I start jetty server like this: Server server = new Server(8090); ... server.start(); server.join(); Now, I want to shut it down from a request, such as http://127.0.0.1:8090/shutdown How do…
Anton Kazennikov
  • 3,574
  • 5
  • 30
  • 38
7
votes
2 answers

Add resources to Jetty programmatically

I have a main class that configures and fires up Jetty. (That's standard practice from Wicket for testing a webapp, but it's really not wicket-specific.) final Server server = new Server(); //skipped socketconnector initialization final…
Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
7
votes
1 answer

How can a native Servlet Filter be used when using Spark web framework?

I'm playing around with Spark (the Java web framework, not Apache Spark). I find it really nice and easy to define routes and filters, however I'm looking to apply a native servlet filter to my routes and can't seem to find a way to do that. More…
elanh
  • 1,401
  • 3
  • 19
  • 31
7
votes
4 answers

How to gracefully shutdown embeded jetty

I have an application runs on an embedded jetty server. Now i want to start/stop the server as a service. I use a script to start the server. java $JAVA_OPTS -DREQ_JAVA_VERSION=$JAVA_VERSION -jar myjetty.jar Main Class Server server = new…
jos
  • 1,082
  • 5
  • 19
  • 45
7
votes
5 answers

Java embedded jetty is accepting HTTP TRACE method

I'm trying to disable HTTP TRACE method in embedded Jetty. In Jetty doc's is info that HTTP trace is disabled by default, but for embedded it is still enabled. I was trying to disable trace as a security constraint as is done in jetty.xml. …
Michal N.
  • 73
  • 1
  • 1
  • 3
7
votes
1 answer

Jersey: How to Add Jackson to Servlet Holder

I am creating an embedded Jetty webapp with Jersey. I do not know how to add Jackson for automatic JSON serde here: ServletHolder jerseyServlet = context.addServlet( org.glassfish.jersey.servlet.ServletContainer.class, "/*"); …
David Williams
  • 8,388
  • 23
  • 83
  • 171
7
votes
3 answers

Setup Jetty GzipHandler programmatically

I'm playing with Jetty GzipHandler and it seems to work rather strangely: It only compresses already compressed files. My whole setup is GzipHandler gzipHandler = new…
maaartinus
  • 44,714
  • 32
  • 161
  • 320