0

当我向 jetty 服务的 EJB 发送 GET http 请求时,即使 auth 参数正确,我也经常收到 401 响应。

当我查看码头日志时,我看到了这个:

2013-06-27 11:54:11.004:DBUG:oejs.Server:REQUEST /app/general/launch on AsyncHttpConnection@3adf0ddc,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-5,l=34,c=0},r=1
2013-06-27 11:54:11.021:DBUG:oejs.Server:RESPONSE /app/general/launch  401
2013-06-27 11:54:11.066:DBUG:oejs.Server:REQUEST /app/general/launch on AsyncHttpConnection@3adf0ddc,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-5,l=102,c=0},r=2

我怀疑请求未完全读取(请求实体太大或标头太大?),因为它为单个请求解析了两次。有没有办法来解决这个问题 ?

是什么HttpParser{s=-5,l=34,c=0}意思HttpParser{s=-5,l=102,c=0}

当我停用身份验证时(使用简单码头领域的安全约束)。请求只解析一次。

4

1 回答 1

0

401 means that the server requires authentication credentials that the client either has not sent or the ones sent by the client have not been authorized. Some client implementations will resend the request if they receive a 401 including the credentials. If your client is doing that, that would explain why you get the request twice on the server.

The HttpParser toString() method returns the current status of the HttpParser. Here's the code:

    return String.format("%s{s=%d,l=%d,c=%d}",
            getClass().getSimpleName(),
            _state,
            _length,
            _contentLength);

So s is the state. -5 is STATE_HEADER. And l and c represent the length and the contentLength.

于 2013-06-27T12:56:11.070 回答