【问题标题】:How to know if crafter-profile or crafter-social are running?如何知道crafter-profile 或crafter-social 是否正在运行?
【发布时间】:2017-06-13 16:25:44
【问题描述】:

我正在尝试找到一个体面的 URL,它会在 Crafter-profile 和 Crafter-social 上返回 404 以外的内容,以便我确定它们存在于 tomcat 中。

我可以使用任何 api/其他网址吗?

谢谢,

尼古拉斯

【问题讨论】:

    标签: content-management-system monitoring crafter-cms


    【解决方案1】:

    对于社交:

    1. 404 消息是自定义消息 (https://github.com/cortiz/social/blob/2.5.x/server/src/main/webapp/404.jsp),您可以检查响应的 HTML 以查看是容器默认(或 apache)还是应用程序传递的消息。

    2. 使用 curl 或浏览器调用以获取线程(可能不存在):/crafter-social/api/3/threads/test/comments?context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9 您应该得到如下响应:

    HTTP/1.1 200 Access-Control-Allow-Origin: *
    Access-Control-Allow-Methods: POST, GET, PUT, DELETE
    Access-Control-Max-Age: 3600
    Access-Control-Allow-Headers: x-requested-with
    Access-Control-Allow-Credentials: false
    Content-Type: application/json;charset=UTF-8
    Transfer-Encoding: chunked
    Date: Tue, 13 Jun 2017 16:45:31 GMT
    {"total":0,"pageSize":666,"pageNumber":0,"watched":false,"comments": []}

    1. Curl Swagger 文档服务:/crafter-social/api-docs

    ` HTTP/1.1 200 访问控制允许来源:* 访问控制允许方法:POST、GET、PUT、DELETE 访问控制最大年龄:3600 访问控制允许标头:x-requested-with 访问控制允许凭据:假 内容类型:application/json;charset=UTF-8 传输编码:分块 日期:2017 年 6 月 13 日星期二 17:12:45 GMT

    {"apiVersion":"1.0","swaggerVersion":"1.2","apis":[{"path":"/default/comment-services","description":"Comments services"},{"path":"/default/comment-services-extension","description":"Comments services Extension"},{"path":"/default/handles-context-configuration","description":"Creates and associates Social Context to profiles"},{"path":"/default/security-actions","description":"Services to Admin Security Actions"},{"path":"/default/system-profile","description":"Clears profile cache,Only for Social Admins or Super Admins."},{"path":"/default/threads-controller","description":"Threads Controller"}],"info":{"title":"API Title","description":"API Description","termsOfServiceUrl":"API terms of service","contact":"API Contact Email","license":"API Licence Type","licenseUrl":"API License URL"}}%  
    

    `

    个人资料:

    1. 使用 curl 或浏览器拨打电话以从不存在的用户那里获取不存在的访问令牌的属性:/crafter-profile/api/1/profile/12333/attributes?accessTokenId=12345,您应该得到如下响应:

    `

    HTTP/1.1 403 
    Content-Type: application/json;charset=UTF-8
    Transfer-Encoding: chunked
    Date: Tue, 13 Jun 2017 17:03:39 GMT
    
    {"errorCode":"NO_SUCH_ACCESS_TOKEN_ID","message":"No access token found for ID \"12345\""}%
    

    `

    注意: 所有给定选项都不是最佳选择,请随时在此处创建功能请求:https://github.com/craftercms/craftercms/issues 为 Profile 和 Social 构建适当的 REST 心跳监控服务。

    ** 注2** 以上所有内容仅对 2.5.x 有效。

    【讨论】:

    • 看起来 /../api-docs/ 用于个人资料和社交是目前最好的选择。非常感谢。是的,为监控而设计的真正的 api 将是理想的。我会接受你的提议,发布一个关于它的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-19
    • 1970-01-01
    • 1970-01-01
    • 2017-10-02
    • 2017-10-22
    • 1970-01-01
    相关资源
    最近更新 更多