jetty

Embedded Jetty - Adding Context after starting Jetty Server

跟風遠走 提交于 2019-12-24 02:47:09
问题 Is it right to start a jetty instance with no context specified and no context handler, then keep adding context to it once the server has started. Although I was able to do this using mutable HandlerCollection and the logs says the Server and the Contexts are started and available, I am not able to access it with the URL. Or should we add at least one root context and contexthandler to the server while starting it? I did something similar to the example suggested in below link. Jetty 9

Embedded Jetty fails to load JSP taglibs when classpath specified in jar

Deadly 提交于 2019-12-24 02:18:16
问题 I'm running into a problem that doesn't seem to be addressed by the similar questions. I have an app that embeds Jetty, using SpringMVC, JSPs and taglibs. I use a maven plugin to generate a jar, bundle all the dependent jars into a directory and create a manifest. When I run the app using the jar (eg. java -jar app.jar) everything works fine until I try to load a JSP that specifies <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> or any other taglib for that matter. If I run

Run Jetty with jetty-maven-plugin and finish the build when jetty is running

大城市里の小女人 提交于 2019-12-24 01:01:55
问题 I want to Run Jetty with jetty-maven-plugin and finish the build when jetty is running. I created a pom.xml that starts jetty and deploying a war file, after the jetty starts I want maven to finish the build while leaving the jetty running, So that I could start another maven build to run tests on the server I just ran jetty on. Then I will create another maven build that just stops the jetty server. Problem is that I didn't managed to start jetty and make the maven build stop after that,

How to use the Spring WebClient with Jetty, instead of Netty?

六月ゝ 毕业季﹏ 提交于 2019-12-23 19:37:47
问题 According to the documentation it is possible to use the Spring Reactive WebClient with a different server as Netty: WebClient provides a higher level API over HTTP client libraries. By default it uses Reactor Netty but that is pluggable with a different ClientHttpConnector. However, I was not able to find a way how to do this. If I simply change the dependency from Netty to Jetty like this: compile('org.springframework.boot:spring-boot-starter-webflux') { exclude group: 'org.springframework

Spring Websocket Configuration: using WebSocketMessageBrokerConfigurationSupport and WebSocketConfigurer together - how?

只愿长相守 提交于 2019-12-23 19:22:14
问题 I am configuring currently my Spring Websocket using the class public class WebSocketConfig extends WebSocketMessageBrokerConfigurationSupport now I came across the advice Spring STOMP Websockets: any way to enable permessage-deflate on server side? that makes use of public class SampleJettyWebSocketsApplication implements WebSocketConfigurer and overrides @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) and offers @Bean public DefaultHandshakeHandler

Jetty nonblocking by default?

安稳与你 提交于 2019-12-23 18:07:45
问题 Please tell me, Is Jetty non-blocking web server by default or not? For example, this code below runs Jetty as non-blocking web server? Server server = new Server(8080); ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); server.setHandler(context); context.addServlet(new ServletHolder(new MyServlet()),"/*"); server.start(); server.join(); Thank you!!! 回答1: It depends on which version of Jetty you're using. In Jetty 6, the

Can't find Jetty WebSocket classes after adding the libraries in classpath

怎甘沉沦 提交于 2019-12-23 17:56:28
问题 I'm trying to use Jetty to communicate with a remote Server, using websockets. I'm developing it in Eclipse, but i can't compile any sample code. That's what i've done I downloaded the latest version of Jetty, and i've added start.jar in the classpath. That's what i've included in the sample class import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; and some more. The problem is

How do I serve https and http for Jetty by one port

此生再无相见时 提交于 2019-12-23 17:37:01
问题 What I want to do is serving http and https at the same time for my jetty application. I have SelectChannelConnector and SslSocketConnector connectors and their ports are 3131 and 8443 respectively. I would like to transparently forward requests http://localhost:80/* --> http://localhost:3131/* https://localhost:80/* --> https://localhost:8443/* What is the easiest way to make it? Thanks 回答1: As Vortico suggested, I changed my ports to 80 for http and 443 for https. It solved my problem. 来源:

Get jetty realm credentials in application

廉价感情. 提交于 2019-12-23 16:41:07
问题 It might be a stupid question but we are using jetty basic authentication on our server. Now we want to use the usercredentials in our application. Is it possible to get the current login in the RAP webapplication? Thanks 回答1: I'm not a RAP expert, but it looks like you want to do this: HttpServletRequest request = RWT.getRequest(); Principal user = request.getUserPrincipal(); 来源: https://stackoverflow.com/questions/7991244/get-jetty-realm-credentials-in-application

Embed jetty in java app and export as jar

我怕爱的太早我们不能终老 提交于 2019-12-23 15:43:34
问题 I'm making a java application which embeds a Jetty web server, which in turn serves content developed with Google Web Toolkit. It's all working fine when run in Eclipse, but when I export it as a jar file all I get is a Jetty error message saying "File not found". The Jetty server is launched like this: WebAppContext handler = new WebAppContext(); handler.setResourceBase("./war"); handler.setDescriptor("./war/WEB-INF/web.xml"); handler.setContextPath("/"); handler.setParentLoaderPriority(true