【问题标题】:How to set Remote user to Jersey Client?如何将远程用户设置为 Jersey 客户端?
【发布时间】:2011-11-15 16:47:48
【问题描述】:

我正在为基于 Jersey 的网络服务进行一些单元测试。我正在使用 Jersey 测试框架。

在 servlet 中,我有这段代码:

@POST

public void insert(@Context UriInfo uriInfo, @Context HttpServletRequest request)
{
   ......
}

在单元测试中发布请求时,我有这个:

WebResource r = resource().path("/root");
r.post();

一切正常,但由于测试服务器在 Grizzly 上本地运行,我无法从请求中获取远程用户。有没有办法在单元测试中模拟它?

【问题讨论】:

    标签: unit-testing testing mocking jersey cgi


    【解决方案1】:
    猜你喜欢
    • 2012-05-12
    • 1970-01-01
    • 2015-09-26
    • 1970-01-01
    • 2023-03-14
    • 1970-01-01
    • 2014-04-16
    • 2016-02-27
    • 2017-06-08
    相关资源
    最近更新 更多