embedded-jetty

How to initialize a web app?

My Web App will be deployed as a WAR package in a Jetty instance. It needs to perform a lot of caching before serving requests. How do I call the caching method before anything else? is the a static void main() in the web app standard? ...

Jetty embedded: How to run the same config as with `mvn jetty:run-exploded`?

Hi, I'd like to have the same Jetty server configuration, created programatically. When I run mvn jetty:run-exploded, my app works fine. When I run it from my code, the static content is not loaded. I know that I have to add a static content Servlet, so I tried: Server server = new Server(8080); Context ctx = new Context( server, "/", ...

Jetty RewriteHandler and RewriteRegexRule

I'm trying to rewrite a URL for a servlet. The URL gets rewritten correctly, but the context doesn't match after that. Any idea how to get this to work? RewriteHandler rewriteHandler = new RewriteHandler(); rewriteHandler.setRewriteRequestURI(true); rewriteHandler.setRewritePathInfo(true); rewriteHandler.setOriginalPathAttribute("reques...

Embedded Jetty resourceBase classpath URL

I'm embedding Jetty in a Spring based application. I configure my Jetty server in a Spring context file. The specific part of the configuration I'm having trouble with is this: <bean class="org.eclipse.jetty.webapp.WebAppContext"> <property name="contextPath" value="/" /> <property name="resourceBase" value="????????" /> <prope...

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" java.lang.NullPointerException at net.test.FileServerXml.main(FileServerXml.java:13 Here is t...

migrating an embedded jetty server from v6 to v7

Hi chaps, I have an embedded servlet which I use in unit tests, looks like this: public class UnitTestWebservices extends AbstractHandler { private Server server; private Map<Route,String> data = new HashMap<Route,String>(); public UnitTestWebservices(int port) throws Exception { server = new Server(port); ...

How to deploy a Scala project from Eclipse?

I have a Scala project in Eclipse that I need to package up so I can deploy it to a server. It's based on Jetty but it runs as a standalone application. It contains Scala classes, Java classes and a number of 3rd party jars. I assumed there would be some kind of deployment option in the Scala Eclipse plugin but I've drawn a blank. What...

Best way to embed i-jetty server into android application?

Hi: I want to integrate i-jetty into an Android application and not the other way around. Has anyone included i-jetty before and got it to run under Android 2.1 or 2.2? ...

is possible to combine: jersey + jetty + spring

Hi, I'm trying to create a webserver embedding jetty (rather than J2E) , and map my servlets RESTfully, using jersey. I'm using spring for dependency injection, and mapping the servlets as beans However, when I try to make an HTTP req to the mapped servlets, i get error 500- server error, or 404, page not found. I'm not sure if i'm doin...

How to enable HTTP digest for embedded jetty / spring security?

I have two small http servers. One using the sun (com.sun.net.httpserver) server and one using an embedded jetty. Now I'm trying to get HTTP digest working on at least the jetty server (well, that was one of the reasons to use jetty instead of sun httpserver). Regardless of which server I utilize the basic setup is done via spring IOC co...

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 where Jetty is declared? In fact, in that outer context I have a couple of daemon-like b...

No factories configured while using Jetty 7 embedded + Myfaces 1.2

I am using an embedded version of jetty 7 to load a web application using Apache MyFaces 1.2 in a junit 4 test class on the advice from another thread. While running the test i get this error. java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - m...

I-Jetty or Jetty

I have a web application to be hosted on android device. I am currently using the emulator available with android sdk. My application will serve both static as well as dynamic data. I am currently using jetty version 6.1.22. I wanted to ask what will be a better option to be used. 1. Jetty webserver with stripped off code. 2. I-Jetty. M...

Is it possible to create Desktop Application using Java backend & Web Technologies UI

Hi, I would like to create a desktop application in Java & web technologies. The main reason for selecting Java is that it is free, open source, and hence our investment would be minimal and we would save lots of investment with respect to licensing costs, etc. Also, the main reason for selecting web technologies is because our current p...

Servlet 3.0 support in embedded Jetty 8.0

For my unit-tests I use a simple test-server based on Jetty: package eu.kostia.textanalysis.webservices.jetty; import java.awt.Desktop; import java.net.URI; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.webapp.WebAppContext; public class TestServer { static private final String CONTEXT_PATH = "/webservice"; stati...

Missing JSP support in Jetty, or confusing log message?

Launching jetty by calling the API in 6.1.24. The JSP 2.1 component is on the classpath. org.mortbay.jetty:jsp-2.1-jetty:jar:6.1.24:compile But the log says: 2010-08-19 08:16:19.443:INFO::NO JSP Support for /basis_ws, did not find org.apache.jasper.servlet.JspServlet I don't see this message when using the corresponding maven-jett...

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 WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath("/"); bb.setWar("src...

mysterious console output to stderr from jetty?

When running my embedded jetty web app launcher, I see the following output to stderr. I just started seeing this after moving my build to maven-2. Has anyone seen this before? IDLE SCEP@988057 [d=false,io=1,w=true,rb=false,wb=false],NOT_HANDSHAKING, in/out=0/0 Status = OK HandshakeStatus = NOT_HANDSHAKING bytesConsumed = 5469 bytesPr...

Set up error handling in Jetty with Spring

Is it possible to convert the following Jetty XML configuration snippet <Configure class="org.mortbay.jetty.webapp.WebAppContext"> <Get name="errorHandler"> <Call name="addErrorPage"> <Arg type="int">500</Arg> <Arg type="int">599</Arg> <Arg type="String">/dump/errorCodeRangeMapping</Arg> </Call> </Get> </Co...

Spring framework best practices: deploying a non-bean compliant component

I want to build an MVC app using Spring (first timer here). As such I want to embed Jetty as the servlet engine. Jetty however doesn't stricly follow the java beans pattern, so I can't launch some classes from Spring (they use overloaded setters or non setter init methods like addXYZ). What is the accepted/recommended practice for stru...