【问题标题】:DELETE request to Modeshape rest server对 Modeshape 休息服务器的 DELETE 请求
【发布时间】:2012-08-28 20:05:29
【问题描述】:

我正在使用Modeshape rest server。 Modeshape 的版本是 2.8.2。

当我向http://localhost:8080/modeshape-server/repo/workspace1/items/file 之类的某个节点发送 GET 请求时,它会返回有关该节点的信息。

但是当我在同一个地址上发送 DELETE 请求(例如使用 Fiddler)时,它返回 405 Method Not Allowed。 根据documentation 这样的地址应该支持删除请求。

更详细。 我发送

删除 http://localhost:8080/modeshape-server/repo/workspace1/items/uploads/file HTTP/1.1
用户代理:提琴手
主机:本地主机:8080

我明白了

HTTP/1.1 405 方法不允许
服务器:Apache-Coyote/1.1
允许:POST、OPTIONS
内容类型:text/html;charset=utf-8
内容长度:984
日期:格林威治标准时间 2012 年 9 月 4 日星期二 14:16:38

JBoss Web/7.0.13.Final - 错误报告

HTTP 状态405 -


type 状态报告

消息

说明 所请求的资源()不允许指定的HTTP方法。


JBoss Web/7.0.13.Final

我用来构建 rest-server.war 的 pom.xml

4.0.02.8.2.Final属性>

    
        modeshapeorg.modeshape2.8.2.Final父>

    modeshape.demo0.1版本>

    modeshape-server战争包装>
    Modeshape 休息服务器提供对 JCR 项的 RESTful 访问的 ModeShape servletjavax.servletservlet-api2.5版本>
        依赖>

        
            org.modeshapemodeshape-web-jcr${modeshape.version}依赖>

        
            org.modeshapemodeshape-jcr-api${modeshape.version}依赖>

        
            org.modeshapemodeshape-jcr${modeshape.version}依赖>

        
            org.modeshapemodeshape-search-lucene${modeshape.version}依赖>

        
            org.modeshapemodeshape-cnd${modeshape.version}依赖>

        
            org.modeshapemodeshape-repository${modeshape.version}依赖>

        
            org.modeshapemodeshape-graph${modeshape.version}依赖>

        
            org.modeshapemodeshape-common${modeshape.version}依赖>

        
            org.modeshapemodeshape-web-jcr-rest${modeshape.version}依赖>

        
            org.modeshapemodeshape-connector-jdbc-metadata${modeshape.version}依赖>

        
            mysqlmysql-connector-java5.1.6版本>
            编译依赖>

        
            org.modeshapemodeshape-connector-filesystem${modeshape.version}依赖>

        
            org.slf4jslf4j-log4j12依赖>

        
            org.jboss.resteasyresteasy-jaxrs1.2.1.GA版本>
        依赖>

        
            junitjunit4.10版本>
            测试依赖>
    依赖>

    
        
            老板http://repository.jboss.org/nexus/content/groups/public存储库>

    
        休息服务器

我做错了吗?

我也在使用 JBoss-as-7.1.1。但作为回应写在 7.0.13。

而且我使用 Modeshape 休息不是作为服务。我将它用作通常部署的应用程序。 (不好意思,我对应用的类型不是很熟悉,听说JBoss-as里面有一些服务,反正我没用)

【问题讨论】:

  • ModeShape 的 REST 服务不会显式产生 405 错误,它确实支持 DELETE 方法。能否添加完整的 HTTP 请求和响应消息?
  • @RandallHauch 我已经编辑了我的问题。感谢您的关注。

标签: java rest http-delete modeshape


【解决方案1】:

看起来 2.8.x 期望在 DELETE 请求中包含“Content-Type: application/json”标头。我怀疑由于请求没有这样的标头,因此 Web 应用程序没有请求的处理程序。

ModeShape 确实提供了一个工具包,可以将 ModeShape 2.x 作为服务安装在 JBoss AS 5 和 6 中,另一个工具包可以将 ModeShape 3.0(仍处于测试阶段)作为服务安装在 JBoss AS7 中。好处是您的 1+ 应用程序只需查找 Repository 实例(通常通过 JNDI,尽管在 3.0 中您也可以使用 JavaEE @Inject 注释将存储库自动注入您的 EJB 或应用程序)。

但是,在 JBoss AS7 中没有用于将 ModeShape 2.8.2 安装为服务的工具包。

【讨论】:

  • 谢谢,已经成功了。我们知道这些套件,但我们必须使用 JBoss 7.1.1 和 ModeShape 2.8.2,因为 ModeShape 3.0 beta 和集群存在一些问题。
猜你喜欢
  • 2013-03-24
  • 2019-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多