Source Code Cross Referenced for Request.java in  » Ajax » dwr » jsx3 » net » 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 » dwr » jsx3.net 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Joe Walker
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package jsx3.net;
017:
018:        import org.directwebremoting.ScriptBuffer;
019:        import org.directwebremoting.proxy.ScriptProxy;
020:        import org.directwebremoting.proxy.io.Context;
021:
022:        /**
023:         * A generic wrapper to hide the complexities and API-specifics of the native XMLHTTP control for a given browser.
024:         Developers wishing to create/modify XML documents can use this class to access common XMLHTTP methods.
025:
026:         Note that when using this interface to post xml content to a server, the called server may expect the content
027:         type to be set for the posting.  For example,
028:         objRequest.setRequestHeader("Content-Type", "text/xml");
029:         * @author Joe Walker [joe at getahead dot org]
030:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
031:         */
032:        public class Request extends jsx3.lang.Object {
033:            /**
034:             * All reverse ajax proxies need context to work from
035:             * @param scriptProxy The place we are writing scripts to
036:             * @param context The script that got us to where we are now
037:             */
038:            public Request(Context context, String extension,
039:                    ScriptProxy scriptProxy) {
040:                super (context, extension, scriptProxy);
041:            }
042:
043:            /**
044:             * The instance initializer.
045:             * @param id <span style="text-decoration:line-through;">If the call will be asynchronous, assigns a unique identifier.</span>
046:             */
047:            public Request(String id) {
048:                super ((Context) null, (String) null, (ScriptProxy) null);
049:                ScriptBuffer script = new ScriptBuffer();
050:                script.appendCall("new Request", id);
051:                setInitScript(script);
052:            }
053:
054:            /**
055:             * Event type published when the response has loaded.
056:             */
057:            public static final String EVENT_ON_RESPONSE = "response";
058:
059:            /**
060:             * Event type published when the server has not responded after the specified timeout period.
061:             */
062:            public static final String EVENT_ON_TIMEOUT = "timeout";
063:
064:            /**
065:             * Aborts the request.
066:             * @return this object.
067:             */
068:            @SuppressWarnings("unchecked")
069:            public jsx3.net.Request abort() {
070:                String extension = "abort().";
071:                try {
072:                    java.lang.reflect.Constructor<jsx3.net.Request> ctor = jsx3.net.Request.class
073:                            .getConstructor(Context.class, String.class,
074:                                    ScriptProxy.class);
075:                    return ctor.newInstance(this , extension, getScriptProxy());
076:                } catch (Exception ex) {
077:                    throw new IllegalArgumentException("Unsupported type: "
078:                            + jsx3.net.Request.class.getName());
079:                }
080:            }
081:
082:            /**
083:             * Gets the value of all the HTTP headers.
084:             */
085:            @SuppressWarnings("unchecked")
086:            public void getAllResponseHeaders(
087:                    org.directwebremoting.proxy.Callback<String> callback) {
088:                ScriptBuffer script = new ScriptBuffer();
089:                String callbackPrefix = "";
090:
091:                if (callback != null) {
092:                    callbackPrefix = "var reply = ";
093:                }
094:
095:                script.appendCall(callbackPrefix + getContextPath()
096:                        + "getAllResponseHeaders");
097:
098:                if (callback != null) {
099:                    String key = org.directwebremoting.extend.CallbackHelper
100:                            .saveCallback(callback, String.class);
101:                    script
102:                            .appendCall("__System.activateCallback", key,
103:                                    "reply");
104:                }
105:
106:                getScriptProxy().addScript(script);
107:            }
108:
109:            /**
110:             * Gets the value of a specific HTTP response header.
111:             * @param strName the name for the response header to retrieve.
112:             */
113:            @SuppressWarnings("unchecked")
114:            public void getResponseHeader(String strName,
115:                    org.directwebremoting.proxy.Callback<String> callback) {
116:                ScriptBuffer script = new ScriptBuffer();
117:                String callbackPrefix = "";
118:
119:                if (callback != null) {
120:                    callbackPrefix = "var reply = ";
121:                }
122:
123:                script.appendCall(callbackPrefix + getContextPath()
124:                        + "getResponseHeader", strName);
125:
126:                if (callback != null) {
127:                    String key = org.directwebremoting.extend.CallbackHelper
128:                            .saveCallback(callback, String.class);
129:                    script
130:                            .appendCall("__System.activateCallback", key,
131:                                    "reply");
132:                }
133:
134:                getScriptProxy().addScript(script);
135:            }
136:
137:            /**
138:             * Gets the HTTP response line status (e.g. "OK").
139:             */
140:            @SuppressWarnings("unchecked")
141:            public void getStatusText(
142:                    org.directwebremoting.proxy.Callback<String> callback) {
143:                ScriptBuffer script = new ScriptBuffer();
144:                String callbackPrefix = "";
145:
146:                if (callback != null) {
147:                    callbackPrefix = "var reply = ";
148:                }
149:
150:                script.appendCall(callbackPrefix + getContextPath()
151:                        + "getStatusText");
152:
153:                if (callback != null) {
154:                    String key = org.directwebremoting.extend.CallbackHelper
155:                            .saveCallback(callback, String.class);
156:                    script
157:                            .appendCall("__System.activateCallback", key,
158:                                    "reply");
159:                }
160:
161:                getScriptProxy().addScript(script);
162:            }
163:
164:            /**
165:             * Gets the HTTP response code (e.g. 200, 404, 500, etc).
166:             */
167:            @SuppressWarnings("unchecked")
168:            public void getStatus(
169:                    org.directwebremoting.proxy.Callback<Integer> callback) {
170:                ScriptBuffer script = new ScriptBuffer();
171:                String callbackPrefix = "";
172:
173:                if (callback != null) {
174:                    callbackPrefix = "var reply = ";
175:                }
176:
177:                script.appendCall(callbackPrefix + getContextPath()
178:                        + "getStatus");
179:
180:                if (callback != null) {
181:                    String key = org.directwebremoting.extend.CallbackHelper
182:                            .saveCallback(callback, Integer.class);
183:                    script
184:                            .appendCall("__System.activateCallback", key,
185:                                    "reply");
186:                }
187:
188:                getScriptProxy().addScript(script);
189:            }
190:
191:            /**
192:             * Gets the content of the response as string.
193:             */
194:            @SuppressWarnings("unchecked")
195:            public void getResponseText(
196:                    org.directwebremoting.proxy.Callback<String> callback) {
197:                ScriptBuffer script = new ScriptBuffer();
198:                String callbackPrefix = "";
199:
200:                if (callback != null) {
201:                    callbackPrefix = "var reply = ";
202:                }
203:
204:                script.appendCall(callbackPrefix + getContextPath()
205:                        + "getResponseText");
206:
207:                if (callback != null) {
208:                    String key = org.directwebremoting.extend.CallbackHelper
209:                            .saveCallback(callback, String.class);
210:                    script
211:                            .appendCall("__System.activateCallback", key,
212:                                    "reply");
213:                }
214:
215:                getScriptProxy().addScript(script);
216:            }
217:
218:            /**
219:             * Gets the content of the response as an XML document. If the response is not a valid XML document,
220:            null is returned.
221:             */
222:            @SuppressWarnings("unchecked")
223:            public jsx3.xml.CdfDocument getResponseXML() {
224:                String extension = "getResponseXML().";
225:                try {
226:                    java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
227:                            .getConstructor(Context.class, String.class,
228:                                    ScriptProxy.class);
229:                    return ctor.newInstance(this , extension, getScriptProxy());
230:                } catch (Exception ex) {
231:                    throw new IllegalArgumentException("Unsupported type: "
232:                            + jsx3.xml.CdfDocument.class.getName());
233:                }
234:            }
235:
236:            /**
237:             * Gets the content of the response as an XML document. If the response is not a valid XML document,
238:            null is returned.
239:             * @param returnType The expected return type
240:             */
241:            @SuppressWarnings("unchecked")
242:            public <T> T getResponseXML(Class<T> returnType) {
243:                String extension = "getResponseXML().";
244:                try {
245:                    java.lang.reflect.Constructor<T> ctor = returnType
246:                            .getConstructor(Context.class, String.class,
247:                                    ScriptProxy.class);
248:                    return ctor.newInstance(this , extension, getScriptProxy());
249:                } catch (Exception ex) {
250:                    throw new IllegalArgumentException(
251:                            "Unsupported return type: " + returnType.getName());
252:                }
253:            }
254:
255:            /**
256:             * Sets the value of a specific HTTP request header. The open() method should be called before calling
257:            this method.
258:             * @param strName the name for the request header to send to the server with the request content.
259:             * @param strValue the value for the request header to send to the server with the request content.
260:             * @return this object.
261:             */
262:            public jsx3.net.Request setRequestHeader(String strName,
263:                    String strValue) {
264:                ScriptBuffer script = new ScriptBuffer();
265:                script.appendCall(getContextPath() + "setRequestHeader",
266:                        strName, strValue);
267:                getScriptProxy().addScript(script);
268:                return this ;
269:            }
270:
271:            /**
272:             * Initializes the request, and specifies the method, URL, and authentication information for the request.
273:             * @param strMethod The HTTP method used to open the connection. Valid values include: GET, POST, or PUT.
274:             * @param strURL The requested URL. This can be either an absolute URL, such as "http://www.TIBCO.com", or a relative URL, such as "../MyPath/MyFile".
275:             * @param bAsync whether to issue the request asynchronously, if true this class will use the EventDispatcher interface to publish an event on response or timeout.
276:             * @param strUser The name of the user for authentication. If this parameter is null ("") or missing and the site requires authentication, the native HTTP control will display a logon window.
277:             * @param strPass The password for authentication. This parameter is ignored if the user parameter is null ("") or missing.
278:             * @return this object.
279:             */
280:            @SuppressWarnings("unchecked")
281:            public jsx3.net.Request open(String strMethod, java.net.URI strURL,
282:                    boolean bAsync, String strUser, String strPass) {
283:                String extension = "open(\"" + strMethod + "\", \"" + strURL
284:                        + "\", \"" + bAsync + "\", \"" + strUser + "\", \""
285:                        + strPass + "\").";
286:                try {
287:                    java.lang.reflect.Constructor<jsx3.net.Request> ctor = jsx3.net.Request.class
288:                            .getConstructor(Context.class, String.class,
289:                                    ScriptProxy.class);
290:                    return ctor.newInstance(this , extension, getScriptProxy());
291:                } catch (Exception ex) {
292:                    throw new IllegalArgumentException("Unsupported type: "
293:                            + jsx3.net.Request.class.getName());
294:                }
295:            }
296:
297:            /**
298:             * Initializes the request, and specifies the method, URL, and authentication information for the request.
299:             * @param strMethod The HTTP method used to open the connection. Valid values include: GET, POST, or PUT.
300:             * @param strURL The requested URL. This can be either an absolute URL, such as "http://www.TIBCO.com", or a relative URL, such as "../MyPath/MyFile".
301:             * @param bAsync whether to issue the request asynchronously, if true this class will use the EventDispatcher interface to publish an event on response or timeout.
302:             * @param strUser The name of the user for authentication. If this parameter is null ("") or missing and the site requires authentication, the native HTTP control will display a logon window.
303:             * @param strPass The password for authentication. This parameter is ignored if the user parameter is null ("") or missing.
304:             * @return this object.
305:             */
306:            @SuppressWarnings("unchecked")
307:            public jsx3.net.Request open(String strMethod, String strURL,
308:                    boolean bAsync, String strUser, String strPass) {
309:                String extension = "open(\"" + strMethod + "\", \"" + strURL
310:                        + "\", \"" + bAsync + "\", \"" + strUser + "\", \""
311:                        + strPass + "\").";
312:                try {
313:                    java.lang.reflect.Constructor<jsx3.net.Request> ctor = jsx3.net.Request.class
314:                            .getConstructor(Context.class, String.class,
315:                                    ScriptProxy.class);
316:                    return ctor.newInstance(this , extension, getScriptProxy());
317:                } catch (Exception ex) {
318:                    throw new IllegalArgumentException("Unsupported type: "
319:                            + jsx3.net.Request.class.getName());
320:                }
321:            }
322:
323:            /**
324:             * Gets the URL passed when opening this request.
325:             */
326:            @SuppressWarnings("unchecked")
327:            public void getURL(
328:                    org.directwebremoting.proxy.Callback<String> callback) {
329:                ScriptBuffer script = new ScriptBuffer();
330:                String callbackPrefix = "";
331:
332:                if (callback != null) {
333:                    callbackPrefix = "var reply = ";
334:                }
335:
336:                script.appendCall(callbackPrefix + getContextPath() + "getURL");
337:
338:                if (callback != null) {
339:                    String key = org.directwebremoting.extend.CallbackHelper
340:                            .saveCallback(callback, String.class);
341:                    script
342:                            .appendCall("__System.activateCallback", key,
343:                                    "reply");
344:                }
345:
346:                getScriptProxy().addScript(script);
347:            }
348:
349:            /**
350:             * Sends the request.
351:             * @param strContent The content to send for a POST request.
352:             * @param intTimeout the number milliseconds to wait before publishing a timeout event. This only applies
353:            to asynchronous requests. If used, subscribe to the <code>jsx3.net.Request.EVENT_ON_TIMEOUT</code> event to
354:            be notified of a timeout.
355:             * @return this object.
356:             */
357:            @SuppressWarnings("unchecked")
358:            public jsx3.net.Request send(String strContent, int intTimeout) {
359:                String extension = "send(\"" + strContent + "\", \""
360:                        + intTimeout + "\").";
361:                try {
362:                    java.lang.reflect.Constructor<jsx3.net.Request> ctor = jsx3.net.Request.class
363:                            .getConstructor(Context.class, String.class,
364:                                    ScriptProxy.class);
365:                    return ctor.newInstance(this , extension, getScriptProxy());
366:                } catch (Exception ex) {
367:                    throw new IllegalArgumentException("Unsupported type: "
368:                            + jsx3.net.Request.class.getName());
369:                }
370:            }
371:
372:            /**
373:             * Publishes an event to all subscribed objects.
374:             * @param objEvent the event, should have at least a field 'subject' that is the event id, another common field is 'target' (target will default to this instance)
375:             * @param callback the number of listeners to which the event was broadcast
376:             */
377:            @SuppressWarnings("unchecked")
378:            public void publish(jsx3.lang.Object objEvent,
379:                    org.directwebremoting.proxy.Callback<Integer> callback) {
380:                ScriptBuffer script = new ScriptBuffer();
381:                String callbackPrefix = "";
382:
383:                if (callback != null) {
384:                    callbackPrefix = "var reply = ";
385:                }
386:
387:                script
388:                        .appendCall(callbackPrefix + getContextPath()
389:                                + "publish", objEvent);
390:
391:                if (callback != null) {
392:                    String key = org.directwebremoting.extend.CallbackHelper
393:                            .saveCallback(callback, Integer.class);
394:                    script
395:                            .appendCall("__System.activateCallback", key,
396:                                    "reply");
397:                }
398:
399:                getScriptProxy().addScript(script);
400:            }
401:
402:            /**
403:             * Subscribes an object or function to a type of event published by this object.
404:
405:            As of version 3.4 a string value for objHandler is deprecated.
406:             * @param strEventId the event type(s).
407:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
408:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
409:             */
410:            public void subscribe(Object[] strEventId,
411:                    jsx3.lang.Object objHandler,
412:                    org.directwebremoting.proxy.CodeBlock objFunction) {
413:                ScriptBuffer script = new ScriptBuffer();
414:                script.appendCall(getContextPath() + "subscribe", strEventId,
415:                        objHandler, objFunction);
416:                getScriptProxy().addScript(script);
417:            }
418:
419:            /**
420:             * Subscribes an object or function to a type of event published by this object.
421:
422:            As of version 3.4 a string value for objHandler is deprecated.
423:             * @param strEventId the event type(s).
424:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
425:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
426:             */
427:            public void subscribe(String strEventId,
428:                    jsx3.lang.Object objHandler, String objFunction) {
429:                ScriptBuffer script = new ScriptBuffer();
430:                script.appendCall(getContextPath() + "subscribe", strEventId,
431:                        objHandler, objFunction);
432:                getScriptProxy().addScript(script);
433:            }
434:
435:            /**
436:             * Subscribes an object or function to a type of event published by this object.
437:
438:            As of version 3.4 a string value for objHandler is deprecated.
439:             * @param strEventId the event type(s).
440:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
441:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
442:             */
443:            public void subscribe(Object[] strEventId,
444:                    org.directwebremoting.proxy.CodeBlock objHandler,
445:                    String objFunction) {
446:                ScriptBuffer script = new ScriptBuffer();
447:                script.appendCall(getContextPath() + "subscribe", strEventId,
448:                        objHandler, objFunction);
449:                getScriptProxy().addScript(script);
450:            }
451:
452:            /**
453:             * Subscribes an object or function to a type of event published by this object.
454:
455:            As of version 3.4 a string value for objHandler is deprecated.
456:             * @param strEventId the event type(s).
457:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
458:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
459:             */
460:            public void subscribe(String strEventId,
461:                    jsx3.lang.Object objHandler,
462:                    org.directwebremoting.proxy.CodeBlock objFunction) {
463:                ScriptBuffer script = new ScriptBuffer();
464:                script.appendCall(getContextPath() + "subscribe", strEventId,
465:                        objHandler, objFunction);
466:                getScriptProxy().addScript(script);
467:            }
468:
469:            /**
470:             * Subscribes an object or function to a type of event published by this object.
471:
472:            As of version 3.4 a string value for objHandler is deprecated.
473:             * @param strEventId the event type(s).
474:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
475:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
476:             */
477:            public void subscribe(Object[] strEventId,
478:                    org.directwebremoting.proxy.CodeBlock objHandler,
479:                    org.directwebremoting.proxy.CodeBlock objFunction) {
480:                ScriptBuffer script = new ScriptBuffer();
481:                script.appendCall(getContextPath() + "subscribe", strEventId,
482:                        objHandler, objFunction);
483:                getScriptProxy().addScript(script);
484:            }
485:
486:            /**
487:             * Subscribes an object or function to a type of event published by this object.
488:
489:            As of version 3.4 a string value for objHandler is deprecated.
490:             * @param strEventId the event type(s).
491:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
492:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
493:             */
494:            public void subscribe(Object[] strEventId, String objHandler,
495:                    String objFunction) {
496:                ScriptBuffer script = new ScriptBuffer();
497:                script.appendCall(getContextPath() + "subscribe", strEventId,
498:                        objHandler, objFunction);
499:                getScriptProxy().addScript(script);
500:            }
501:
502:            /**
503:             * Subscribes an object or function to a type of event published by this object.
504:
505:            As of version 3.4 a string value for objHandler is deprecated.
506:             * @param strEventId the event type(s).
507:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
508:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
509:             */
510:            public void subscribe(String strEventId, String objHandler,
511:                    org.directwebremoting.proxy.CodeBlock objFunction) {
512:                ScriptBuffer script = new ScriptBuffer();
513:                script.appendCall(getContextPath() + "subscribe", strEventId,
514:                        objHandler, objFunction);
515:                getScriptProxy().addScript(script);
516:            }
517:
518:            /**
519:             * Subscribes an object or function to a type of event published by this object.
520:
521:            As of version 3.4 a string value for objHandler is deprecated.
522:             * @param strEventId the event type(s).
523:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
524:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
525:             */
526:            public void subscribe(String strEventId,
527:                    org.directwebremoting.proxy.CodeBlock objHandler,
528:                    String objFunction) {
529:                ScriptBuffer script = new ScriptBuffer();
530:                script.appendCall(getContextPath() + "subscribe", strEventId,
531:                        objHandler, objFunction);
532:                getScriptProxy().addScript(script);
533:            }
534:
535:            /**
536:             * Subscribes an object or function to a type of event published by this object.
537:
538:            As of version 3.4 a string value for objHandler is deprecated.
539:             * @param strEventId the event type(s).
540:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
541:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
542:             */
543:            public void subscribe(String strEventId, String objHandler,
544:                    String objFunction) {
545:                ScriptBuffer script = new ScriptBuffer();
546:                script.appendCall(getContextPath() + "subscribe", strEventId,
547:                        objHandler, objFunction);
548:                getScriptProxy().addScript(script);
549:            }
550:
551:            /**
552:             * Subscribes an object or function to a type of event published by this object.
553:
554:            As of version 3.4 a string value for objHandler is deprecated.
555:             * @param strEventId the event type(s).
556:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
557:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
558:             */
559:            public void subscribe(Object[] strEventId, String objHandler,
560:                    org.directwebremoting.proxy.CodeBlock objFunction) {
561:                ScriptBuffer script = new ScriptBuffer();
562:                script.appendCall(getContextPath() + "subscribe", strEventId,
563:                        objHandler, objFunction);
564:                getScriptProxy().addScript(script);
565:            }
566:
567:            /**
568:             * Subscribes an object or function to a type of event published by this object.
569:
570:            As of version 3.4 a string value for objHandler is deprecated.
571:             * @param strEventId the event type(s).
572:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
573:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
574:             */
575:            public void subscribe(Object[] strEventId,
576:                    jsx3.lang.Object objHandler, String objFunction) {
577:                ScriptBuffer script = new ScriptBuffer();
578:                script.appendCall(getContextPath() + "subscribe", strEventId,
579:                        objHandler, objFunction);
580:                getScriptProxy().addScript(script);
581:            }
582:
583:            /**
584:             * Subscribes an object or function to a type of event published by this object.
585:
586:            As of version 3.4 a string value for objHandler is deprecated.
587:             * @param strEventId the event type(s).
588:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
589:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
590:             */
591:            public void subscribe(String strEventId,
592:                    org.directwebremoting.proxy.CodeBlock objHandler,
593:                    org.directwebremoting.proxy.CodeBlock objFunction) {
594:                ScriptBuffer script = new ScriptBuffer();
595:                script.appendCall(getContextPath() + "subscribe", strEventId,
596:                        objHandler, objFunction);
597:                getScriptProxy().addScript(script);
598:            }
599:
600:            /**
601:             * Unsubscribe an object or function from an event published by this object.
602:
603:            As of version 3.4 a string value for objHandler is deprecated.
604:             * @param strEventId the event type(s).
605:             * @param objHandler the value of objHandler passed to subscribe
606:             */
607:            public void unsubscribe(String strEventId, String objHandler) {
608:                ScriptBuffer script = new ScriptBuffer();
609:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
610:                        objHandler);
611:                getScriptProxy().addScript(script);
612:            }
613:
614:            /**
615:             * Unsubscribe an object or function from an event published by this object.
616:
617:            As of version 3.4 a string value for objHandler is deprecated.
618:             * @param strEventId the event type(s).
619:             * @param objHandler the value of objHandler passed to subscribe
620:             */
621:            public void unsubscribe(Object[] strEventId, String objHandler) {
622:                ScriptBuffer script = new ScriptBuffer();
623:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
624:                        objHandler);
625:                getScriptProxy().addScript(script);
626:            }
627:
628:            /**
629:             * Unsubscribe an object or function from an event published by this object.
630:
631:            As of version 3.4 a string value for objHandler is deprecated.
632:             * @param strEventId the event type(s).
633:             * @param objHandler the value of objHandler passed to subscribe
634:             */
635:            public void unsubscribe(Object[] strEventId,
636:                    jsx3.lang.Object objHandler) {
637:                ScriptBuffer script = new ScriptBuffer();
638:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
639:                        objHandler);
640:                getScriptProxy().addScript(script);
641:            }
642:
643:            /**
644:             * Unsubscribe an object or function from an event published by this object.
645:
646:            As of version 3.4 a string value for objHandler is deprecated.
647:             * @param strEventId the event type(s).
648:             * @param objHandler the value of objHandler passed to subscribe
649:             */
650:            public void unsubscribe(Object[] strEventId,
651:                    org.directwebremoting.proxy.CodeBlock objHandler) {
652:                ScriptBuffer script = new ScriptBuffer();
653:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
654:                        objHandler);
655:                getScriptProxy().addScript(script);
656:            }
657:
658:            /**
659:             * Unsubscribe an object or function from an event published by this object.
660:
661:            As of version 3.4 a string value for objHandler is deprecated.
662:             * @param strEventId the event type(s).
663:             * @param objHandler the value of objHandler passed to subscribe
664:             */
665:            public void unsubscribe(String strEventId,
666:                    jsx3.lang.Object objHandler) {
667:                ScriptBuffer script = new ScriptBuffer();
668:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
669:                        objHandler);
670:                getScriptProxy().addScript(script);
671:            }
672:
673:            /**
674:             * Unsubscribe an object or function from an event published by this object.
675:
676:            As of version 3.4 a string value for objHandler is deprecated.
677:             * @param strEventId the event type(s).
678:             * @param objHandler the value of objHandler passed to subscribe
679:             */
680:            public void unsubscribe(String strEventId,
681:                    org.directwebremoting.proxy.CodeBlock objHandler) {
682:                ScriptBuffer script = new ScriptBuffer();
683:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
684:                        objHandler);
685:                getScriptProxy().addScript(script);
686:            }
687:
688:            /**
689:             * Unsubscribes all subscribed objects to a type of event published by this object.
690:             * @param strEventId the event type
691:             */
692:            public void unsubscribeAll(String strEventId) {
693:                ScriptBuffer script = new ScriptBuffer();
694:                script.appendCall(getContextPath() + "unsubscribeAll",
695:                        strEventId);
696:                getScriptProxy().addScript(script);
697:            }
698:
699:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.