use of com.qlangtech.tis.manage.common.DefaultFilter.AppAndRuntime in project tis by qlangtech.
the class EnvironmentBindService method getInstance.
public T getInstance() {
AppAndRuntime appAndRuntime = DefaultFilter.getAppAndRuntime();
if (appAndRuntime == null) {
appAndRuntime = new AppAndRuntime();
appAndRuntime.setRuntime(DefaultFilter.getRuntime());
}
RunEnvironment runtime = appAndRuntime.getRuntime();
return this.getInstance(runtime);
}
use of com.qlangtech.tis.manage.common.DefaultFilter.AppAndRuntime in project tis by qlangtech.
the class CheckAppDomainExistValve method getAppDomain.
public static AppDomainInfo getAppDomain(HttpServletRequest request, RunContext context) {
// Assert.assertNotNull(applicationDAO);
AppDomainInfo domain = (AppDomainInfo) request.getAttribute(ActionTool.REQUEST_DOMAIN_KEY);
if (domain != null) {
return domain;
}
// Integer bizid = null;
// Integer appid = null;
AppDomainInfo appDomain = null;
// Cookie cookie = getCookie(request,
// ChangeDomainAction.COOKIE_SELECT_APP);
// if (cookie == null) {
// // domain = new NullAppDomainInfo(applicationDAO);
// domain = AppDomainInfo.createAppNotAware(getRuntime());
// request.setAttribute(ActionTool.REQUEST_DOMAIN_KEY, domain);
// return domain;
// }
// Matcher match = p2.matcher(cookie.getValue());
// .getRuntime(request);
AppAndRuntime environment = DefaultFilter.getAppAndRuntime();
if (environment == null) {
domain = AppDomainInfo.createAppNotAware(DefaultFilter.getRuntime());
request.setAttribute(ActionTool.REQUEST_DOMAIN_KEY, domain);
return domain;
}
try {
if (StringUtils.isEmpty(environment.getAppName())) {
// 只选择了环境 参数
// appDomain = new AppDomainInfo(-1, -1, Integer
// .parseInt(match.group(2)), context);
appDomain = AppDomainInfo.createAppNotAware(environment.getRuntime());
} else {
appDomain = queryApplication(request, context, environment.getAppName(), environment.getRuntime());
if (appDomain == null) {
Application app = new Application();
app.setProjectName(environment.getAppName());
appDomain = new AppDomainInfo(0, 0, environment.getRuntime(), app);
}
}
} catch (Exception e) {
// return new NullAppDomainInfo(context.getApplicationDAO());
throw new IllegalStateException(e);
}
if (appDomain == null) {
appDomain = CheckAppDomainExistValve.createNull();
}
request.setAttribute(ActionTool.REQUEST_DOMAIN_KEY, appDomain);
return appDomain;
}
Aggregations