* @return
*/
protected ServletConverter getServletConverter(ServletConfig servletConfig) {
//
// get converter from cache
ServletConverter converter = (ServletConverter)converters.get(servletConfig.getServletName());
//
// check if converter exists
if (converter == null) {
//
// if not, create one
converter = new ServletConverter(servletConfig.getServletContext());
//
// create e router
TuboRestletRouter router = new TuboRestletRouter(converter.getContext());
//
// for each 'route' property, attach a route to router
Properties tuboProps = this.getProperties();
for (Enumeration e = tuboProps.propertyNames(); e.hasMoreElements();) {
String aRoute = (String)e.nextElement();
// check if this prop is a route
if ("route[".equals(aRoute.substring(0,6))) {
String[] aRouteArray = aRoute.split("=");
String route = aRouteArray[1];
String event = tuboProps.getProperty(aRoute);
Map props = parseRouteProperties(event);
//set properties for TuboRestletResource instance
//TuboRestletHandler restlet = new TuboRestletHandler(this,event,servletConfig);
//attach handler
router.attach(route,TuboRestletResource.class, props);
//router.attach(route,restlet);
}
}
//
// set router to converter
converter.setTarget(router);
//
// store the new converter in cache
converters.put(servletConfig.getServletName(),converter);
}
//