小编Pat*_*ier的帖子

在GWT中获取com.google.gwt.user.client.rpc.StatusCodeException:0

我有时/经常在GWT中获得此异常,但不知道原因:

SEVERE: com.google.gwt.user.client.rpc.StatusCodeException: 0 
java.lang.RuntimeException: com.google.gwt.user.client.rpc.StatusCodeException: 0 
    at Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_Throwable_2V(Unknown Source)
    at Unknown.de_ctech24_simplynews_web_client_util_SimpleCallback_$onFailure__Lde_ctech24_simplynews_web_client_util_SimpleCallback_2Ljava_lang_Throwable_2V(Unknown Source)
    at Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_$onResponseReceived__Lcom_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_2Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown Source)
    at Unknown.<anonymous>(Unknown Source)
    at Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)
Caused by: com.google.gwt.user.client.rpc.StatusCodeException: 0 
    at Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_String_2Ljava_lang_Throwable_2V(Unknown Source)
    at Unknown.com_google_gwt_user_client_rpc_StatusCodeException_StatusCodeException__ILjava_lang_String_2V(Unknown Source)
    at Unknown.com_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_$onResponseReceived__Lcom_google_gwt_user_client_rpc_impl_RequestCallbackAdapter_2Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_Response_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_Request_$fireOnResponseReceived__Lcom_google_gwt_http_client_Request_2Lcom_google_gwt_http_client_RequestCallback_2V(Unknown Source)
    at Unknown.com_google_gwt_http_client_RequestBuilder$1_onReadyStateChange__Lcom_google_gwt_xhr_client_XMLHttpRequest_2V(Unknown Source)
    at Unknown.<anonymous>(Unknown Source)
    at Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(Unknown Source)
Run Code Online (Sandbox Code Playgroud)

花了一些时间谷歌后我发现了这个:http://www.mail-archive.com/google-web-toolkit@googlegroups.com/msg79537.html

有一个有趣的提示:如果您断开WLAN并再次连接,则会出现这种情况 - 然后出现错误.我在我的笔记本上尝试了这个 - 然后发生异常.

另一个问题是有时会出现这种异常(并非总是在同一时间或执行特定操作时 - 所以看似随机),尽管网络连接正常.我不知道为什么会发生这种情况,也不知道处理它的正确方法是什么 - 确保我能抓住并忽略它.但是请求永远不会进入服务器并且不执行操作 - 不是很好的错误处理.

关于这个应用程序的一些数据 - 这可能有助于缩小或希望解决问题: …

gwt gwt-rpc gxt cloudflare

9
推荐指数
1
解决办法
1万
查看次数

使用Spring MVC + Freemarker处理用户特定日期/时区转换的最佳方法

我想显示使用用户时区格式化的存储日期(时区为UTC)(可能因用户而异,并存储在配置文件中).

我提出的解决方案是以下一个,我想知道这是否是最好的方法,或者是否有另一个,可能更简单的解决方案.

时区设置为UTC:

-Duser.timezone=UTC
Run Code Online (Sandbox Code Playgroud)

控制器,Freemarker-Template,HandlerInterceptor:

控制器:

@Controller
@RequestMapping("/test")
public class TestController {

        @RequestMapping
        public String dateTest(Model model){
                final Date date = new Date();
                model.addAttribute("formattedDate", new SimpleDateFormat("hh:mm:ss").format(date));
                model.addAttribute("date", date);              
                return "test";
        }
}
Run Code Online (Sandbox Code Playgroud)

Freemarker的,模板:

<#setting time_zone="${currentTimeZone}">

UTC Time: ${formattedDate}<br/>
Localized time for timezone <i>${currentTimeZone}</i>: ${date?time}
Run Code Online (Sandbox Code Playgroud)

HandlerInterceptor接口:

public class TimezoneHandlerInterceptor extends HandlerInterceptorAdapter{

        @Override
        public void postHandle(HttpServletRequest request,
                        HttpServletResponse response, Object handler,
                        ModelAndView modelAndView) throws Exception {

                //Only for testing, in production something like: 
                //final String currentUserTimezone = userService.getCurrentUser().getTimezoneId(); …
Run Code Online (Sandbox Code Playgroud)

java spring freemarker date spring-mvc

5
推荐指数
1
解决办法
4808
查看次数

弹性搜索渗透反应评分

现在的情况

我正在使用elasticsearch的percolate功能.它运作良好 - 我得到匹配的percolate-ids返回一个新文档,并可以构建基本上反向搜索.到目前为止一切都很棒.

问题

问题出在这里:我希望得到一个分数,表示给定文档与过滤器查询的匹配程度(正常查询给出的分数).要做到这一点,我添加了track_scores,但没有运气.

我在文档中找到了这个track_scores:

...分数基于查询并表示查询如何与percolate查询的元数据匹配,而不是如何将渗透的文档与查询匹配...

我想要/甚至需要什么?

显示问题的示例

这里有一个展示问题的样本(取自elasticsearch.org).1.0无论输入文档如何,在此处,percolate-response返回的分数始终为:

//Index the percolator
curl -XPUT 'localhost:9200/my-index/.percolator/1' -d '{
    "query" : {
        "match" : {
            "message" : "bonsai tree"
        }
    }
}'
Run Code Online (Sandbox Code Playgroud)

渗透第一份文件:

curl -XGET 'localhost:9200/my-index/message/_percolate' -d '{
    "doc" : {
        "message" : "A new bonsai tree in the office"
    },
    "track_scores" : "true"
}'


//...returns
{"took": 1, "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
}, "total": 1, "matches": [
    { …
Run Code Online (Sandbox Code Playgroud)

elasticsearch elasticsearch-percolate

5
推荐指数
1
解决办法
954
查看次数