问题标签 [jersey-1.0]
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 - Jersey Web 服务能否有时同步处理请求,有时异步处理?
这是我尝试使用Jersey 1.8和Java 6编写的基本方法。
有时该方法用作基本的 REST 服务,但如果正在更新缓存,则传入的请求应在缓存更新后进入队列进行处理。
我想过尝试将整个添加HttpServletRequest
到队列中,但它会在返回信息之前阻塞,并且所有传入的请求都应该在缓存更新时添加到队列中。
当服务启动时,它会启动一个后台线程,该线程使用 JeroMQ(ZeroMQ 的纯 Java 实现)来侦听消息以更新缓存。
处理这种情况的最佳方法是什么?
PS,我是一名有 4 周经验的实习生 :)
更新:
我认为 @Suspended 注释以及 Jersey 的AsyncResponse
课程将完成我正在寻找的东西。不幸的是,该类是在 Jersey 2.0 中引入的,我必须使用 1.8。任何人都可以提出类似的建议吗?
jaxb - MOxy @XmlReadOnly 注解
我在 Glassfish 3.1.2 上使用 Jersey 1.18,并且试图将属性设为只读。我已经在使用 MOxy @XmlReadOnly,但它被编组了。
有什么可以做的吗?
谢谢!
java - Jersey client.setChunkedEncodingSize(null) not working
I am writing one client to measure Jersey, REST based web service performance. I have written some code to measure response time and to measure number of bytes sent from the server but response.getLength()
method always returning -1
.
In many QA forum I read that setting client.setChunkedEncodingSize(null)
will work but even after setting this, I am getting -1.
From server side, I am sending response of type XML or JSON or protobuf depending upon parameters sent by client. For all of these response types, I am getting response length as -1.
My actual request looks like below:
From server side, I am not setting content-length explicitly. Can anyone please help me in getting content-length on client side?
Whole purpose of this experiment is to measure which response type is more efficient in terms of response time and amount of data sent/received.
websphere-8 - '无法初始化类 org.apache.wink.common.internal.providers.header.MediaTypeHeaderDelegate'?
我正在运行 Websphere Liberty Profile V8.5,并且正在尝试部署一个使用 restful 服务来公开一些 CRUD 数据库操作的网站。部署工作正常,但在运行时,当我在根目录下的浏览器中打开网站时,我看到:
[错误] Uncaught.init.exception.thrown.by.servlet
Jersey REST 服务
开发人员门户
java.lang.NoClassDefFoundError:无法初始化类 org.apache.wink.common.internal.providers.header.MediaTypeHeaderDelegate
我坚信这与我的依赖有关。如您所见,我尝试手动添加 org.apache.wink.common.internal.privders.header.MediaTypeHeaderDelegate 无济于事。这是我的 POM 文件:
Web.xml 片段:
jersey-1.0 - 如何在球衣中获取映射路径
请参考以下代码。/hello/from/JohnDoe 将点击 sayPlainTextHello 方法。当访问“/hello/from/JohnDoe”时,我想将映射路径存储在日志中,即 /hello/from/{name}。请注意,我无法修改以下代码,但可以向应用程序添加过滤器等。如何获取映射路径“/hello/from/{name}”?
java - Intercepting HTTP response body in DropWizard 0.7.0/Jersey 1.x
I'm building a web service with DropWizard 0.7.0 that produces JavaScript output using a Mustache template. I'd like to minify and obfuscate the generated JavaScript.
In Jersey 2.x's manual, I see that one can define interceptors, specifically WriterInterceptors, for manipulating HTTP response entities. This feels like the appropriate place for the minification/obfuscation as it should occur after the template has been applied. However, DW 0.7.0 uses Jersey 1.18.1.
I'm aware there's a branch of DropWizard with Jersey 2.x support, but I'm keen to use the standard DW distribution.
Is there a way of intercepting the response HTTP entity/body after a template has been applied using DW 0.7.0/Jersey 1.18.1?
ajax - GWT AJAX 没有浏览器鼠标加载
我正在使用 GWT,并且我运行了一个计划的(使用 Timer)后台任务,该任务每 10 秒从服务器获取一些信息。
我的问题是每个调用都是 AJAX 调用(使用 Jersey),并且浏览器(大多数)在处理请求时在鼠标光标旁边显示加载图像。请求非常快,但加载图像显示几毫秒非常烦人。
知道如何在这个特定的 AJAX Jersey 调用中禁用加载图像吗?
谢谢,马克斯。
java - JSONWithPadding Jersey 1.x + jquery
您好,我正在尝试使用 jsonp 从 jquery 向 jersey 1.18 服务器进行休息调用
和jQuery:
虽然,JSONWithPadding 似乎无法正常运行,但 firefix 的控制台返回:
jsonp的内容是:
任何帮助:) ?
java - 使用泽西客户端发布 json 时获取 empy 数组
我正在使用泽西客户端 REST api 将数据发布到服务器。我已经设置了 WAMP 服务器,并且编写了一些 PHP 代码来打印发布数据。问题是每当我将数据发布到 WAMP 服务器时,它都会打印空字符串。我无法弄清楚问题出在哪里。请告诉问题出在服务器代码或客户端代码中。是否需要任何额外的支持来处理其余 APIS 请求?
我只粘贴相关代码。我的客户端代码如下。
我的 PHP 代码
我只得到下面提到的其他部分输出。
请帮助我为什么我得到空数组。是否需要任何额外的支持来处理其余 APIS 请求?
java - jersey 注释根据标头值过滤请求
jersey API 中是否有可用的注解来实现基于标头值的请求过滤?在 spring 中也是如此
@RequestMapping(value = "/test", method = RequestMethod.POST, headers = {"version=v1.1"})