From: <wan...@us...> - 2003-04-03 20:53:16
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv6439 Modified Files: WMServlet.java Log Message: Made some private methods protected, and added helper methods for getting error var name and error template. Makes WMServlet more extensible. Index: WMServlet.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/WMServlet.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** WMServlet.java 29 Jan 2003 04:25:48 -0000 1.53 --- WMServlet.java 3 Apr 2003 20:53:05 -0000 1.54 *************** *** 72,76 **** * Log object used to write out messages */ ! private Log _log; /** --- 72,76 ---- * Log object used to write out messages */ ! protected Log _log; /** *************** *** 314,318 **** //Handler hand = new ErrorHandler(); try { ! context.put(getConfig(ERROR_VARIABLE, ERROR_VARIABLE_DEFAULT), error); //tmpl = hand.accept(context); --- 314,318 ---- //Handler hand = new ErrorHandler(); try { ! context.put(getErrorVariableName(), error); //tmpl = hand.accept(context); *************** *** 324,328 **** return tmpl; } ! /** * This object is used to access components that have been plugged --- 324,336 ---- return tmpl; } ! ! /** ! * <p>Returns the name of the error variable, as per the config.</p> ! * @return Name to use for the error variable in templates ! */ ! protected String getErrorVariableName(){ ! return getConfig(ERROR_VARIABLE, ERROR_VARIABLE_DEFAULT); ! } ! /** * This object is used to access components that have been plugged *************** *** 716,720 **** * this is only defined for JSDK 2.2+ */ ! private void setLocale(HttpServletResponse resp, Locale locale) { try { Method m = HttpServletResponse.class.getMethod( --- 724,728 ---- * this is only defined for JSDK 2.2+ */ ! protected void setLocale(HttpServletResponse resp, Locale locale) { try { Method m = HttpServletResponse.class.getMethod( *************** *** 762,774 **** */ public Template getErrorTemplate(){ ! String templateName; ! ! try { ! templateName = (String) _broker.get("config", ERROR_TEMPLATE); ! } ! catch (ResourceException e) { ! templateName = ERROR_TEMPLATE_DEFAULT; ! } ! try { _errorTemplate = (Template) _broker.get("template", templateName); --- 770,775 ---- */ public Template getErrorTemplate(){ ! String templateName = getErrorTemplateName(); ! try { _errorTemplate = (Template) _broker.get("template", templateName); *************** *** 780,783 **** return _errorTemplate; } ! } --- 781,797 ---- return _errorTemplate; } ! ! protected String getErrorTemplateName(){ ! String templateName; ! ! try { ! templateName = (String) _broker.get("config", ERROR_TEMPLATE); ! } ! catch (ResourceException e) { ! templateName = ERROR_TEMPLATE_DEFAULT; ! } ! return templateName; ! } ! ! } |