You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

REST请求格式协商咨询:多指定场景下的格式优先级疑问

Alfresco REST Content Negotiation: Mixed Format Scenario Answer

Great question about Alfresco Web Script content negotiation! Let's break this down clearly:

First, it's important to know that Alfresco's Web Scripts (the endpoints under /alfresco/service/) follow a clear priority order for content format negotiation:

  • Highest priority: The format query parameter in the URL. This overrides any other format specifications.
  • Middle priority: The file extension in the URL path (like .json, .xml, etc.).
  • Lowest priority: The Accept HTTP request header.

Now let's apply this to your specific request:

curl -uadmin:admin -H "Accept: text/html" "http://localhost:8080/alfresco/service/hellouser.xml?format=json"

You've included three format-related elements here:

  1. format=json (query parameter)
  2. .xml (URL path extension)
  3. Accept: text/html (request header)

Since the format=json query parameter has the highest priority, the Alfresco service will ignore the .xml suffix and Accept: text/html header, and return JSON format—exactly what you're expecting.

As a quick way to confirm, you can add -v to your curl command to view the response headers; you'll see the Content-Type header set to application/json, confirming the response format.

内容的提问来源于stack exchange,提问作者Eugen Konkov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:14:31