String subDomain = siteName.replace("." + Setting.getDomain(),
"");
Application obj = ApplicationModel.getById(subDomain);
if (obj != null) {
try {
ApplicationConfig config = ApplicationConfigModel
.getById(obj.getId(), obj.getId());
ApplicationTemplate template = ApplicationTemplateModel
.getById(obj.getId(), config.getTemplateId());
NamespaceManager.set(obj.getId());
if (config != null && template != null) {
request.setAttribute("template", template);
request.setAttribute("config", config);
} else {
response.getWriter().print(
"Please try again later !");
log.warning("Config or template are null !");
}
} catch (Exception e) {
response.getWriter().print("Please try again later !");
log.warning(e.toString());
}
} else {
NamespaceManager.set(Setting.getGeneralNamespace());
}
} else {
siteName = siteName.replace("http://", "");
siteName = siteName.replace("www.", "");
log.warning("---------------->------>" + siteName);
ApplicationMapping mapping = ApplicationMappingModel
.getById(siteName);
if (mapping != null) {
try {
Application obj = ApplicationModel.getById(mapping
.getApplicationId());
if (obj != null) {
ApplicationConfig config = ApplicationConfigModel
.getById(obj.getId(), obj.getId());
ApplicationTemplate template = ApplicationTemplateModel
.getById(obj.getId(),
config.getTemplateId());
NamespaceManager.set(mapping.getApplicationId());
if (config != null && template != null) {
request.setAttribute("template", template);
request.setAttribute("config", config);
} else {