开发者

DWR - can't marshall enum?

No matter what I try, this keeps f开发者_开发知识库ailing. What am I doing wrong, here?

package com.example
class ClassToMarshall{
   SomeEnum myEnum
}

enum SomeEnum{
A,
B
}

resources.xml:

   <dwr:configuration>
        <dwr:convert type="bean" class="com.example.**">
            <dwr:exclude method="metaClass"/>
        </dwr:convert>
        <dwr:convert type="enum" class="com.example.SomeEnum">
            <dwr:exclude method="metaClass"/>
        </dwr:convert>
    </dwr:configuration>

However, when I call MyService.myMethod({myEnum: "A"}), I'm receiving Throwable throwable. What's going on?


That's all correct. If you have some other exception, you'll get the generic Error error prompt unless you enable marshalling of exceptions.

If you add this to your configuration:

<dwr:configuration>
    <dwr:convert class="java.lang.Exception" type="exception"/>
    <dwr:convert class="java.lang.StackTraceElement" type="bean"/>
</dwr:configuration>

You'll probably see an error that isn't marshalling related.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜