private void reloadRoutes() { if (loading || routesIsNotFile()) { return; } if (lastLoaded < 0 || checkInterval >= 0 && System.currentTimeMillis() > lastLoaded + checkInterval * 1000) { synchronized (this) { if (!loading) loading = true; else return; } if (loading) { try { logger.debug("check update for routes."); if (routes.lastModified() > lastLoaded) { long t1 = System.currentTimeMillis(); Routes.load(routes); long t2 = System.currentTimeMillis(); logger.debug(String.format("reload routes(%dms).", (t2 - t1))); } lastLoaded = System.currentTimeMillis(); } finally { loading = false; } } } }
public void execute(S2Container container) throws Exception { logger.debug("HttpServletTestInclude.execute()"); setMockContext(container); container.setExternalContextComponentDefRegister( new HttpServletExternalContextComponentDefRegister()); ComponentDeployerFactory.setProvider(new ExternalComponentDeployerProvider()); }
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; String contextPath = req.getContextPath(); if (contextPath.equals("/")) { contextPath = ""; } String path = RequestUtil.getPath(req); if (!processDirectAccess(request, response, chain, path)) { return; } reloadRoutes(); if (path.indexOf('.') < 0) { // If the request pass via reverse proxy, the original path must be gotten from HTTP header. if (!contextSensitive) { path = getOriginalPath(req); } try { Options options = Routes.recognizePath(path); String controller = options.getString("controller"); String action = options.getString("action"); Options params = options.except("controller", "action"); String actionPath = ControllerUtil.fromClassNameToPath(controller); S2Container container = SingletonS2ContainerFactory.getContainer(); if (container.hasComponentDef(actionPath.replace('/', '_').concat("Action"))) { S2ExecuteConfig executeConfig; if (StringUtil.equals(action, "index")) { executeConfig = S2ExecuteConfigUtil.findExecuteConfig("/" + actionPath, req); action = executeConfig.getMethod().getName(); } else { executeConfig = S2ExecuteConfigUtil.findExecuteConfig("/" + actionPath, action); } if (executeConfig != null) { StringBuilder forwardPath = new StringBuilder(256); forwardPath .append("/") .append(actionPath) .append(".do?SAStruts.method=") .append(URLEncoderUtil.encode(action)); for (String key : params.keySet()) { forwardPath .append("&") .append(URLEncoderUtil.encode(key)) .append("=") .append(URLEncoderUtil.encode(params.getString(key))); } logger.debug(String.format("recognize route %s as %s#%s.", path, actionPath, action)); req.getRequestDispatcher(forwardPath.toString()).forward(req, res); return; } } } catch (RoutingException e) { if (!fallThrough) throw e; } } chain.doFilter(request, response); }
public Object invoke(final MethodInvocation invocation) throws Throwable { if (!logger.isDebugEnabled()) { return invocation.proceed(); } final StringBuffer buf = new StringBuffer(100); buf.append(getTargetClass(invocation).getName()); buf.append("#"); buf.append(invocation.getMethod().getName()); logger.debug("BEGIN " + buf); try { return invocation.proceed(); } catch (Throwable t) { buf.append(" Throwable:").append(t); throw t; } finally { logger.debug("END " + buf); } }
/** * 例外を追加します。 * * @param exception */ public void addException(RuntimeException exception) { closeStatements(); closeConnection(); if (haltOnError) { throw exception; } logger.debug(exception); exceptionList.add(exception); openConnection(); }
public FacesConfig configure() { List configs = new LinkedList(); String path = getPath(); if (logger_.isDebugEnabled()) { logger_.debug("target file path = " + path); } if (path == null) { return null; } String[] paths = StringUtil.split(path, FACES_CONFIG_DELIMETER); for (int i = 0; i < paths.length; i++) { final String targetPath = paths[i]; final SaxHandlerParser parser = createSaxHandlerParser(); InputStream is = resourceResolver_.getInputStream(targetPath.trim()); try { configs.add(parser.parse(is, targetPath)); } finally { InputStreamUtil.close(is); } } return FacesConfigUtil.collectAllFacesConfig(configs); }
public boolean isAutoIncrement( Connection connection, String catalogName, String schemaName, String tableName, String columnName) throws SQLException { String fullTableName = TableUtil.buildFullTableName(catalogName, schemaName, tableName); String sql = "select " + columnName + " from " + fullTableName + " where 1 = 0"; logger.debug(sql); PreparedStatement ps = ConnectionUtil.prepareStatement(connection, sql); try { ResultSet rs = ps.executeQuery(); try { ResultSetMetaData rsMetaData = rs.getMetaData(); return rsMetaData.isAutoIncrement(1); } finally { ResultSetUtil.close(rs); } } finally { StatementUtil.close(ps); } }
public void dispatch(String requestURI) throws IOException, FacesException { if (logger_.isDebugEnabled()) { logger_.debug("dispatch called."); } }