3

我正在使用Modeshape 休息服务器。Modeshape 的版本是 2.8.2。

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

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

更详细。我发

删除 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

<html><head><title>JBoss Web/7.0.13.Final - 错误报告</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background -color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family :Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white ;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black; font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP 状态405 - </h1><HR size="1" noshade="noshade"><p><b>type</b> 状态报告</p><p><b>消息</b> <u></u></p><p><b>描述</b> <u>指定的HTTP请求的资源 () 不允许使用方法。</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.13.Final</h3></body ></html>

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

<?xml 版本="1.0" 编码="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <属性>
        <modeshape.version>2.8.2.Final</modeshape.version>
    </属性>

    <父>
        <artifactId>modeshape</artifactId>
        <groupId>org.modeshape</groupId>
        <version>2.8.2.Final</version>
    </父>

    <groupId>modeshape.demo</groupId>
    <版本>0.1</版本>

    <artifactId>modeshape-server</artifactId>
    <包装>战争</包装>
    <name>Modeshape 休息服务器</name>
    <description>提供对 JCR 项的 RESTful 访问的 ModeShape servlet</description>
    <url></url>
    <依赖项>
        <依赖>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <版本>2.5</版本>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-web-jcr</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-jcr-api</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-jcr</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-search-lucene</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-cnd</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-repository</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-graph</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-common</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-web-jcr-rest</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-connector-jdbc-metadata</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <版本>5.1.6</版本>
            <scope>编译</scope>
        </依赖>

        <依赖>
            <groupId>org.modeshape</groupId>
            <artifactId>modeshape-connector-filesystem</artifactId>
            <version>${modeshape.version}</version>
        </依赖>

        <依赖>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </依赖>

        <依赖>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <版本>1.2.1.GA</版本>
        </依赖>

        <依赖>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <版本>4.10</版本>
            <scope>测试</scope>
        </依赖>
    </依赖>

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

    <构建>
        <finalName>休息服务器</finalName>
    </build>

</项目>

难道我做错了什么?

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

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

4

1 回答 1

2

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

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

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

于 2012-09-04T18:21:29.877 回答