Source Code Cross Referenced for Connection.java in  » Ajax » gwtext-2.01 » com » gwtext » client » core » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » gwtext 2.01 » com.gwtext.client.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GWT-Ext Widget Library
003:         * Copyright(c) 2007-2008, GWT-Ext.
004:         * licensing@gwt-ext.com
005:         * 
006:         * http://www.gwt-ext.com/license
007:         */
008:
009:        package com.gwtext.client.core;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.gwtext.client.core.event.ConnectionListener;
013:
014:        /**
015:         * The class encapsulates a connection to the page's originating domain, allowing requests to be made either to a configured URL, or to a URL specified at request time.
016:         * Requests made by this class are asynchronous, and will return immediately. No data from the server will be available to the statement immediately following the request call. To process returned data, use a callback in the request options object, or an event listener.
017:         * Note: If you are doing a file upload, you will not get a normal response object sent back to your callback or event handler. Since the upload is handled via in IFRAME, there is no XMLHttpRequest. The response object is created using the innerHTML of the IFRAME's document as the responseText property and, if present, the IFRAME's XML document as the responseXML property.
018:         * This means that a valid XML or HTML document must be returned. If JSON data is required, it is suggested that it be placed either inside a <textarea> in an HTML document and retrieved from the responseText using a regex, or inside a CDATA section in an XML document and retrieved from the responseXML using standard DOM methods.
019:         */
020:        public class Connection extends JsObject {
021:
022:            /**
023:             * HTTP request method constants.
024:             */
025:            public static final class Method {
026:                private final String name;
027:
028:                private Method(String name) {
029:                    this .name = name;
030:                }
031:
032:                public String getMethod() {
033:                    return name;
034:                }
035:
036:                public String toString() {
037:                    return name;
038:                }
039:            }
040:
041:            /**
042:             * Specifies that the HTTP GET method should be used.
043:             */
044:            public static final Method GET = new Method("GET");
045:
046:            /**
047:             * Specifies that the HTTP POST method should be used.
048:             */
049:            public static final Method POST = new Method("POST");
050:
051:            protected Connection() {
052:            }
053:
054:            /**
055:             * Constructs a Connection using a native connection object.
056:             *
057:             * @param jsObj native connection object
058:             */
059:            public Connection(JavaScriptObject jsObj) {
060:                super (jsObj);
061:            }
062:
063:            /**
064:             * Constructs a Connection using the configuration parameters passed.
065:             *
066:             * @param config the connection config
067:             */
068:            public Connection(ConnectionConfig config) {
069:                jsObj = create(config.getJsObj());
070:            }
071:
072:            private native JavaScriptObject create(JavaScriptObject config) /*-{
073:                   return new $wnd.Ext.data.Connection(config);
074:               }-*/;
075:
076:            /**
077:             * Aborts the last outstanding request.
078:             */
079:            public native void abort() /*-{
080:                   var conn = this.@com.gwtext.client.core.JsObject::getJsObj()();
081:                   conn.abort();
082:               }-*/;
083:
084:            /**
085:             * Aborts any outstanding request.
086:             *
087:             * @param transactionId the transaction to abort
088:             */
089:            public native void abort(long transactionId) /*-{
090:                   var conn = this.@com.gwtext.client.core.JsObject::getJsObj()();
091:                   conn.abort(transactionId);
092:               }-*/;
093:
094:            /**
095:             * Determine whether this object has a request outstanding.
096:             *
097:             * @return true if loading
098:             */
099:            public native boolean isLoading() /*-{
100:                   var conn = this.@com.gwtext.client.core.JsObject::getJsObj()();
101:                   return conn.isLoading();
102:               }-*/;
103:
104:            /**
105:             * Determine whether the specified transaction has a request outstanding.
106:             *
107:             * @param transactionId the transaction id
108:             * @return true if loading
109:             */
110:            public native boolean isLoading(long transactionId) /*-{
111:                   var conn = this.@com.gwtext.client.core.JsObject::getJsObj()();
112:                   return conn.isLoading(transactionId);
113:               }-*/;
114:
115:            /**
116:             * Sends an HTTP request to a remote server.
117:             *
118:             * @return the transaction id
119:             */
120:            public native long request() /*-{
121:                   var conn = this.@com.gwtext.client.core.JsObject::getJsObj()();
122:                   var transId =  conn.request();
123:                   return transId == null || transId === undefined ? -1 : transId;
124:               }-*/;
125:
126:            /**
127:             * Sends an HTTP request to a remote server.
128:             *
129:             * @param param the request params
130:             * @return the transaction id
131:             */
132:            public native long request(RequestParam param) /*-{
133:                   var conn = this.@com.gwtext.client.core.JsObject::getJsObj()();
134:                   var paramJS = param.@com.gwtext.client.core.JsObject::getJsObj()();
135:                   var transId = conn.request(paramJS);
136:                   return transId == null || transId === undefined ? -1 : transId;
137:               }-*/;
138:
139:            /**
140:             * Adds a connection listener to this connection object.
141:             *
142:             * @param listener the connection listener
143:             */
144:            public native void addListener(ConnectionListener listener)/*-{
145:                    var conn = this.@com.gwtext.client.core.JsObject::getJsObj()();
146:                    var connJ = this;
147:
148:                    conn.addListener('beforerequest',
149:                            function(conn, options) {
150:                                return listener.@com.gwtext.client.core.event.ConnectionListener::doBeforeRequest(Lcom/gwtext/client/core/Connection;)(connJ);
151:                            }
152:                    );
153:
154:                    conn.addListener('requestcomplete',
155:                            function(conn, response, options) {
156:                                return listener.@com.gwtext.client.core.event.ConnectionListener::onRequestComplete(Lcom/gwtext/client/core/Connection;Ljava/lang/String;)(connJ, response.responseText);
157:                            }
158:                    );
159:
160:                    conn.addListener('requestexception',
161:                            function(conn, response, options) {
162:                                return listener.@com.gwtext.client.core.event.ConnectionListener::onRequestException(Lcom/gwtext/client/core/Connection;ILjava/lang/String;)(connJ, response.status, response.responseText);
163:                            }
164:                    );
165:                }-*/;
166:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.