Changeset 3486


Ignore:
Timestamp:
2002-10-25T16:26:30+13:00 (22 years ago)
Author:
kjdon
Message:

if action requested that not known about, tries to load it dynamically

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/core/Receptionist.java

    r3469 r3486  
    128128    Action a = (Action)action_map_.get(action);
    129129    if (a==null) {
    130         return GSHTML.errorPage("no action for "+action);
     130        // try to load a new action
     131        try {
     132        String action_name = action.substring(0,1).toUpperCase()+action.substring(1)+"Action";
     133        System.out.println("new action name="+action_name);
     134        Action ac = (Action)Class.forName("org.greenstone.gsdl3.action."+action_name).newInstance();
     135        ac.setConfigVars(config_);
     136        ac.setMessageRouter(mr_);
     137        ac.setCGIConverter(cgi_);
     138        ac.configure();
     139        action_map_.put(action, ac);
     140        a = ac;
     141        } catch (Exception e) {
     142       
     143        return GSHTML.errorPage("no action for "+action+", and couldn't create a new one: error message:"+e.getMessage());
     144        }
    131145    }
    132146
Note: See TracChangeset for help on using the changeset viewer.