为什么可以';我是否可以通过RESTAPI启用或禁用我的GlassFish应用程序?

为什么可以';我是否可以通过RESTAPI启用或禁用我的GlassFish应用程序?,glassfish,glassfish-3,Glassfish,Glassfish 3,当我提交REST请求时,例如:(包含的auth用于admin/adminadmin) GlassFish只是拒绝了这个请求: HTTP/1.1 400 Bad Request Content-Length: 0 Date: Wed, 17 Jul 2013 10:33:06 GMT Connection: close 我做错了什么 我使用GET方法检查命令参数,它们都是可选的。来自: 添加、更新或删除对象的REST请求必须使用值“GlassFish REST HTML接口”指定X-Reques

当我提交REST请求时,例如:(包含的auth用于admin/adminadmin)

GlassFish只是拒绝了这个请求:

HTTP/1.1 400 Bad Request
Content-Length: 0
Date: Wed, 17 Jul 2013 10:33:06 GMT
Connection: close
我做错了什么

我使用GET方法检查命令参数,它们都是可选的。

来自:

添加、更新或删除对象的REST请求必须使用值“GlassFish REST HTML接口”指定X-Requested-By头

例如:

curl -ik -X POST -H "Accept: application/json"
  -H "Authorization: Basic YWRtaW46YWRtaW5hZG1pbg=="
  -H "X-Requested-By: GlassFish REST HTML interface"
  https://localhost:4848/management/domain/applications/application/MyApp/enable
发件人:

添加、更新或删除对象的REST请求必须使用值“GlassFish REST HTML接口”指定X-Requested-By头

例如:

curl -ik -X POST -H "Accept: application/json"
  -H "Authorization: Basic YWRtaW46YWRtaW5hZG1pbg=="
  -H "X-Requested-By: GlassFish REST HTML interface"
  https://localhost:4848/management/domain/applications/application/MyApp/enable
基于此,我为那些试图与Glassfish的继任者(Payara服务器)合作的人推荐:

启用应用程序

禁用应用程序

基于此,我为那些试图与Glassfish的继任者(Payara服务器)合作的人推荐:

启用应用程序

禁用应用程序

curl -ik -X POST \
  -H 'accept: application/json;charset=UTF-8' \
  -H 'authorization: Basic YWRtaW46YWRtaW5hZG1pbg==' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'x-requested-by: GlassFish REST HTML interface' \
  --data target=server \
  --url https://localhost:4848/management/domain/applications/application/awesomeApp/enable 
curl -ik -X POST \
  -H 'accept: application/json;charset=UTF-8' \
  -H 'authorization: Basic YWRtaW46YWRtaW5hZG1pbg==' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'x-requested-by: GlassFish REST HTML interface' \
  --data target=server \
  --url https://localhost:4848/management/domain/applications/application/awesomeApp/disable