01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08:
09: package com.gwtext.client.core;
10:
11: import com.google.gwt.core.client.JavaScriptObject;
12: import com.gwtext.client.util.JavaScriptObjectHelper;
13:
14: /**
15: * Connection configuration class.
16: */
17: public class ConnectionConfig extends BaseConfig {
18:
19: /**
20: * Whether this request should abort any pending requests.
21: *
22: * @param autoAbort defaults to false
23: */
24: public void setAutoAbort(boolean autoAbort) {
25: JavaScriptObjectHelper.setAttribute(jsObj, "autoAbort",
26: autoAbort);
27: }
28:
29: /**
30: * Request headers which are added to each request made by this object.
31: *
32: * @param defaultHeaders default headers
33: */
34: public void setDefaultHeaders(NameValuePair[] defaultHeaders) {
35: JavaScriptObject paramObj = NameValuePair
36: .getJsObj(defaultHeaders);
37: JavaScriptObjectHelper.setAttribute(jsObj, "defaultHeaders",
38: paramObj);
39: }
40:
41: /**
42: * Properties which are used as extra parameters to each request made by this object.
43: *
44: * @param params request parameters
45: */
46: public void setExtraParams(UrlParam[] params) {
47: JavaScriptObject paramObj = UrlParam.getJsObj(params);
48: JavaScriptObjectHelper.setAttribute(jsObj, "extraParams",
49: paramObj);
50: }
51:
52: /**
53: * Sets the method (GET or POST) for the operation.
54: *
55: * @param method the method
56: * @see com.gwtext.client.core.Connection#GET
57: * @see com.gwtext.client.core.Connection#POST
58: */
59: public void setMethod(Connection.Method method) {
60: JavaScriptObjectHelper.setAttribute(jsObj, "method", method
61: .getMethod());
62: }
63:
64: /**
65: * The timeout in milliseconds to be used for requests. (defaults to 30000)
66: *
67: * @param timeout timout
68: */
69: public void setTimeout(int timeout) {
70: JavaScriptObjectHelper.setAttribute(jsObj, "timeout", timeout);
71: }
72:
73: /**
74: * The default URL to be used for requests to the server.
75: *
76: * @param url defaults to undefined
77: */
78: public void setUrl(String url) {
79: JavaScriptObjectHelper.setAttribute(jsObj, "url", url);
80: }
81: }
|