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
77
votes
6 answers

How does OkHttp get Json string?

Solution: It was a mistake on my side. The right way is response.body().string() other than response.body.toString() Im using Jetty servlet, the URL ishttp://172.16.10.126:8789/test/path/jsonpage, every time request this URL it will return…
Haifeng Zhang
  • 30,077
  • 19
  • 81
  • 125
58
votes
5 answers

Serving static files with embedded Jetty

I'm trying to build a simple demo app with embedded Jetty that serves static files from a "html" directory that's a subdirectory of the current working directory. The idea is that the directory with the demo jar and content can be moved to a new…
HolySamosa
  • 9,011
  • 14
  • 69
  • 102
48
votes
3 answers

Jetty: To embed or not to embed?

What are the benefits of embedding jetty vs deploying your webapp(s) in jetty? If you are planning on deploying more than one web app, should you strictly stick with deploying a war file for each web app (as opposed to writing an embedded server…
Michael Balint
  • 2,255
  • 4
  • 25
  • 27
45
votes
2 answers

Eclipse RCP plugin + embedded Jetty + JSF

I made an RCP plugin with embedded Jetty as following: 1) In plugin.xml -> Dependencies, I have added the following: org.eclipse.equinox.http.jetty org.eclipse.equinox.http.registry org.mortbay.jetty.server javax.servlet 2) In plugin.xml ->…
wallE
  • 615
  • 11
  • 20
37
votes
2 answers

How do I create an embedded WebSocket server Jetty 9?

I hate asking such a vague question, but I'm having a hard time finding a simple example. Here's what I have so far: public class JettyWebSocketServlet extends WebSocketServlet{ @Override public void configure(WebSocketServletFactory…
Alex Pritchard
  • 4,260
  • 5
  • 33
  • 48
33
votes
13 answers

Spring 3.1 WebApplicationInitializer & Embedded Jetty 8 AnnotationConfiguration

I'm trying to create a simple webapp without any XML configuration using Spring 3.1 and an embedded Jetty 8 server. However, I'm struggling to get Jetty to recognise my implementaton of the Spring WebApplicationInitializer interface. Project…
Duncan
  • 763
  • 1
  • 6
  • 9
32
votes
2 answers

Configure embedded jetty with web.xml?

I am trying to generate both a war with my web application as well as a self contained jar file with embedded jetty. For the embedded jetty (the jar file distribution) I add a servlet as follows: public static void main(String[] args) throws…
Stephan
  • 2,853
  • 3
  • 20
  • 25
26
votes
4 answers

How to add servlet Filter with embedded jetty

I am embedding jetty into my app, and trying to work out how to add servlet filters (for cookie handling). The wiki and the javadoc's dont make it very clear, what am I missing: Server server = new Server(port); ServletContextHandler context = new…
Jay
  • 19,649
  • 38
  • 121
  • 184
25
votes
8 answers

How to disable directory listing for Jetty's WebAppContext?

I'm embedding Jetty (version 7.4.5.v20110725) into a java application. I'm serving JSP pages in ./webapps/jsp/ using Jetty's WebAppContext, but if I visit localhost:8080/jsp/ I get Jetty's directory listing for the entire contents of…
phatypus
  • 772
  • 3
  • 9
  • 19
25
votes
2 answers

Jetty: servlets vs handlers

I am trying to understand Jetty. Tell me please: When is it better to use Servlets and when Handlers? Can I use Connectors with Servlets for "thread-per-request model"?
Edward83
  • 6,664
  • 14
  • 74
  • 102
21
votes
6 answers

Configuring Jetty JSP support in embedded mode in Maven project

I can visit .html pages with Jetty, but when I visit a .jsp page I get: 0 13:21:13 / [INFO] No JSP support. Check that JSP jars are in lib/jsp and that the JSP option has been specified to start.jar I added the following as…
Ben McCann
  • 18,548
  • 25
  • 83
  • 101
21
votes
2 answers

Embedded vs Stand alone Tomcat ( HTTP ) server

I am working on a new project which would be a web application with a front end UI and a back end web service. I started looking into what servers to use like Tomcat / Jetty and so .. I also noticed that there is an embedded version of these HTTP…
broun
  • 2,483
  • 5
  • 40
  • 55
21
votes
4 answers

Embedded Jetty looking for files inside its Jar file

I successfully embedded Jetty on a test application. It can serve files without issues. Now I want to know if it's possible for Jetty to serve files that are inside its own Jar file. Does anyone know if that's possible?
LaSombra
  • 789
  • 1
  • 7
  • 12
21
votes
7 answers

Can't get Jetty to scan for annotated classes

I have an application with an embedded jetty server which I'm starting up like this (placed in main() and launched with eclipse): Server server = new Server(port); WebAppContext context = new…
Ryan Silva
  • 925
  • 2
  • 9
  • 17
19
votes
1 answer

How to run jetty server for java junit testing

I am trying to write an integration test to spin up jetty server locally and then use client to communicate with the rest URI and call the business logic downstream. However, when I start my jetty server it does not relinquish the control, so my…
1
2 3
91 92