Page: 
http://wiki.cocoondev.org/Wiki.jsp?page=LDAPPortalAuthentification+and+RequestUserInfoFromXSP
 , version: 8 on Thu Jun 26 08:51:21 2003 by 138.190.4.152

-       Object[] myarray = null;  
?                               --

+           Object[] myarray = null;
?       ++++

-       java.util.Collection list = new ArrayList();  
?                                                   --

+           java.util.Collection list = new ArrayList();
?       ++++

-       String typeid = "b";  
-               int limit, interps;  
-           PatternMatcher matcher = new Perl5Matcher();  
?                                                       --

+           PatternMatcher matcher = new Perl5Matcher();
-           Pattern pattern = null;  
?                                  --

+           Pattern pattern = null;
-           PatternCompiler compiler = new Perl5Compiler();  
?                                                          --

+           PatternCompiler compiler = new Perl5Compiler();
-           String regularExpression, input, result, firstsplit, secondsplit;  
?                                            --------                        --

+           String regularExpression, input, firstsplit, secondsplit;
-                                 
-           input             = <xsp:session:get-attribute-names/>;  
+           String myvara;
+           Pattern searcher;
+           PatternMatcherInput myvar;
+           String result = "uprofile|test:Guest_0_guest"; <!-- default value, 
so that if the user is not logged the name and role are set to guest -->
+ 
+           myarray = <xsp-session:get-attribute-names as="array"/>.toArray(); 
+          
+                try {
+                  searcher = compiler.compile("uprofile");
+                } catch(MalformedPatternException e) {
+                  System.out.println("Bad pattern.");
+                  System.out.println(e.getMessage());
+                  return;
+                }
+               
+          <!-- Search the user information, the string is something like 
profile:something|somethingele:User_13_Michael -->
+           for (int i= 0; i &lt; 5; i++) {
+               myvara = myarray[i].toString();
+               myvar   = new PatternMatcherInput(myvara);
+               while(matcher.contains(myvar, searcher)) {
+                       result = myarray[i].toString();
+                       i = 5;
+               }       
+           }
+          regularExpression = "\\|";   
+ 
- <!-- My input = "uprofileWOCDB-WEBPortal|UserInfo:User_admin_TFRGHM00" -->  
- <!-- So adapt your regularExpression depending on your desire -->  
- regularExpression = "see_comment"; <!-- "//|" but the slashes must be 
backslashes -->  
-   
-           try {  
?                --

+           try {
-             pattern = compiler.compile(regularExpression);  
?                                                           --

+             pattern = compiler.compile(regularExpression);
-           } catch(MalformedPatternException e){  
?                                                --

+           } catch(MalformedPatternException e){
-             System.err.println("Bad pattern.");  
?                                                --

+             System.err.println("Bad pattern.");
-             System.err.println(e.getMessage());  
?                                                --

+             System.err.println(e.getMessage());
-             System.exit(1);  
?                            --

+             System.exit(1);
-           }  
?            --

+           }
+       
-               Util.split(list,matcher,pattern,input);  
?       ^                                ^^^    --

+          Util.split(list,matcher,pattern,result);
?       ^^^                                ^^^ +

- Posted by Gheysen Maxime, 06.13.03 16:10 \\ 
+ -- [MaximeGheysen]


Page: http://wiki.cocoondev.org/Wiki.jsp?page=MaximeGheysen , version: 3 on Thu 
Jun 26 08:55:20 2003 by 138.190.4.152

- Hello there. I'm 21 and a Jr. Developer for an communication agency in 
Switzerland.
?                           ----              ^^                 - -

+ Hello there. I'm 21 and a Developer for the biggest communication compagny in 
Switzerland.
?                                         ^^^^^^^^^^^               ++++

- I've been working with XML-based content for a couple of years now, and began 
my foray into XSLT & Cocoon about one year ago.
+ I began my foray into XSLT & Cocoon about one year ago. It was also my first 
"open source" project, and all I could add is that the help and ressources are 
wonderfull, from Wiki to the mailing lists!


Reply via email to