Changeset 25388

Show
Ignore:
Timestamp:
16.04.2012 20:50:16 (7 years ago)
Author:
ak19
Message:

Correcting the behaviour of Server3 window's servlet combobox: it should have the current servlet selected and also deal with URL mappings that end with forwardslash-star.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/server/Server3Settings.java

    r24207 r25388  
    3333    JLabel servlet_label = new JLabel(server.dictionary.get(BaseServer.Property.SERVER_SETTINGS+".URL")); 
    3434 
    35     this.servletDefault = server.config_properties.getProperty(BaseServer.Property.DEFAULT_SERVLET).replaceAll("/",""); 
    36      
     35    this.servletDefault = server.config_properties.getProperty(BaseServer.Property.DEFAULT_SERVLET); 
     36 
    3737    servlet_combobox = new JComboBox(); 
    3838    servlet_combobox.setMaximumRowCount(5); 
     
    6262        } 
    6363 
    64         if (pattern.replaceAll("/","").equals(servletDefault)) { 
     64        if (pattern.replaceAll("/\\*","").equals(servletDefault)) { // urlmapping maybe something like "/library/*", want "/library" 
    6565        servlet_combobox.setSelectedItem(name); 
    6666        } 
     
    8080    boolean hasChanged = false; 
    8181    boolean requireRestart = false; 
    82     if (!servletDefault.equals((String)url_mappings.get(servlet_combobox.getSelectedItem()))) { 
     82    String urlMapping = (String)url_mappings.get(servlet_combobox.getSelectedItem()); 
     83    if(urlMapping.endsWith("/*")) { // urlmapping maybe something like "/library/*" 
     84        urlMapping = urlMapping.substring(0, urlMapping.length()-2); 
     85    } 
     86    if (!servletDefault.equals(urlMapping)) {  
    8387        hasChanged = true; 
    8488        requireRestart = true; 
     
    97101 
    98102    String newServletDef = (String) servlet_combobox.getSelectedItem(); 
    99     newFileLines = scriptReadWrite.queryReplace(newFileLines,BaseServer.Property.DEFAULT_SERVLET, (String) url_mappings.get(newServletDef));     
     103    String servletDefName = (String) url_mappings.get(newServletDef); 
     104    if(servletDefName.endsWith("/*")) { // urlmapping maybe something like "/library/*"      
     105      servletDefName = servletDefName.substring(0, servletDefName.length()-2); 
     106    } 
     107    newFileLines = scriptReadWrite.queryReplace(newFileLines,BaseServer.Property.DEFAULT_SERVLET, servletDefName); 
    100108    } 
    101109