0

I'm trying to use the jsp beta wrapper to implement Kendo UI image browser and keep getting 406 response from the server.

I'm using Spring 3.1 and the Kendo editor is just an add-on to a functional project. Hibernate dao layer, etc. work fine, so I'm thinking dispatcher-servlet config is ok, I'm getting no runtime or compile errors.

I'm trying to get to the point where I can get a list of images from the server.

JavaScript configuration:

imageBrowser: {
    transport: {
        read: {
            url: "/brush/imagebrowser/read.html" ,
            dataType: "json"
        },


        destroy: "/brush/imagebrowser/destroy.html",
        create: "/brush/imagebrowser/createDirectory.html",
        uploadUrl: "/brush/imagebrowser/upload.html",
        thumbnailUrl: "/brush/imagebrowser/thumbnail.html",
        imageUrl: "/brush/art/upload/thm/"
    },
    path: "/art/upload/thm/",
    fileTypes : ".png,.gif,.jpg,.jpeg, .JPG"
}

Controller:

@RequestMapping( value = {"/imagebrowser/read.html"}, method = RequestMethod.POST, headers="Accept=*/*",   produces = "application/json")
public @ResponseBody List<ImageBrowserEntry> read(String path) {

    List<ImageBrowserEntry> l = imageBrowser.getList( path );
    return l;
}

Modifications in ImageBrowserDaoImpl:

private final String RootFolder = "/";
private final String CopyFolder = "/";
private final String PrettyName = "";

When I put a breakpoint in debugger on 'return l' in the controller method I can see the list contains images as I'd expect.

I've added

org.codehaus.jackson:jackson-core-asl:1.9.1222
org.codehaus.jackson:jackson-mapper-asl:1.9.9

jars to project ( using IntelliJ 12 for IDE )

Through a little bit of trial and error I got to the 406 error, but beyond that it's looking a little hopeless.

4

1 回答 1

0

弄清楚了。我的调度程序 servlet 不完整。添加以下内容并解决随后出现的更多问题后,一切都很好。

1. 2. 另外,改变了元素 imageUrl: "/brush/{0}"- 错过了卷曲和零。

但是,我不清楚的是为什么我的 js 文件中的这个配置有效:

01.            transport: {
02.                read: {
03.                    url: "/brush/imagebrowser/read.html" ,
04.//                    contentType: "application/json"
05.                    dataType: "json"
06.                },
07. 
08. 
09.                destroy: "/brush/imagebrowser/destroy.html",
10.                create: "/brush/imagebrowser/createDirectory.html",
11.                uploadUrl: "/brush/imagebrowser/upload.html",
12.                thumbnailUrl: "/brush/imagebrowser/thumbnail.html",
13.//
14.                imageUrl: "/brush/{0}"
15.            },
16.            path: "/art/upload/thm/"

我现在遇到的问题:第 14 行有我的本地上下文“/brush/”和“mysery”参数。所以默认值为 0,但它还能是什么呢?

于 2013-03-14T11:57:14.500 回答