POJO到Google App Engine中的XML字符串? [英] POJO to an XML string in Google App Engine?

查看:173
本文介绍了POJO到Google App Engine中的XML字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的Java Google App Engine程序创建一个REST接口。我想我会从我的POJOS生成一些XML开始。但是,似乎XStream被GAE的限制所困扰。



我可以在Google App Engine中使用什么来生成XML字符串?



谢谢。

编辑1:
这是异常的开始:

  javax.servlet.ServletContext log:分派传入RPC调用时的异常
com.google.gwt.user.server.rpc.UnexpectedException:服务方法'public abstract java。 lang.String com.mydomain.client.ObjectService.sendObject(com.mydomain.client.models.myobject)'抛出一个意外的异常:java.security.AccessControlException:访问被拒绝(java.io.SerializablePermission enableSubclassImplementation)


解决方案

异常是由java.io.SerializablePermission引起的,它根据javadoc允许:



的子类实现ObjectOutputStream或
ObjectInputStream来覆盖
分别是
对象的默认序列化或
反序列化

XStream可能使用对象流并且不会被授予此权限。



Google App Engine实际上是否有白名单,或者只是一组受限制的权限? JAXB2不使用Object流,所以你真的尝试过吗?


I would like to create a REST interface for my Java Google App Engine program. I figured I would start by generating some XML from my POJOS. However, it seems that XStream is bitten by GAE's restrictions.

What can I use to generate an XML string in Google App Engine?

Thanks.

Edit 1: Here is the beginning of the exception:

javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract    java.lang.String com.mydomain.client.ObjectService.sendObject(com.mydomain.client.models.myobject)' threw an unexpected exception: java.security.AccessControlException: access denied (java.io.SerializablePermission enableSubclassImplementation)

解决方案

The exception is caused by a java.io.SerializablePermission, which according the javadoc is for allowing:

Subclass implementation of ObjectOutputStream or ObjectInputStream to override the default serialization or deserialization, respectively, of objects

XStream might be using Object streams under the covers, and falling foul of this permission not being granted.

Does Google App Engine actually have a whitelist, or just a set of restricted permissions? JAXB2 doesn't use Object streams, so have you actually tried that?

这篇关于POJO到Google App Engine中的XML字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆