@Override
protected void service(HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {
if(req.getHeader("X-GWT-Module-Base") != null && req.getHeader("X-GWT-Permutation") != null) {
String moduleId = req.getRequestURI().split("/")[2];
RemoteServiceServlet servlet = SiteMain.rpcServlets.get(moduleId);
if(servlet == null) {
try {
servlet = (RemoteServiceServlet) Class.forName(Module.MODULE_PACKAGE + "." + moduleId + ".server." + Character.toUpperCase(moduleId.charAt(0)) + moduleId.substring(1) + "ServiceImpl").newInstance();
} catch (Exception ex) {
Logger.get().log(Level.SEVERE, null, ex);
resp.sendError(500);
return;
}
servlet.init(this.getServletConfig());
SiteMain.rpcServlets.put(moduleId, servlet);
}
servlet.service(req, resp);
} else {
super.service(req, resp);
}
}