问题标签 [jetty-8]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - 如何使用同一端口(使用码头 8)拥有具有多个上下文的 websocket
我试图实现 websocket 服务器,要求是在同一个端口上有多个上下文,即
应该提供两个不同的连接,但在同一个端口上。
我已关注旧文章如何创建嵌入式 WebSocket 服务器 Jetty 9?创建上下文处理程序。
我尝试下面的代码来创建两个单独的上下文
但我只在第二个上下文中获取数据。这是正确的实现吗?
即使我让它工作了,我也有最终要求,我必须即时打开/创建上下文,即在使用第一个上下文启动服务器之后。
有人可以解释如何使用单端口来实现这些要求吗?
java - SocketConnector 8081 - 地址已在使用中
我正在尝试在 2 个不同的端口 8080 和 9000 上运行 2 个 Dropwizard Server 应用程序。第一个应用程序成功启动,但是当我尝试在端口 9000 上运行时,我不断收到以下异常。我不明白的是为什么有 2 个端口由应用程序使用以及如何强制我的应用程序为第二个端口使用不同的端口号
rest - com.sun.jersey.api.client.ClientHandlerException:java.net.ConnectException:连接被拒绝:连接
我一直在尝试 mvn clean install
为我的单元测试分阶段自动启动和停止 Jetty。烦人的事情是,当我在 JBoss 中部署我的 war 文件时,所有测试都运行良好,但是,当我尝试使用时,maven-jetty-plugin
我遇到了Connection refuse: connect
错误。我确定 Jetty 启动但无法识别 URL,因此无法建立连接。
pom.xml
默认 web.xml
和我的其他课程
实体类
公共类 BookEntity {
}
资源接口
及其实施
最后测试类
你也可以从这里找到整个实现
https://github.com/flexelem/jersey-client-example
我会感谢每一个回应。不管怎么说,还是要谢谢你
java-7 - 码头8 Cookie中的NullPointer异常
我的应用程序使用 cookie 进行一些操作。以前我的应用程序部署在 Jboss 上并且运行良好。现在我们需要将应用程序迁移到 jetty-8 Server。我在运行时遇到了这个异常。我很确定这不是代码问题。
任何帮助将不胜感激。
maven - 使用不同的 maven (war) 模块启动两个 jetty 实例
我有一个多模块 maven 项目,其中两个模块产生战争。两个 serverModule 都依赖于 persistenceModule。每个服务器模块都配置有自己的 jetty-maven-plugin,它在预集成测试阶段启动服务器并在后集成测试阶段停止它。每个 serer 模块都有自己的码头配置——登录服务和端口。
serverModuleB 有一些集成测试,它们调用 serverModuleA 中提供的服务。因此,在执行 serverModuleB 中的集成测试时,需要 serverModuleA 启动并运行。
我无法从 serverModuleB 调出两个码头实例,因为 jetty-maven-plugin 不支持它。感谢任何帮助。
ssl - 码头 SSL 配置 Apache karaf
我正在尝试将码头配置为在 Apache Karaf OSGI 容器中使用 SSL。http 有效,但 https 无效。可能是什么问题呢?
我的配置详情如下:
等/jetty.xml
/etc/org.ops4j.pax.web.cfg 文件中的条目
ssl - CXF WS, Jetty, SSL: server side delay on second request causing CXF timeout
There's a CXF (2.7.11) webservice published via JaxWsServerFactoryBean to an embedded Jetty (8.1.15.v20140411) in a standalone application on Linux with JDK 8, 64 bit.
I set SSL parameters via JettyHTTPServerEngineFactory's setTLSServerParametersForPort.
The webservice does work, but there's a strange behaviour: when I start the server application the first SOAP request goes throw, but on the second request the client side CXF fails with a:
This is reproducible. It happens at CXF's default of 1 minute. When I look a jstack output of the server process (see below) org.bouncycastle.jce.provider.JDKKeyPairGenerator
is running in that situation, doing some Diffie-Hellman calculations. On the current machine the server thread ends after almost 2 minutes runtime.
I can rule out entropy shortage. Installing the haveged daemon to fill up Linux' entropy pool did not make a difference.
Turning on full SSL debug output on the server side one can see differing behaviour at this point:
While this shows the working flow of the first request, the second one goes like this after the ClientHello:
When the second request's thread is finished I can send hundreds of SOAP requests without problems.
Any hints why this is failing or why the second SSL session behaves differently?
jstack of server thread:
UPDATE: The certificate used for SSL was created with JDK8's keytool using default settings. The result was a certificate with signature algorithm SHA1withDSA. I created a new certificate with SHA256withRSA and the problems obviously disappeared, no software change necessary.
java - 忽略静态内容的 Servlet 响应包装器
我创建了服务器过滤器,它计算响应大小。它通过创建响应包装器来做到这一点,该包装器ServletOutputStream
使用 Apache Commons包装CountingOutputStream
。此外,包装器使用包装的流创建 PrintWriter。所以理论上,无论使用什么方法来创建实际输出,都应该通过 CountingOutputStream。
问题是,虽然整个事情适用于典型的 servlet 请求,但它对于静态内容却失败了。准确地说,请求被过滤器接收,响应包装器被创建和chain.doFilter()
调用。但是,当它返回时,包装的流声称没有发送任何数据,而实际上已经发送了数据。在进一步调试之后,似乎在提供静态内容期间,响应包装器上既没有也没有调用getOutputStream()
。getWriter()
过滤器和应用程序在Jetty 8.1.x上运行。我浏览了 Jetty 的默认 servlet,它似乎以通常的方式提供静态内容(即通过获取输出流并写入它)。
所以问题是:为什么包装方法被忽略了?
java - Jetty 中 servlet 的优雅降级
我正在运行一个嵌入式 Jetty 8 服务器,它在启动时会加载一些 *.war 文件:
这些战争文件对类路径中可能存在或不存在的一些类有一些依赖关系。
现在,如果我的一个 servlet 缺少依赖项,我的整个嵌入式 Jetty 服务就会失败。(因为 NoClassDefFoundExceptions)
我需要一种方法,它允许我捕获失败的 servlet 的异常并且根本不激活它们。我正在寻找与当 servlet 加载失败时 TomCat 所做的相同的事情:它仍然加载其余部分。
在谷歌上搜索了一段时间后,我没有找到任何解决方案。
有人知道我如何使用嵌入式 Jetty 8 解决这个问题吗?
jetty - 码头:战争+额外的类路径目录
我正在使用这样的代码运行带有码头的战争文件 a.war:
我需要将带有密钥库的系统范围的目录添加到类路径中。当我将它复制到 WAR/classes 中时,它可以工作。但是当我使用以下方式指定它时:
(带有密钥库的目录)-它失败了,因为密钥库在类路径上不可用。码头是否可以使用战争+附加类路径库?谢谢!