gpt4 book ai didi

java - 在/share 和/alfresco 之间的 POST 请求上的 Alfresco 随机 HTTP 400

转载 作者:行者123 更新时间:2023-11-28 23:36:01 25 4
gpt4 key购买 nike

我在户外获取 POST HTTP 请求时遇到问题。

我使用 YAHOO.asyncRequest 向/share/proxy/alfresco/... 发送请求,有时我会收到 400 响应代码。我总是发送相同的请求和相同的参数,所以问题不在这里。我调试了 Alfresco 的代码,发现 RemoteClient 将 HTTP 请求发送到/alfresco/s/...?ALF_TICEKT=...,但如果发生错误,我无法在 Alfresco 端看到请求。收到响应 400。

我 tcpdump 了请求,如果一切正常,我可以看到:

POST /alfresco/s/.../institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855 HTTP/1.1
connection: keep-alive
content-length: 0
origin: http://dani-alf:8080
x-requested-with: application/json
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36
accept: */*
referer: http://dani-alf:8080/share/page/user/.../dashboard
accept-encoding: gzip,deflate,sdch
accept-language: hu-HU,hu;q=0.8,en-US;q=0.6,en;q=0.4
Content-Type: application/json
Host: localhost:8080
Expect: 100-continue


HTTP/1.1 100 Continue


HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Length: 133
Date: Thu, 03 Jul 2014 07:40:19 GMT

...

HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Transfer-Encoding: chunked
Date: Thu, 03 Jul 2014 07:40:19 GMT
Connection: close

...

如果出现 HTTP 400:

POST /alfresco/s/.../institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855 HTTP/1.1
connection: keep-alive
content-length: 0
origin: http://dani-alf:8080
x-requested-with: application/json
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36
accept: */*
referer: http://dani-alf:8080/share/page/user/.../dashboard
accept-encoding: gzip,deflate,sdch
accept-language: hu-HU,hu;q=0.8,en-US;q=0.6,en;q=0.4
Content-Type: application/json
Host: localhost:8080
Expect: 100-continue

在日志中:

 DEBUG [webscripts.connector.HttpConnector] [http-bio-8080-exec-218] Requested Method: POST URI: /.../institution-registration?close=true&instID=2
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Executing (POST) http://localhost:8080/alfresco/s/.../institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] - InputStream supplied - will push...
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] - OutputStream supplied - will stream response...
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] - OutputStream supplied - will stream response...
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] - Full Proxy mode between servlet request and response...
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Creating HttpClient instance for thread: http-bio-8080-exec-218
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Set Content-Type=application/json
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] POST entity Content-Length=-2
... MY CODE ...
org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Response status code: 200
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-218] Response encoding: null
DEBUG [webscripts.connector.AuthenticatingConnector] [http-bio-8080-exec-218] Received 200 on first call to: /.../institution-registration?close=true&instID=2
DEBUG [servlet.mvc.EndPointProxyController] [http-bio-8080-exec-218] Return code: 200

错误请求日志:

 DEBUG [webscripts.connector.HttpConnector] [http-bio-8080-exec-112] Requested Method: POST URI: /.../institution-registration?close=true&instID=2
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] Executing (POST) http://localhost:8080/alfresco/s/.../institution-registration?close=true&instID=2&alf_ticket=TICKET_1eb2ac478ba6b2389c831de9014d3ab4564e4855
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] - InputStream supplied - will push...
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] - OutputStream supplied - will stream response...
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] - Full Proxy mode between servlet request and response...
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] Set Content-Type=application/json
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] POST entity Content-Length=-2
DEBUG [webscripts.connector.RemoteClient] [http-bio-8080-exec-112] Response status code: 400
DEBUG [webscripts.connector.AuthenticatingConnector] [http-bio-8080-exec-112] Received 400 on first call to: /.../institution-registration?close=true&instID=2
DEBUG [servlet.mvc.EndPointProxyController] [http-bio-8080-exec-112] Return code: 400

我发现在 GET 请求中它不会发生。有什么建议吗?

最佳答案

我在 Alfresco 论坛上问了同样的问题,得到了答案:

https://forums.alfresco.com/forum/developer-discussions/web-scripts/random-http-400-error-post-request-alfresco-07032014-0755

将 YAHOO 请求更改为 Ajax 请求并且成功了。

关于java - 在/share 和/alfresco 之间的 POST 请求上的 Alfresco 随机 HTTP 400,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24548216/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com