我正在研究GWT and OSGi+PAX-Web问题的解决方案。特殊的问题是GWT无法加载序列化策略文件,并出现以下错误:ERROR: The serialization policy file '/ctx/ctx/6ExxxxxxxxxxxxxxxxF.gwt.rpc' was not found; did you forget to include it in this deployment?
问题出在Equinox OSGi和PAX-WEB之间。
为了找到解决方案,我想更好地了解GWT-RPC如何加载序列化策略文件。
(免责声明:我已阅读了生成的文件[2]上的gwt文档。我正在寻找更多低级详细信息:我给我们的印象是我们必须处理HttpContext.getResource()时出错。
最佳答案
全部都在RemoteServiceServlet
中。
What is their lifecycle? When are they loaded? (I see it's on server startup. Any particularities in the lifecycle? Reload?)
它们是在首次使用时(收到第一个请求)加载的,并缓存在servlet的字段中,因此它们的生命周期与servlet本身有关。
How GWT loads this file in its stack? At what point in the call stack of a request? How does GWT knows where to load them from? Can I tell GWT where it should look for this file?
servlet.getServletContext().getResourceAsStream
。您可以通过覆盖doGetSerializationPolicy
进行自定义(如JavaDoc中所述)。文件名(资源URL)是根据请求的路径和
X-GWT-Permutation
请求 header 构建的。
关于gwt - GWT RPC如何加载序列化策略文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11140372/