문제

I'd like to know whether the image has been modified since some time using GWT. I've found that setting If-Modified-Since http header might work, so I tried to do it like in this post:

RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, "http://www.site.com/pic1.jpg");
rb.setHeader("If-Modified-Since", "Sat, 17 Nov 2012 16:17:00 GMT");
Request r = rb.sendRequest(null, new RequestCallback() {
    public void onResponseReceived(Request request, Response response){
         int i = response.getStatusCode();
         ...
    }

    public void onError(Request request, Throwable exception){
        ...
    }

});

The problem is that I get a status code equals to 0. Could you please tell me what am I doing wrong? Is this a good way to know if the file on server has been modified, or, are there any other ways using GWT? Thanks.

도움이 되었습니까?

해결책

It can be due to SOP as you wrote in comment. You can create php function and then call this function from GWT.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top