Changeset 33256 for main/trunk
- Timestamp:
- 2019-07-01T10:51:32+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r33175 r33256 445 445 session.setMaxInactiveInterval(session_expiration); 446 446 String uid = session.getId(); 447 447 logger.error("uid = "+uid); 448 448 request.setCharacterEncoding("UTF-8"); 449 449 response.setContentType("text/html;charset=UTF-8"); … … 464 464 userContext.setLanguage(lang); 465 465 userContext.setUserID(uid); 466 466 logger.error ("setting user context "+ uid); 467 467 if (request.getAuthType() != null) 468 468 { 469 469 //Get the username 470 userContext.setUsername(request.getUserPrincipal().getName()); 470 userContext.setUsername(request.getUserPrincipal().getName()); 471 logger.error("adding username "+request.getUserPrincipal().getName()); 471 472 472 473 //Get the groups for the user … … 607 608 } 608 609 609 // logger.info("should_cache= " + should_cache);610 610 logger.error("should_cache= " + should_cache); 611 logger.error("cache key = " + cache_key); 611 612 //clear the collection-specific cache in the session, since we have no way to know whether this session is 612 613 //about the same collection as the last session or not. … … 618 619 { 619 620 session.removeAttribute(name); 621 logger.error("XXX removing "+name+" from the session"); 620 622 } 621 623 } … … 624 626 Hashtable<String, Hashtable<String, String>> param_table = null; 625 627 Hashtable<String, String> table = null; 628 boolean new_table = false; 626 629 String sid = session.getId(); 627 630 if (should_cache == true && cache_key != null && !cache_key.equals("")) … … 629 632 if (session_ids_table.containsKey(sid)) 630 633 { 634 logger.error("cache contains sesion id"); 631 635 session_cache = session_ids_table.get(sid); 632 636 param_table = session_cache.getParamsTable(); 633 637 if (param_table.containsKey(cache_key)) 634 638 { 635 //logger.info("existing table: " + collection);639 logger.error("existing table: " + cache_key); 636 640 table = param_table.get(cache_key); 637 641 } … … 640 644 table = new Hashtable<String, String>(); 641 645 param_table.put(cache_key, table); 642 //logger.info("new table: " + collection); 646 logger.error("new table: " + cache_key); 647 new_table = true; 643 648 } 644 649 } 645 650 else 646 651 { 652 logger.error("cache doesn't contain session id"); 647 653 param_table = new Hashtable<String, Hashtable<String, String>>(); 648 654 table = new Hashtable<String, String>(); … … 651 657 session_ids_table.put(sid, session_cache); 652 658 session.setAttribute(GSXML.USER_SESSION_CACHE_ATT, session_cache); 653 654 // here we add in default params? 655 ArrayList<String> defp = this.gs_params.getParamsWithDefaults(); 656 Iterator i = this.gs_params.getParamsWithDefaults().iterator(); 657 while (i.hasNext()) { 658 String p = (String)i.next(); 659 String v = this.gs_params.getParamDefault(p); 660 if (!p.equals(GSParams.ACTION) && !p.equals(GSParams.SUBACTION) && !p.equals(GSParams.LANGUAGE) && !p.equals(GSParams.OUTPUT)) { 661 table.put(p,v); 662 } 663 } 664 665 } 659 new_table = true; 660 } 661 662 // here we add in default params if we have a new table 663 ArrayList<String> defp = this.gs_params.getParamsWithDefaults(); 664 Iterator i = this.gs_params.getParamsWithDefaults().iterator(); 665 while (i.hasNext()) { 666 String p = (String)i.next(); 667 String v = this.gs_params.getParamDefault(p); 668 if (!p.equals(GSParams.ACTION) && !p.equals(GSParams.SUBACTION) && !p.equals(GSParams.LANGUAGE) && !p.equals(GSParams.OUTPUT)) { 669 logger.error("adding to new table default param "+p+", "+v); 670 table.put(p,v); 671 } 672 } 673 674 666 675 } 667 676 … … 695 704 {// we have already dealt with these 696 705 706 logger.error("query map:" + name); 697 707 String value = ""; 698 708 String[] values = queryMap.get(name); … … 708 718 if (this.gs_params.shouldSave(name) && table != null) 709 719 { 720 logger.error("adding to table"); 710 721 table.put(name, value); 711 722 } 712 723 else 713 724 { 725 logger.error("adding param to xml param list"); 714 726 Element param = msg_doc.createElement(GSXML.PARAM_ELEM); 715 727 param.setAttribute(GSXML.NAME_ATT, name); … … 731 743 { 732 744 String name = keys.nextElement(); 745 logger.error("adding from table to session "+name); 733 746 session.setAttribute(name, table.get(name)); 734 747 } … … 737 750 // put in all the params from the session cache 738 751 Enumeration params = session.getAttributeNames(); 752 logger.error("add in session attributes"); 739 753 while (params.hasMoreElements()) 740 754 { 741 755 String name = (String) params.nextElement(); 742 756 logger.error("session attribute "+name); 743 757 if (!name.equals(GSXML.USER_SESSION_CACHE_ATT) && !name.equals(GSParams.LANGUAGE) && !name.equals(GSXML.USER_ID_ATT)) 744 758 {
Note:
See TracChangeset
for help on using the changeset viewer.