embedded-jetty

Response Header too large - Jetty Embedded version 9

非 Y 不嫁゛ 提交于 2019-12-10 17:50:29
问题 I'm getting an exception of "Response Header too large" when using Jetty, the exception is thrown at the Client and only when the size of the jsonValue is large (greater than 1500 bytes). If the jsonvalue is smaller, everything works fine. This is the code I have, it is very simple. Server Code: Server server = new Server(8080); ServletHandler handler = new ServletHandler(); server.setHandler(handler); handler.addServletWithMapping(StoreServlet.class, "/store"); server.start(); server.join();

JSP compilation error on jetty-9.3.3

喜欢而已 提交于 2019-12-10 17:28:56
问题 I have a webapp application which was running on embedded Jetty-7.6.8 (jdk-6), but due to Diffe-Hellman error on the browser we decided to move to newer version of Jetty. So, we moved to Jetty-9.3.3. As Jetty-9.x needs jdk-8, I upgraded jdk also. Right now jetty is starting up with no error but when I try to access my login page I get an unable compile jsp error. These are the dependencies: -org.eclipse.jetty.apache-jsp-9.3.3.v20150827.jar -org.mortbay.jasper.apache-el-8.0.23.M1.jar -org

How to install jetty with eclipse on Mac

我的梦境 提交于 2019-12-10 17:21:55
问题 I am a newbie w.r.t. jetty and RESTful API's. I want to create REST services using Jetty and wants to use embedded jetty with eclipse. Can anyone suggest me any HowTo for installing Jetty/ Jetty plugins with Eclipse in Mac OS. Regards, 回答1: If you're looking for an Eclipse plugin that will allow you to start your web app in Jetty via the Debug/Run menus, you may want to take a look at the run-jetty-run plugin. If you happen to be using Maven, there's a Maven plugin you can use to start your

how to set connection/request timeout for jetty server?

若如初见. 提交于 2019-12-10 12:49:21
问题 I'm running an embedded jetty server (jetty 6.1.24) inside my application like this: Handler handler=new AbstractHandler() { @Override public void handle(String target, HttpServletRequest request, HttpServletResponse response, int dispatch) throws IOException, ServletException { //this can take a long time doSomething(); } }; Server server = new Server(8080); Connector connector = new org.mortbay.jetty.nio.SelectChannelConnector(); server.addConnector(connector); server.setHandler(handler);

Read JSON message from HTTP POST request in Java

点点圈 提交于 2019-12-10 11:43:38
问题 I am new to Java and to client- server programming. I am using embedded Jetty, and I'm trying to send a JSON string to some address (http://localhost:7070/json) and then to display the JSON string in that address. I tried the following code but all I get is null. Embedded Jetty code: public static void main(String[] args) throws Exception { Server server = new Server(7070); ServletContextHandler handler = new ServletContextHandler(server, "/json"); handler.addServlet(ExampleServlet.class, "/"

Setup Jetty GzipHandler programmatically

安稳与你 提交于 2019-12-10 07:36:13
问题 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

How to gracefully shutdown embeded jetty

时光毁灭记忆、已成空白 提交于 2019-12-09 16:55:19
问题 I have an application runs on an embedded jetty server. Now i want to start/stop the server as a service. I use a script to start the server. java $JAVA_OPTS -DREQ_JAVA_VERSION=$JAVA_VERSION -jar myjetty.jar Main Class Server server = new Server(); SelectChannelConnector connector = new SelectChannelConnector(); connector.setPort(PORT); server.addConnector(connector); HandlerCollection handlers = new HandlerCollection(); NCSARequestLog requestLog = new NCSARequestLog(); requestLog.setFilename

Map jetty ResourceHandler to a URL

蓝咒 提交于 2019-12-09 15:49:09
问题 Is it possible using embedded Jetty to serve static files from directory X but mapped to URL Y? I have static files stored under directory "web", but I want the URL be something like http://host/myapp . I have already successfully ran a server configured with ResourceHandler in the following way: ResourceHandler ctx = new ResourceHandler(); ctx.setResourceBase("path-to-web"); HandlerList list = new HandlerList(); list.addHandler(ctx); ... server.setHandler(list); But the result is serving the

Missing JSP support in Jetty, or confusing log message?

与世无争的帅哥 提交于 2019-12-08 14:53:54
问题 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-jetty-plugin. What am I missing? 回答1: I don't do Jetty, so I looked a bit round and found this blog. Here's a cite of relevance: But, this is not enough, if you start

Using embedded Jetty 9 with HTTPS only

烂漫一生 提交于 2019-12-08 13:42:36
问题 I am using embedded Jetty 9, where I want to allow https access, but no http. I know I can easily configure a redirect in Jetty web.xml, but I don't have that file in the embedded version. I know I can use any file and point to it from the embedded version, but this should be easier. So I searched and found this here http://blog.anvard.org/articles/2013/10/05/jetty-ssl-server.html where the author states "Of course, we could force the use of HTTP/S by just removing the HTTP connector." So I