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: * This class represents a HTTP Request.
16: *
17: * @see com.gwtext.client.core.Connection#request(RequestParam)
18: */
19: public class RequestParam extends JsObject {
20:
21: public RequestParam() {
22: jsObj = JavaScriptObjectHelper.createObject();
23: }
24:
25: /**
26: * The URL of the request.
27: *
28: * @param url the rul
29: */
30: public void setUrl(String url) {
31: JavaScriptObjectHelper.setAttribute(jsObj, "url", url);
32: }
33:
34: /**
35: * The request paameters.
36: *
37: * @param params the request parameters
38: */
39: public void setParams(UrlParam[] params) {
40: JavaScriptObject paramObj = UrlParam.getJsObj(params);
41: JavaScriptObjectHelper.setAttribute(jsObj, "params", paramObj);
42: }
43:
44: /**
45: * The request method (GET or POST).
46: *
47: * @param method the request method
48: */
49: public void setMethod(Connection.Method method) {
50: JavaScriptObjectHelper.setAttribute(jsObj, "method", method
51: .getMethod());
52: }
53:
54: /**
55: * The ID of the form that you want to use. The request parameters will include the Form's field names and values.
56: *
57: * @param formId the form ID
58: */
59: public void setForm(String formId) {
60: JavaScriptObjectHelper.setAttribute(jsObj, "form", formId);
61: }
62:
63: /**
64: * Does the form do a file upload.
65: *
66: * @param isUpload true if file upload
67: */
68: public void setIsUpload(boolean isUpload) {
69: JavaScriptObjectHelper
70: .setAttribute(jsObj, "isUpload", isUpload);
71: }
72:
73: /**
74: * The headers to pass with the request.
75: *
76: * @param defaultHeaders the headers
77: */
78: public void setHeaders(NameValuePair[] defaultHeaders) {
79: JavaScriptObject paramObj = NameValuePair
80: .getJsObj(defaultHeaders);
81: JavaScriptObjectHelper.setAttribute(jsObj, "headers", paramObj);
82: }
83: }
|