Revision 8ddb4627 src/gr/grnet/pithos/web/client/rest/GetRequest.java

b/src/gr/grnet/pithos/web/client/rest/GetRequest.java
35 35

  
36 36
package gr.grnet.pithos.web.client.rest;
37 37

  
38
import gr.grnet.pithos.web.client.Pithos;
38 39
import gr.grnet.pithos.web.client.Resource;
39 40

  
40 41
import java.util.HashMap;
......
82 83

  
83 84
    public GetRequest(Class<T> resourceClass, String api, String owner, String path) {
84 85
        this(resourceClass, api, owner, path, -1, null);
85
        LOG("GetRequest() resourceClass = ", resourceClass.getName(), ", api=", api, ", owner=", owner, ", path=", path);
86
        Pithos.LOG("GetRequest() resourceClass = ", resourceClass.getName(), ", api=", api, ", owner=", owner, ", path=", path);
86 87
    }
87 88

  
88 89
    public GetRequest(Class<T> resourceClass, String api, String owner, String path, T result) {
89 90
        this(resourceClass, api, owner, path, -1, result);
90 91
    }
91 92

  
92
    static native void __ConsoleLog(String message) /*-{
93
      try {
94
        console.log(message);
95
      } catch (e) {
96
      }
97
    }-*/;
98

  
99
    public static void LOG(Object ...args) {
100
        if(false) {
101
            final StringBuilder sb = new StringBuilder();
102
            for(Object arg : args) {
103
                sb.append(arg);
104
            }
105
            if(sb.length() > 0) {
106
                __ConsoleLog(sb.toString());
107
            }
108
        }
109
    }
110

  
111 93
    @Override
112 94
    public void execute() {
113 95
    	if (path.contains("?"))
114 96
    		path += "&t=" + System.currentTimeMillis();
115 97
    	else
116 98
    		path += "?t=" + System.currentTimeMillis();
117
        LOG("GET api = ", api, ", owner = ", owner, ", path = ", path);
118
        LOG("   ==> ", api + owner + path);
99
        Pithos.LOG("GET api = ", api, ", owner = ", owner, ", path = ", path);
100
        Pithos.LOG("   ==> ", api + owner + path);
119 101
        RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, api + owner + path);
120 102

  
121 103
        for (String header : headers.keySet()) {
......
137 119
                public void onError(Request request, Throwable throwable) {
138 120
                    if (throwable instanceof RestException) {
139 121
                        if (((RestException) throwable).getHttpStatusCode() == 304 && result != null){
140
                            GWT.log("Using cache: " + result.toString(), null);
122
                            Pithos.LOG("Using cache: ", result.toString());
141 123
                            onSuccess(result);
142 124
                            return;
143 125
                        }
......
153 135
            retries++;
154 136
        }
155 137
        catch (RequestException e) {
156
            LOG("Error in GetRequest: ", e.toString());
138
            Pithos.LOG("Error in GetRequest", e);
157 139
        }
158 140
    }
159 141

  

Also available in: Unified diff