embedded-jetty

Resteasy and Google Guice: how to use multiple @ApplicationPath and resource with @Injection?

不羁的心 提交于 2019-12-01 15:16:36
问题 I created a project to test the dependency injection offered by Google Guice in my Jax-rs resources, using Resteasy. My intentions are: Use multiple @ApplicationPath for the versions of my API. In each class annotated with @ApplicationPath I load a set of classes for the specific version. Each resource have a @Inject (from Google Guice) in his constructor to inject some services. I created two classes annotated with @ApplicationPath : ApplicationV1RS and ApplicationV2RS . In both I added the

How to start an aggregate jetty-server JAR from Ant?

北慕城南 提交于 2019-12-01 14:08:06
Background Disclaimer: I have very little experience with Java. We previously used a wrapped version of Jetty 6 for on-demand static content (JS, CSS, images, HTML) during our Ant build so we can run unit tests with PhantomJS against an HTTP-hosted environment. However, Jetty is now on version 8.1.3 and we no longer need that wrapping (which solves a different problem which is now moot), so I wanted to update to just using Jetty 8.1.3 directly. First I downloaded the whole Jetty distribution, which weighs in at a massive ~40 MB. This works from Ant, using "start.jar"... but I don't really want

Jetty: How to nest HandlerWrapper, HandlerList, and ContextHandlerCollection, and ContextHandler

戏子无情 提交于 2019-12-01 13:56:54
I'm trying to build an api server on Jetty. I want to have multiple apis on routes that look like /apis/api1/endpoint, /apis/api2/endpoint, /apis/api3/endpoint, etc Essentially I have a HandlerWrapper, that contains a HandlerList of ContextHandlerCollections that in essence just does: public void handle(...) { if (uri.startsWith("/apis/")) { log.info("This is an api request"); this.getHandlerList.handle(...) } else { super.handle() } } private HandlerList getHandlerList() { HandlerList handlerList = new HandlerList(); ContextHandlerCollection contextHandlerCollection = new

How to run hawt.io in spring boot application with embedded tomcat

别说谁变了你拦得住时间么 提交于 2019-12-01 07:20:48
问题 I would like to add hawt.io as an embedded component to my spring boot 'fat jar' application which has an embedded tomcat server. How can I do this? How could I deploy the hawt.io war file? UPDATE: I added the dependencies: hawtio-web hawtio-core hawtio-plugin-mbean hawtio-springboot to my pom When I start the application now and open the url localhost:8080/hatio/index.html I get the login page presented. Since I don't know username and password I the added hawtio.authenticationEnabled=false

Jetty 9 (embedded): Adding handlers during runtime

浪尽此生 提交于 2019-12-01 06:11:53
Is there any way to add handlers to a running embedded Jetty instance? We have migrated an old Jetty 6 based project to Jetty 9 and we need for our plugin system the possibility add and remove dynamically handlers... See the example below... Server server = new Server(); [...] server.start(); [...] Handler[] existingHandler = server.getHandlers(); // There is no more server.addHandler(newHandler); // only this you can do, but only if the server is stopped server.setHandler(newHandler) Note: newHandler is a HandlerCollection ... With Jetty 9.1.0.v20131115 you can use the mutableWhenRunning flag

Jetty 9 (embedded): Adding handlers during runtime

拜拜、爱过 提交于 2019-12-01 04:47:57
问题 Is there any way to add handlers to a running embedded Jetty instance? We have migrated an old Jetty 6 based project to Jetty 9 and we need for our plugin system the possibility add and remove dynamically handlers... See the example below... Server server = new Server(); [...] server.start(); [...] Handler[] existingHandler = server.getHandlers(); // There is no more server.addHandler(newHandler); // only this you can do, but only if the server is stopped server.setHandler(newHandler) Note:

Why is getUserMedia throwing a [object NavigatorUserMediaError] when I click “Allow” in Chrome?

北城余情 提交于 2019-12-01 03:21:59
Recently, I started getting errors when trying to access the client's mic through my website. When Chrome asks whether to allow the site to access the user's microphone, [object NavigatorUserMediaError] is produced whether they click "allow" or "deny." This has been happening regardless of whether or not a microphone is actually plugged into the computer (which is running Ubuntu 12.04). Further testing through Firefox showed that this is not specific to Chrome. The problem only started after I had done a live-input demo and then logged out of the computer. I tried making a bare bones demo of

Why is getUserMedia throwing a [object NavigatorUserMediaError] when I click “Allow” in Chrome?

我的梦境 提交于 2019-11-30 23:47:37
问题 Recently, I started getting errors when trying to access the client's mic through my website. When Chrome asks whether to allow the site to access the user's microphone, [object NavigatorUserMediaError] is produced whether they click "allow" or "deny." This has been happening regardless of whether or not a microphone is actually plugged into the computer (which is running Ubuntu 12.04). Further testing through Firefox showed that this is not specific to Chrome. The problem only started after

How to prevent caching of static files in embedded Jetty instance?

ⅰ亾dé卋堺 提交于 2019-11-30 17:27:11
问题 I want to prevent my CSSs from being cached on the browser side. How can I do it in embedded Jetty instance? If I were using xml configuration file, I would add lines like: <init-param> <param-name>cacheControl</param-name> <param-value>max-age=0,public</param-value> </init-param> How I can turn that into the code? Right now I start Jetty this way: BasicConfigurator.configure(); Server server = new Server(); SocketConnector connector = new SocketConnector(); // Set some timeout options to

Is it possible to create Desktop Application using Java backend & Web Technologies UI

纵饮孤独 提交于 2019-11-30 12:17:30
问题 I would like to create a desktop application in Java & web technologies. The main reason for selecting Java is that it is free, open source, and hence our investment would be minimal and we would save lots of investment with respect to licensing costs, etc. Also, the main reason for selecting web technologies is because our current programmers are well versed with web technologies like HTMl, css, Ajax, and we have good experience in creating amazing UI in web technologies. I will give you