embedded-jetty

Embedded Jetty handling urls to serve content

老子叫甜甜 提交于 2019-12-20 06:04:26
问题 I am using embedded Jetty with Guice and am wondering the best way to handle serving my single page application. I wish for Jetty to handle requests like so (in priority order): /socket must be handled by the websocket servlet /fs/read/* , anything that matches this url I need to be handled by a custom servlet /* , anything that matches this url should be served from the /web on the classpath of my Java application assuming it isn't handled by the above. If the resource does not exist, then

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

拜拜、爱过 提交于 2019-12-19 12:06:05
问题 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

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

南楼画角 提交于 2019-12-19 12:05:33
问题 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

Embedded Jetty with client certificates

为君一笑 提交于 2019-12-19 11:54:49
问题 I want to create embedded https server that required the clients to present a certificate and I am using this: http://www.smartjava.org/content/embedded-jetty-client-certificates Now my question is that how can I provide keystore and truststore file for my code given that my jetty is emedded. I mean these lines in the code: // the keystore (with one key) we'll use to make the connection with the // broker private final static String KEYSTORE_LOCATION = "src/main/resources/client_keystore.jks"

Configure Spring Security on embedded Jetty in Spring

风流意气都作罢 提交于 2019-12-18 13:36:11
问题 I have a Spring beans definition file, as below <bean id="jettyZk" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop"> <!-- properties, threadPool, connectors --> <property name="handler"> <bean class="org.eclipse.jetty.servlet.ServletContextHandler"> <property name="eventListeners"> <list> <!-- my.ContextLoaderListener * An ApplicationContextAware ContextLoaderListener that allows for using the current ApplicationContext, * as determined by

Jetty ssl port not open for secure JSR-356 websockets

爱⌒轻易说出口 提交于 2019-12-18 07:18:44
问题 I'm writing a server app that uses secure websockets using embedded Jetty 9.3.0.M2. When I run it without secure sockets, everything is copacetic, but when I enable the secure sockets, my clients get connection refused and nmap shows that the port is closed. There are no errors in the log on the server side. I believe that my .jks, .crt, .pem, and .key files and my keystore password are all correct, because other apps on this same server are using the same ones and are working. Here is the

How to run jetty 7+ with specified war with groovy/gradle?

我与影子孤独终老i 提交于 2019-12-18 04:48:05
问题 I want to run Jetty 7+ with gradle build, but unlucky looks like there is no way to do this with jettyRun. So probably simplest idea to achieve what I want would be to use custom target: task runJetty << { def server = new Server() // more code here server.start() server.join() } Unlucky I just started with gradle and I don't know groovy either, so it's hard for me to create proper target. I was looking over the internet but I wasn't able to find any solution. Can anyone hit me with some

Websocket JSR-356 fail with Jetty 9.4.1

吃可爱长大的小学妹 提交于 2019-12-17 20:32:28
问题 My current web server is embedded Jetty 9.1.5. It works well with JSR-356 to create websocket. These days, I am trying to upgrade to Jetty 9.4.1. Everything works nicely except websocket. My code like below: Embedded Jetty and Websocket libs: <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> <version>9.4.1.v20170120</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-webapp</artifactId> <version>9.4.1.v20170120<

cannot load JSTL taglib within embedded Jetty server

一世执手 提交于 2019-12-17 19:33:35
问题 I am writing a web application that runs within an embedded Jetty instance. When I attempt to execute a JSTL statement, I receive the following exception: org.apache.jasper.JasperException: /index.jsp(1,63) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application I have the following jars on the classpath ant-1.6.5.jar ant-1.7.1.jar ant-launcher-1.7.1.jar core-3.1.1.jar jetty-6.1.22.jar jetty-util-6.1.22

maven jetty embedded (fat jar) - src/main/webapp missing in jar

女生的网名这么多〃 提交于 2019-12-13 22:06:33
问题 I am trying to built a embedded jetty in one fat jar. I built the app using a tuto for jetty-embedded offering rest service, which I also need in my application. Now I am trying to add/include a jsf based context. Everything works fine in Eclipse, but as soon as deploy using maven clean install and I try to execute the jar somewhere esle, I get the following error: Exception in thread "main" java.lang.IllegalArgumentException: file:///home/debbie/src/main/webapp is not an existing directory.