1
votes

I'm using Modeshape rest server. Modeshape's version is 2.8.2.

When I send GET request to some node like http://localhost:8080/modeshape-server/repo/workspace1/items/file it returns information about the node.

But when I send DELETE request (using Fiddler, for example) on the same address it returns 405 Method Not Allowed. According to documentation addresses like this should support DELETE requests.

More detailed. I send

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

I get

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>

pom.xml which I'm using to build rest-server.war

<?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>

Am I doing something wrong?

And I'm also using JBoss-as-7.1.1. But in response written 7.0.13.

And also I'm using Modeshape rest not as service. I'm using it as normally deployed application. (I'm sorry, but I'm not quite familiar with types of applications. I heard that there are some services in JBoss-as. Anyway I'm not using it)

1
ModeShape's REST service doesn't explicitly produce 405 errors, and it does support the DELETE method. Can you add the full HTTP request and response messages?Randall Hauch
@RandallHauch I've edited my question. Thank you for your attention.Gregory Kalabin

1 Answers

2
votes

It looks like 2.8.x is expecting a "Content-Type: application/json" header to be included with the DELETE request. I suspect that since the request has no such header, the web application doesn't have a handler for the request.

ModeShape does provide a kit that will install ModeShape 2.x as a service in JBoss AS 5 and 6, and another kit that will install ModeShape 3.0 (still in Beta) as a service in JBoss AS7. The benefit is that your 1+ applications simply have to look up the Repository instance (typically via JNDI, though with 3.0 you can also use the JavaEE @Inject annotation to automatically inject the repository into your EJBs or application).

However, there is no kit for installing ModeShape 2.8.2 as a service in JBoss AS7.