[wsas-java-dev] Re: [commons-dev] Improvements to adminui javascript/AJAX library

Thilina Gunarathne thilina at wso2.com
Mon Mar 26 22:50:11 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,
Sorry for jumping in this late..Better late than never :)..

Saminda, What are the reasons for namespace qualifying this.. If we are
doing this we need to do so across the whole board for all the WSRequest
impls...

I would not agree with this unless there is a concrete reason...

Thanks,
Thilina

saminda abeyruwan wrote:
> Hi Rajika,
> 
> Patch for making WSRequest, with the wso2.wsf namespace.
> 
> Saminda
> 
> saminda abeyruwan wrote:
>> Hi Sir,
> 
>> Yes Sir, it's the same code in
>> http://wso2.org/repos/wso2/trunk/wsf/javascript/native/ we are referring
>> to.
> 
>>>>> I believe you are referring prior to WSRequest.js. The simplest solution
>>>>> would be to start with native/WSRequest.js.
>>>> I'm referring to the stuff at
>>>> http://wso2.org/repos/wso2/trunk/wsf/javascript/native/. I think you
>>>> meant the same right?
>>>>
>>>>> We propose that main.js contains functions related to a namespace
>>>>> "WSO2.common", (ex: WSO2.common.send(args...)) will solve the namespace
>>>>> issue.
>>>> +1 but IMO it should be wso2.wsf.
>> main.js reside under commons/adminui project.
>> [https://wso2.org/repos/wso2/trunk/commons/adminui]. Should we use
>> "wso2.wsf" namespace for this too.
>>>>> As an example, WSO2.common.send(args...) is the wrapper function that
>>>>> uses WSRequest functionality to communicate with server. This is our
>>>>> original plan and we were waiting for a release of WSRequest to achieve
>>>>> this.
>>>> No I disagree- if there's a need to wrap WSRequest then we haven't got
>>>> WSRequest right. What is preventing you from doing
>>>>     foo=new wso2.wsf.WSRequest()
>> +1.
> 
>> Should we do this to XPI and ActiveX Object too, namespace qualifying
>> WSRequest object.
> 
> 
>> Thank you
> 
>> Saminda
> 
> 
> 
> _______________________________________________
> Wsas-java-dev mailing list
> Wsas-java-dev at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev
> 
> 

- ------------------------------------------------------------------------

Index: samples/firefox/google.html
===================================================================
- --- samples/firefox/google.html	(revision 1205)
+++ samples/firefox/google.html	(working copy)
@@ -2,11 +2,11 @@
 <HEAD>
     <TITLE>WSO2 WSRequest object</TITLE>
     <h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">
- -    var wshttp = new WSRequest();
+    var wshttp = new wso2.wsf.WSRequest();

     function checkSpell()
     {
@@ -97,7 +97,7 @@
             <td id="resultCol"></td>
         </tr>
     </table>
- -    <input type="button" value="Check spell" onclick="checkSpell()">
+    <input type="button" value="Check spell" onclick="javascript:void
checkSpell();return false;">
     <input type ="reset" name="reset" value="Reset">
     <br>
     your request xml<br><textarea id="request" rows=10 cols=80
></textarea><br/>
Index: samples/firefox/zipcode.html
===================================================================
- --- samples/firefox/zipcode.html	(revision 1205)
+++ samples/firefox/zipcode.html	(working copy)
@@ -2,12 +2,12 @@
 <HEAD>
     <TITLE>WSO2 WSRequest object</TITLE>
     <h2>WSO2 WSRequest Object Demo-Distance between two zip codes</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">

- -    var wshttp = new WSRequest();
+    var wshttp = new wso2.wsf.WSRequest();
     function test(){
         var option = new Array();
         wshttp.onreadystatechange = test1;
Index: samples/firefox/greet.html
===================================================================
- --- samples/firefox/greet.html	(revision 1205)
+++ samples/firefox/greet.html	(working copy)
@@ -2,12 +2,12 @@
 <HEAD>
     <TITLE>WSO2 WSRequest object</TITLE>
     <h2>WSO2 WSRequest Object Demo-Greet of the day</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">

- -     var wshttp = new WSRequest();
+     var wshttp = new wso2.wsf.WSRequest();
     function greet(){

         wshttp.onreadystatechange = state;
Index: samples/firefox/googlesnyc.html
===================================================================
- --- samples/firefox/googlesnyc.html	(revision 1205)
+++ samples/firefox/googlesnyc.html	(working copy)
@@ -2,11 +2,11 @@
 <HEAD>
     <TITLE>WSO2 WSRequest object</TITLE>
     <h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">
- -    var wshttp = new WSRequest();
+    var wshttp = new wso2.wsf.WSRequest();

     function checkSpell()
     {
Index: samples/ie/greet_ie.html
===================================================================
- --- samples/ie/greet_ie.html	(revision 1205)
+++ samples/ie/greet_ie.html	(working copy)
@@ -2,12 +2,12 @@
 <HEAD>
     <TITLE>WSO2 WSRequest object</TITLE>
     <h2>WSO2 WSRequest Object Demo-Greet of the day</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">

- -    var wshttp = new WSRequest();
+    var wshttp = new wso2.wsf.WSRequest();
     function greet(){
         var option = new Array();
         option['useSOAP'] = 1.1;
Index: samples/ie/googlesnyc_ie.html
===================================================================
- --- samples/ie/googlesnyc_ie.html	(revision 1205)
+++ samples/ie/googlesnyc_ie.html	(working copy)
@@ -2,7 +2,7 @@
 <HEAD>
     <TITLE>WSO2 WSRequest demo</TITLE>
     <h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">
@@ -10,7 +10,7 @@
     var key;
     var phrase;
     var wshttp = null;
- -    wshttp = new WSRequest();
+    wshttp = new wso2.wsf.WSRequest();
     function search(){

         wshttp.onreadystatechange = callbackResult;
Index: samples/ie/google_ie.html
===================================================================
- --- samples/ie/google_ie.html	(revision 1205)
+++ samples/ie/google_ie.html	(working copy)
@@ -2,7 +2,7 @@
 <HEAD>
     <TITLE>WSO2 WSRequest demo</TITLE>
     <h2>WSO2 WSRequest Object Demo-Google spell check</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">
@@ -10,7 +10,7 @@
     var key;
     var phrase;
     var wshttp = null;
- -    wshttp = new WSRequest();
+    wshttp = new wso2.wsf.WSRequest();
     function search(){

         wshttp.onreadystatechange = callbackResult;
Index: samples/ie/zipcode_ie.html
===================================================================
- --- samples/ie/zipcode_ie.html	(revision 1205)
+++ samples/ie/zipcode_ie.html	(working copy)
@@ -2,11 +2,11 @@
 <HEAD>
     <TITLE>WSO2 WSRequest object</TITLE>
     <h2>WSO2 WSRequest Object Demo-Distance between two zip codes</h2>
- -    <script language="javascript" src="./WSRequest.js"></script>
+    <script language="javascript" src="../../WSRequest.js"></script>
 </HEAD>
 <BODY>
 <script language="javascript">
- -      var wshttp = new WSRequest(true);
+      var wshttp = new wso2.wsf.WSRequest(true);
     function test(){

         // user need soap-not xml
Index: WSRequest.js
===================================================================
- --- WSRequest.js	(revision 1205)
+++ WSRequest.js	(working copy)
@@ -14,8 +14,46 @@
  * limitations under the License.
  */

- -function WSRequest()
- -{
+/**
+ * WSRequest object uses SOAP/HTTP|HTTPS. This object provides a wrpper
for XMLHttpRequest object.
+ * This object belongs to the namespace wso2.wsf, thus, user can init
it as follows,
+ * var foo = new wso2.wsf.WSRequest();
+ */
+
+/*
+creating the wso2 global object
+*/
+if (typeof wso2 == 'undefined') {
+    //define the WSO2 global object
+
+    wso2 = {};
+}
+
+/*this will create the namespace required.*/
+wso2.namespace = function() {
+    var a = arguments,o = null,i,j,d;
+    for (i = 0; i < a.length; i++) {
+        d = a[i].split(".");
+        o = wso2;
+
+        for (j = (d[0] == "wso2")?1:0; j < d.length; j++) {
+            o[d[j]] = o[d[j]] || {};
+            o = o[d[j]];
+        }
+    }
+
+    return o;
+}
+
+wso2.init = function() {
+    this.namespace("wsf");
+}
+
+wso2.init();
+
+
+wso2.wsf.WSRequest = function() {
+
     // data members
     // readyState
     this.readyState = 0;


- ------------------------------------------------------------------------

_______________________________________________
Commons-dev mailing list
Commons-dev at wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFGCLCTTt0cKycFPQgRArP5AJkB+Be2WLMKGigogY5hy9uMrur5KwCfZx6j
xF1WPTJbkfiaiB0OBQlkuSQ=
=FZBI
-----END PGP SIGNATURE-----




More information about the Wsas-java-dev mailing list