簡體   English   中英

刪除對Modeshape其余服務器的請求

[英]DELETE request to Modeshape rest server

我正在使用Modeshape rest服務器 Modeshape的版本是2.8.2。

當我將GET請求發送到某個節點(例如http://localhost:8080/modeshape-server/repo/workspace1/items/file它將返回有關該節點的信息。

但是,當我在相同的地址上發送DELETE請求(例如,使用Fiddler)時,它返回405 Method Not Allowed 根據文檔地址,這樣的地址應該支持DELETE請求。

更詳細。 我寄

DELETE http://localhost:8080/modeshape-server/repo/workspace1/items/uploads/file HTTP/1.1
User-Agent: Fiddler
Host: localhost:8080

我懂了

HTTP/1.1 405 Method Not Allowed
Server: Apache-Coyote/1.1
Allow: POST, OPTIONS
Content-Type: text/html;charset=utf-8
Content-Length: 984
Date: Tue, 04 Sep 2012 14:16:38 GMT

<html><head><title>JBoss Web/7.0.13.Final - Error report</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 Status 405 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The specified HTTP method is not allowed for the requested resource ().</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.13.Final</h3></body></html>

我用來構建rest-server.war的pom.xml

<?xml version="1.0" encoding="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>

    <properties>
        <modeshape.version>2.8.2.Final</modeshape.version>
    </properties>

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

    <groupId>modeshape.demo</groupId>
    <version>0.1</version>

    <artifactId>modeshape-server</artifactId>
    <packaging>war</packaging>
    <name>Modeshape rest server</name>
    <description>ModeShape servlet that provides RESTful access to JCR items</description>
    <url></url>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>

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

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

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

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

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

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

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

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

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

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

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.6</version>
            <scope>compile</scope>
        </dependency>

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

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>1.2.1.GA</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>jboss</id>
            <url>http://repository.jboss.org/nexus/content/groups/public</url>
        </repository>
    </repositories>

    <build>
        <finalName>rest-server</finalName>
    </build>

</project>

難道我做錯了什么?

而且我還在使用JBoss-as 7.1.1。 但在回應中寫7.0.13。

而且我正在使用Modeshape rest而不是服務。 我將其用作正常部署的應用程序。 (很抱歉,但是我對應用程序的類型不太熟悉。我聽說JBoss-as中有一些服務。無論如何,我沒有使用它)

看起來2.8.x期望DELETE請求中包含“ Content-Type:application / json”標頭。 我懷疑由於請求沒有這樣的標頭,因此Web應用程序沒有該請求的處理程序。

ModeShape確實提供了一個工具包,它將在JBoss AS 5和6中作為服務安裝ModeShape 2.x,並且另一個工具包將在JBoss AS7中作為服務安裝ModeShape 3.0(仍處於Beta版)。 好處是您的1個以上的應用程序只需要查找Repository實例(通常通過JNDI查找,盡管在3.0中,您也可以使用JavaEE @Inject批注將存儲庫自動注入到EJB或應用程序中)。

但是,在JBoss AS7中沒有用於將ModeShape 2.8.2作為服務安裝的工具包。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM