embedded-jetty

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

我的梦境 提交于 2019-12-03 06:19:27
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: <init-param> <param-name>cacheControl</param-name> <param-value>max-age=3600,public</param-value> </init-param> However, I am not sure that I am using the default servlet. At least such configuration is not in web.xml: <web-app> <display-name>Wicket QuickStart</display-name> <context-param> <param-name>configuration</param-name> <param-value>development</param-value> <

How to embed i-jetty server into android application?

别来无恙 提交于 2019-12-03 06:02:29
问题 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? 回答1: I successfully managed to integrate I-Jetty into my application, for anyone out there who is still hoping to do so. So basically what I did is I downloaded the i-jetty source code and imported it as a maven project in eclipse. Then I added a module to the parent pom.xml that points to a webapp maven module I made:

Embedded Jetty doesn't recognise Spring MVC Security

点点圈 提交于 2019-12-03 03:47:33
I am developing a Spring application that starts an embedded Jetty Server. It then "deploys" a Spring MVC web app to this Jetty server. All is working well with multiple controllers, but I fail to add Spring Security to the web app. I use programmatic and annotation-based configuration and the Jetty server is configured like this: Server server = new Server(8080); server.setStopAtShutdown(true); AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setConfigLocation("com.mypackage.web"); context.setParent(mainContext); ServletContextHandler

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

自作多情 提交于 2019-12-03 02:58:10
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 beans and their dependencies. Controllers inside Jetty use the same dependencies, so I'd like to avoid duplicating them inside and outside Jetty. Richard Fearn I did this a while ago. Spring's documentation suggests that you use a ContextLoaderListener to load

Shortest code to start embedded Jetty server

南楼画角 提交于 2019-12-03 02:04:37
问题 I'm writing some example code where an embedded Jetty server is started. The server must load exactly one servlet, send all requests to the servlet and listen on localhost:80 My code so far: static void startJetty() { try { Server server = new Server(); Connector con = new SelectChannelConnector(); con.setPort(80); server.addConnector(con); Context context = new Context(server, "/", Context.SESSIONS); ServletHolder holder = new ServletHolder(new MyApp()); context.addServlet(holder, "/*");

Configuring Jetty JSP support in embedded mode in Maven project

痴心易碎 提交于 2019-12-03 01:12:31
问题 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 dependencies: <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-webapp</artifactId> <version>8.0.0.M1</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> </dependency> Does that

How to implement FileUpload in embedded Jetty?

混江龙づ霸主 提交于 2019-12-03 00:48:16
I am writing a android app including a webserver. Therefore I use the Embedded Jetty (8.0.1). The next step I want to do is implementing a file upload. The HTML looks like that and I think correct: <form action=\"fileupload\" method=\"post\" enctype=\"multipart/form-data\"> <table> <tbody> <tr> <td><input type=\"file\" name=\"userfile1\" /></td> </tr> <tr> <td> <input type=\"submit\" value=\"Submit\" /><input type=\"reset\" value=\"Reset\" /> </td> </tr> </tbody> </table> </form> When I use this form, I can see in logcat that I received a file but I can't access this file in my Servlet. I

How do you get embedded Jetty 9 to successfully resolve the JSTL URI?

自作多情 提交于 2019-12-03 00:37:21
I'm packaging a Web Application Archive (.war) so that it can be started via java -jar webapp.war in a shell by launching an embedded copy of Jetty 9 using this code in a main class: int port = Integer.parseInt(System.getProperty("port", "80")); // I know this has implications :) String contextPath = System.getProperty("contextPath", ""); Server server = new Server(port); ProtectionDomain domain = Deployer.class.getProtectionDomain(); URL location = domain.getCodeSource().getLocation(); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/" + contextPath); webapp.setWar(location

In the Jetty server how can I obtain the client certificate used when client authentication is required?

寵の児 提交于 2019-12-02 20:43:10
It is very easy to set up an embedded Jetty server that requests client authentication: One just needs to add the statement SslContextFactory.setNeedClientAuth(true); to the ssl context when configuring the server. Any client that has its certificate in the server's truststore will be able to establish a TLS connection to the server. However I need to know which client of all the possible trusted clients is currently making a request; in other words I need to know the client certificate used in this connection, in particular in the handler. Does anyone know how to access this certificate or if

Configuring Jetty JSP support in embedded mode in Maven project

放肆的年华 提交于 2019-12-02 14:31:53
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 dependencies: <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-webapp</artifactId> <version>8.0.0.M1</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> </dependency> Does that fulfill the "check that JSP jars are in lib/jsp" part of the error message? Also, I have no idea what