embedded-jetty

Embedded jetty application not working from jar

核能气质少年 提交于 2019-12-11 06:54:21
问题 I have the following code: Server server = new Server(9090); final URL warUrl = Main.class.getClassLoader().getResource("com/domain/webapps/app"); final String warUrlString = warUrl.toExternalForm(); WebAppContext wac = new WebAppContext(warUrlString, "/app"); server.setHandler(wac); I have the Main class in the com.domain package. The jsp's and html's are in the com.domain.webapps.app package. When run inside Netbeans (or java -cp <classpath> com.domain.Main on the exploded jar) the

Spring Boot and Spring Security integration in embedded Jetty environment

社会主义新天地 提交于 2019-12-11 05:56:56
问题 I'm trying to initialize Spring Security from a main() method in a "fat" executable JAR with Spring Boot and embedded Jetty. I use Spring Security with Java config (no web.xml). The problem is that embedded Jetty fails to register the springSecurityFilterChain filter. When I run the same JAR as a WAR in Jetty ( mvn jetty:run ) it works normally and I see this: Initializing Spring embedded WebApplicationContext But when running in embedded Jetty I see no WebApplicationContext getting

When does OnWebSocketClose fire in Jetty 9

寵の児 提交于 2019-12-11 05:43:49
问题 I have a simple embedded Jetty 9 websocket server. I have a method like this in my annotated websocket implementation: @OnWebSocketClose void onClose(int statusCode, String reason) { logger.info "Closed connection [${this}]" connectionManager.remove(this) Event closeEvent = commsEventFactory.buildCloseEvent(this, statusCode, reason) eventReceiver.postEvent(closeEvent) } I have a spock test which connects to the server using async-http-client. I get a successful connection and can send

How to package and deploy web app with embedded Jetty

拈花ヽ惹草 提交于 2019-12-11 04:14:01
问题 I am developing web application that must be running on embedded Jetty (without external web app container). All the logic and content are ready. I only want to understand how do I package and deploy web app with embedded Jetty using Maven. Here are detailed questions: At the moment I run my web app on Jetty 9.x in Intellij IDEA but I guess it is external Jetty anyway. So what is a jetty embedded server. How can I make it considering the structure of my web App (see below)? I think the

Increasing Jetty ThreadPool size in Karaf

微笑、不失礼 提交于 2019-12-11 03:24:36
问题 Trying to increase the number of threads in embedded jetty running in karaf .Im changing the jetty.xml with the following properties as described in the POST . <Configure class="org.eclipse.jetty.server.Server"> <Call name="addConnector"> <Arg> <New class="org.eclipse.jetty.util.thread.QueuedThreadPool"> <Set name="minThreads">10</Set> <Set name="maxThreads">1000</Set> </New> </Arg> </Call> </Configure> And also having org.ops4j.pax.web.cfg file in karaf ,with below properties : org.ops4j.pax

Adding/Removing a webapp to an embedded Jetty

℡╲_俬逩灬. 提交于 2019-12-11 03:14:48
问题 I have a Jetty embedded server started up. I wish to be able to do a hot deploy of a webapp and be able to unload it again, all programmatically. Once the server is started, any attempts to add a handler to it throws an error. I tried using ContextHandlerCollection and then using .addContext() to get it up and running but not sure if that is the right way to go about it. Can someone please point me in the right direction? thank you 回答1: This hotswap works for me (Jetty 7) - this code is

Using ContentCachingRequestWrapper causes Empty Parameters Map

こ雲淡風輕ζ 提交于 2019-12-11 03:12:38
问题 I have implemented a Filter, in which I want to read the content of request first for some checks and then I would like to go on. But the problem is, that in the following filter from the filter chain the getParameters() Method from class Request (org.eclipse.jetty.server.Request) is called and not the getParameters() method from class ContentCachingRequestWrapper . So the parametersMap are not filled and is always empty. Here is how my code looks like: @Component @Order(1) public class

How to deploy war with embedded jetty server

和自甴很熟 提交于 2019-12-11 02:23:47
问题 I have a war file with embedded jetty server. I want to deploy it online. What should I do first? I tried it to run in IDE it works well but I am confused on how to deploy it online? I don't want to start server everytime I tried to run my app like what IDE does. For instance, I want to type " http://119.81.44.73/myapp " then my homepage will show up. Can I ask some help to guide how to do this. or Is there any configuration needed to deploy it online? 回答1: A WAR file is meant to be deployed

Removing powered by Jetty

我只是一个虾纸丫 提交于 2019-12-10 23:02:34
问题 I am using Jetty server with embedded web app. However whenever I hit any resource which is not present in It serves a default page which shows a message "Powered by Jetty". This page is being served from DefaultHandler class of org.eclipse.jetty.server.handler and from handle methos implementation. I want write a custom handler for this however current while trying to register custom Handler in jetty.xml file, I am getting syntax exception and server not getting started. Can anybody please

Jetty How to re-deploy war

断了今生、忘了曾经 提交于 2019-12-10 22:37:50
问题 Now I have read Jetty docs http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty#Setting_a_Web_Application_Context . But there are no info about how to make code with hot re-deploy of the war file with scanInterval. It must re-deploy war file if it changed. How to code this? 回答1: For hot deploy you need to deploy the webapp with the deployment manager and the webapp or context provider. http://wiki.eclipse.org/Jetty/Feature/Hot_Deployment the xml shown there (and in the distribution in the