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
11
votes
4 answers

How to override jetty.xml with jetty.port

I'm using maven-jetty-plugin and trying to override my jetty.xml setting with the -Djetty.port=8090 but it's not working. Only when I remove the connector part from the jetty.xml file I get the port to be 8090. So: mvn jetty:run…
Gonzalo
  • 1,126
  • 2
  • 12
  • 21
10
votes
4 answers

How to override a built-in exception mapper in Jersey 2.23?

In one of my projects I've already upgraded Jersey from version 2.14 to 2.23. But I'm struggling many hours with one problem. My project defines its own ExceptionMapper for a ValidationException, but unfortunately Jersey already has a built-in…
G. Demecki
  • 10,145
  • 3
  • 58
  • 58
10
votes
1 answer

Jersey fails when creating uber jar with maven-assembly-plugin

I have created a maven jersey starter webapp. Also I have embedded jetty server in my app using jetty plugin. My project is working fine when I run my project using mvn jetty:run command. But when I package my project using mvn clean package command…
10
votes
2 answers

What's the difference between a ServletHandler and a ServletContextHandler in Jetty?

I'm trying to get started with an embedded Jetty server. I just want to map requests to different servlets based on the request path. What's the difference between creating a ServletHandler and adding servlets to it as opposed to creating a…
elanh
  • 1,401
  • 3
  • 19
  • 31
10
votes
1 answer

Eliminating or understanding Jetty 9's "IllegalStateException: too much data after closed for HttpChannelOverHttp"

The setup I use the jaxws-maven-plugin v2.1 to generate a web service class. I also include the following Jetty dependencies: org.eclipse.jetty.jetty-server org.eclipse.jetty.jetty-sevlet org.eclipse.jetty.jetty-http-spi (The version in question…
Greg Kopff
  • 15,945
  • 12
  • 55
  • 78
10
votes
1 answer

AbstractAnnotationConfigDispatcherServletInitializer with Jetty

I'm using Jetty 9.1.0.RC2 and Spring 4. Have a AbstractAnnotationConfigDispatcherServletInitializer and trying to kick start the initialization with: Server server = new Server(); WebAppContext webAppContext = new…
Matthew Campbell
  • 1,864
  • 3
  • 24
  • 51
10
votes
1 answer

How to configure cache for static resources in web.xml for Jetty?

I was reading this: http://docs.codehaus.org/display/JETTY/LastModifiedCacheControl It says The Jetty default servlet allows the cache control header to be set for static content by using the cacheControl init parameter using:
Martin
  • 2,913
  • 4
  • 21
  • 15
10
votes
4 answers

Why is getUserMedia throwing a [object NavigatorUserMediaError] when I click "Allow" in Chrome?

Recently, I started getting errors when trying to access the client's mic through my website. When Chrome asks whether to allow the site to access the user's microphone, [object NavigatorUserMediaError] is produced whether they click "allow" or…
Big Duck
  • 101
  • 1
  • 1
  • 5
10
votes
1 answer

Embedded Jetty rewrites not working properly

I am trying to implement a simple rewrite rule in an embedded Jetty server, following the Jetty documentation examples. I want requests to /admin/ to rewrite to /admin.html. At the moment if I request /admin/ I get a 404 error with /admin.html not…
9
votes
2 answers

Is there a way to set context-params programmatically in embedded jetty?

Looking at the following example of an embedded Jetty Example: http://musingsofaprogrammingaddict.blogspot.com.au/2009/12/running-jsf-2-on-embedded-jetty.html The following code sample is given (below. The author then goes on an gives an example of…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
9
votes
4 answers

How to run jetty 7+ with specified war with groovy/gradle?

I want to run Jetty 7+ with gradle build, but unlucky looks like there is no way to do this with jettyRun. So probably simplest idea to achieve what I want would be to use custom target: task runJetty << { def server = new Server() // more code…
Piotr Kukielka
  • 3,792
  • 3
  • 32
  • 40
9
votes
3 answers

Jetty http session is always null (Embedded Container, ServletHolder)

I am trying to implement a simple servlet which uses a HTTP session in an embedded jetty (7.3.0 v20110203) container. To start jetty I use the following code: Server server = new Server(12043); ServletContextHandler handler = new …
David Tanzer
  • 2,732
  • 18
  • 30
9
votes
3 answers

Java Servlet Deployment - To Embed or Not - Tomcat/Jetty

I have several webapps deployed to production. I have used Tomcat as my servlet engine for ~10 years now. I'm considering moving to embedding Jetty model from the deploy-a-war-into-Tomcat model. These webapps are deployed over several servers and…
three-cups
  • 4,375
  • 3
  • 31
  • 41
9
votes
4 answers

Jetty 9 Server has no start() method

I am trying to embed a Jetty server in an application and am seeing a really strange problem: According to documentation, a simple server (which I am building as a test) can be started up using the following code: import…
Factor Three
  • 2,094
  • 5
  • 35
  • 51
9
votes
1 answer

How to embed Jetty into Spring and make it use the same AppContext it was embedded into?

I have a Spring ApplicationContext where I declare Jetty server bean and start it. Inside Jetty I have a DispatcherServlet and a couple of controllers. How to make that DispatcherServlet and its controllers use beans from the same ApplicationContext…
Fixpoint
  • 9,619
  • 17
  • 59
  • 78