embedded-jetty

How to remove trailing slash from embedded Jetty URLs?

时光总嘲笑我的痴心妄想 提交于 2019-12-05 18:19:21
I use embedded Jetty 9.3.8.v20160314 from Scala (Scala is incidental here, this is a pure Jetty question), configured like this: val loginService = new RepoLoginService(usersRepository, signInsRepo) val server = new Server(8080) server.addBean(loginService) val security = new ConstraintSecurityHandler() server.setHandler(security) val constraint = new Constraint() constraint.setName("auth") constraint.setAuthenticate(true) constraint.setRoles(Array[String]("user", "admin")) val mapping = new ConstraintMapping() mapping.setPathSpec("/*") mapping.setConstraint(constraint) security

Can not post form with many (over 256) values

时光总嘲笑我的痴心妄想 提交于 2019-12-05 18:07:38
问题 I am using Spring Boot 1.2.2 with Thymeleaf. My Problem is I try to post a long list of Items (some labels, one checkbox) in a form, which cant be perform so many items of my list. (I tested small lists and it worked.) First I used jetty but got an error, which says: java.lang.IllegalStateException: Form too many keys at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:526) I searched and saw this post. As the result I added applicationDefaultJvmArgs = ["-Dorg.eclipse.jetty

Jetty embedded and JSP compilation to 1.7?

偶尔善良 提交于 2019-12-05 17:55:45
Could i specify somehow the target version of vm for jsp compilation? (I need 1.7, not 1.5 which is by default). I have a WebAppContext , some filters in code on it etc. The webapp itself is an exploded war.. so no xml configuration is used as it was not needed. But seems, xml configuration are strictly necessary in order to do this? How it shall look like (and wouldn't it conflict with the in-code definitions) ? ..or is there any way to do the trick through the code? Thanks. http://www.eclipse.org/jetty/documentation/current/configuring-jsp.html#jsp-support When you are configuring the org

Setup Jetty GzipHandler programmatically

∥☆過路亽.° 提交于 2019-12-05 14:40:50
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 GzipHandler(); gzipHandler.setHandler(myHandler); server.setHandler(gzipHandler); The browser (Chromium) always sends a header containing Accept-Encoding:gzip,deflate,sdch so according to the documentation GZIP Handler This handler will gzip the content of a response if: The filter is mapped to a matching path The response status code is >=200 and <300 The content length is unknown or more than the minGzipSize initParameter or

Embedded Jetty : how to use a .war that is included in the .jar from which Jetty starts?

ⅰ亾dé卋堺 提交于 2019-12-05 11:42:15
I'm trying to generate a .jar containing a main() that would start Jetty. My problem is that I'd like the .war that Jetty loads to be included in the same .jar . I've been able to create the .jar containing the .war with : In the POM.xml : <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.3</version> <configuration> <finalName>myApp</finalName> <appendAssemblyId>false</appendAssemblyId> <archive> <manifest> <mainClass>com.myApp.Server</mainClass> </manifest> </archive> <descriptors> <descriptor>src/main/resources/executable-jar-assembly.xml</descriptor> </descriptors> <

How do I programmatically set gzip in Jetty?

狂风中的少年 提交于 2019-12-05 07:45:05
I'm writing a web app using Noir and clojure, which uses Jetty. Jetty has two ways of using gzip, one for static, and one for dynamic, they are described in https://stackoverflow.com/a/9113129/104021 . I want to turn on both static and dynamic gzipping, but our project doesn't use web.xml files, and doesn't want to start. How do I programmatically set jetty to use gzip (ie without having a web.xml)? In a Compojure app I'm working on, I have a Ring/Jetty adapter based on ring-jetty-adapter which programmatically configures Jetty to use a GzipHandler to gzip content dynamically. (defn-

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

杀马特。学长 韩版系。学妹 提交于 2019-12-05 04:55:39
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 ServletContextHandler and adding servlets to that? For example: //how is this different... ServletHandler handler = new ServletHandler(); handler.addServletWithMapping(MyServlet.class, "/path"); //from this? ServletContextHandler contextHandler = new ServletContextHandler(); contextHandler.addServlet(MyServlet.class, "/path"); Most Servlet's require a javax

404 Not Found Error in a simple Jetty/Maven Hello World webapp

99封情书 提交于 2019-12-05 03:49:54
I have followed the instructions to create a "Standard WebApp with Jetty and Maven" precisely as described on the eclipse wiki: http://wiki.eclipse.org/Jetty/Tutorial/Jetty_and_Maven_HelloWorld#Developing_a_Standard_WebApp_with_Jetty_and_Maven However when I run the webapp (mvn jetty:run) and go to localhost:8080/hello-world/hello I end up at a "HTTP ERROR 404 Problem accessing /hello-world/hello. Reason: Not Found". I have read through documentation, looked at the wiki page's history, poked around other forums and stackoverflow threads, but can not find the answer to this seemingly simple

Embedded Jetty rewrites not working properly

十年热恋 提交于 2019-12-05 02:56:30
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 found. But if I request /admin.html directly, it works! There are 2 other similar posts on stackoverflow but no answers to the question! Here's the code: WebAppContext _ctx = new WebAppContext(); _ctx.setContextPath("/"); _ctx.setDefaultsDescriptor(JETTY_DEFAULTS_DESCRIPTOR); _ctx.setParentLoaderPriority(true); _ctx.setWar(getShadedWarUrl()); _ctx

No multipartconfig for servlet error from Jetty using scalatra

天大地大妈咪最大 提交于 2019-12-05 02:29:11
I am trying to unit test an upload call but I get this error for the following code: @MultipartConfig(maxFileSize = 3145728) class WebServlet extends ScalatraServlet with FileUploadSupport { override def isSizeConstraintException(e: Exception) = e match { case se: ServletException if se.getMessage.contains("exceeds max filesize") || se.getMessage.startsWith("Request exceeds maxRequestSize") => true case _ => false } error { case e: SizeConstraintExceededException => RequestEntityTooLarge("too much!") } post("/uploadscript") { val privateParam = try {params("private") != null && params("private