jetty

Error during WebSocket handshake: Unexpected response code: 302

流过昼夜 提交于 2020-01-02 02:38:05
问题 While connecting to REACT based WebSocket client to Java Jetty based Web Socket server, I am getting the error below - WebSocket connection to 'ws://localhost:2319/ws' failed: Error during WebSocket handshake: Unexpected response code: 302 This error doesn't exist while connecting through Chrome's Smart Web Socket client. I am trying to develop Web Socket Client based on REACT. Client code is - var connection = new WebSocket('ws://localhost:2319/ws'); connection.onopen = function () { //

web.xml default file in directory (for jetty, or tomcat)?

◇◆丶佛笑我妖孽 提交于 2020-01-02 02:10:32
问题 I have a directory called ./welcome/ and ./welcome/ has a file called ./index.jsp. I know how to tell jetty or tomcat how to start at ./wecome/index.jsp. But, I also have lots of other directories with an ./index.jsp like --- ./blogs/, ./whatever/, etc. Without using servlets, is there a way to tell jetty or tomcat, "hey, whenever you get a request for a directory, see if there is an ./index.jsp -- and display it to the user." Like if I access ./blogs/ I dont want to see a 404 not found. I

Jetty Character encoding issue

无人久伴 提交于 2020-01-01 19:05:26
问题 I am facing a problem with jetty character encoding. When installed the jetty server on Mac (OSX), it works fine. But, when it is installed on Ubuntu (10.10), the character encoding is not proper. The word in the page (not URL) having problem is: The New York Times® Bestsellers It is shown as "The New York Times� Bestsellers" on the page served by the server on Linux and it is shown as "The New York Times® Bestsellers" on the page served by the server on Mac (This is correct) The jetty

Jetty Websockets - Correctly sending async messages when handling unreliable connections

丶灬走出姿态 提交于 2020-01-01 19:03:34
问题 I'm using Jetty 9.3.5 and I would like to know what is the proper way to handle unreliable connections when sending websocket messages, specifically: I noticed cases when a websocket connection does not close normally so, even though the client side is down, it takes a lot of time until onClose() is triggered on the server (for ex. a user closes the laptop lid and puts it in standby - it can take 1-2 hours until the close event is received on the server side). Thus, because the client is

How to enable hot swapping in debug mode with gradle and jetty?

与世无争的帅哥 提交于 2020-01-01 15:31:37
问题 I'm using jettyRun for running my simple spring application. I wanted to enable hot swapping with Intellij debuger, but looks like jetty doesn't catch the changes. On http://docs.codehaus.org/display/GRADLE/Gradle+Jetty+Plugin I seen that it should work with: jettyRun.scanIntervalSeconds=1 On the other hand, there is some inconsistency. On the gradle homepage this parameter is not listed: http://www.gradle.org/jetty_plugin. Anyway, is there any way to enable this on gradle? 回答1: Heh, actually

Maven jetty plugin - delay when starting in background mode

白昼怎懂夜的黑 提交于 2020-01-01 14:51:32
问题 I start a jetty server on linux using nohup mvn jetty:run & to run it in background and to stay when I quit from the console. Usually (mvn jetty:run) it starts in seconds, but in this case it takes about minute to start. What can be the cause of such a delay? Stack trace Full thread dump Java HotSpot(TM) 64-Bit Server VM (11.0-b16 mixed mode): "Attach Listener" daemon prio=10 tid=0x000000004bba8c00 nid=0x560a waiting on condition [0x0000000000000000..0x0000000000000000] java.lang.Thread.State

Running a web application (WAR) with embedded jetty server

穿精又带淫゛_ 提交于 2020-01-01 09:24:10
问题 I have made a very basic web application that has only one html page. I exported it as a war. Now I created an embedded jetty server. public class SimplestServer { public static void main(String[] args) throws Exception{ Server server = new Server(8000); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); webapp.setWar("C:\\Users\\User\\Desktop\\jetty\\JettyWar.war"); server.setHandler(webapp); server.start(); server.join(); } } I created a jar for this embedded server.

Cast Java Object into Java Map<String,Object>

谁说我不能喝 提交于 2020-01-01 08:56:39
问题 I am using org.eclipse.jetty.util.ajax.JSON to parse JSON text. But the JSON.parse(string) method produces an Object and I need it as a Map. Internally it is an object of exactly the mentioned class. But how do you cast an Object into a Map without constructing a new one or getting the unchecked cast warning? Currently, I have found only one solution without the unchecked cast warning, but with constructing a new Map, which is actually of course not a casting at all. private Map<String,Object

Cast Java Object into Java Map<String,Object>

耗尽温柔 提交于 2020-01-01 08:56:29
问题 I am using org.eclipse.jetty.util.ajax.JSON to parse JSON text. But the JSON.parse(string) method produces an Object and I need it as a Map. Internally it is an object of exactly the mentioned class. But how do you cast an Object into a Map without constructing a new one or getting the unchecked cast warning? Currently, I have found only one solution without the unchecked cast warning, but with constructing a new Map, which is actually of course not a casting at all. private Map<String,Object

Jetty http session is always null (Embedded Container, ServletHolder)

时光毁灭记忆、已成空白 提交于 2020-01-01 08:56:27
问题 I am trying to implement a simple servlet which uses a HTTP session in an embedded jetty (7.3.0 v20110203) container. To start jetty I use the following code: Server server = new Server(12043); ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS); handler.setContextPath("/"); server.setHandler(handler); ServletHolder holder = new ServletHolder(new BaseServlet()); handler.addServlet(holder, "/*"); server.start(); server.join(); The servlet acquires a