use of com.revolsys.ui.web.config.XmlConfigLoader in project com.revolsys.open by revolsys.
the class IafServletFilter method init.
@Override
public void init(final FilterConfig filterConfig) throws ServletException {
String config = filterConfig.getInitParameter("config");
if (config == null) {
config = "/WEB-INF/iaf-config.xml";
}
final ServletContext servletContext = filterConfig.getServletContext();
WebUiContext.setServletContext(servletContext);
final WebApplicationContext applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
try {
final URL configResource = servletContext.getResource(config);
final XmlConfigLoader configLoader = new XmlConfigLoader(configResource, servletContext);
this.rsWebUiConfig = configLoader.loadConfig();
servletContext.setAttribute("rsWebUiConfig", this.rsWebUiConfig);
} catch (final InvalidConfigException e) {
log.error(e.getErrors().toString(), e);
throw new UnavailableException("Cannot load a rsWebUiConfig resource from '" + config + "' due to " + e.getErrors());
} catch (final Exception e) {
log.error(e.getMessage(), e);
throw new UnavailableException("Cannot load a rsWebUiConfig resource from '" + config + "' due to " + e.getMessage());
}
}
use of com.revolsys.ui.web.config.XmlConfigLoader in project com.revolsys.open by revolsys.
the class WebUiFilter method loadIafConfig.
private void loadIafConfig(final String config, final FilterConfig filterConfig) throws UnavailableException {
final ServletContext servletContext = filterConfig.getServletContext();
WebUiContext.setServletContext(servletContext);
this.applicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
try {
final URL configResource = servletContext.getResource(config);
final XmlConfigLoader configLoader = new XmlConfigLoader(configResource, servletContext);
this.rsWebUiConfig = configLoader.loadConfig();
servletContext.setAttribute("rsWebUiConfig", this.rsWebUiConfig);
} catch (final InvalidConfigException e) {
Logs.error(this, e.getErrors().toString(), e);
throw new UnavailableException("Cannot load a rsWebUiConfig resource from '" + config + "' due to " + e.getErrors());
} catch (final Exception e) {
Logs.error(this, e.getMessage(), e);
throw new UnavailableException("Cannot load a rsWebUiConfig resource from '" + config + "' due to " + e.getMessage());
}
}
use of com.revolsys.ui.web.config.XmlConfigLoader in project com.revolsys.open by revolsys.
the class IafServlet method init.
/**
* Initialise the servlet. Loads the configuration from the
* /WEB-INF/nice-config.xml file.
*
* @param config The servlet configuration parameters
* @exception ServletException if there was a problem initialising the servlet
*/
@Override
public void init(final ServletConfig config) throws ServletException {
super.init(config);
try {
this.servletContext = config.getServletContext();
final URL configResource = this.servletContext.getResource("/WEB-INF/iaf-config.xml");
WebUiContext.setServletContext(this.servletContext);
final XmlConfigLoader configLoader = new XmlConfigLoader(configResource, this.servletContext);
this.applicationConfig = configLoader.loadConfig();
this.servletContext.setAttribute("rsWebUiConfig", this.applicationConfig);
} catch (final InvalidConfigException ice) {
ice.printStackTrace();
log.error(ice.getErrors().toString());
throw new UnavailableException(ice.getMessage() + ":" + ice.getErrors());
} catch (final MalformedURLException mue) {
log.error(mue.getMessage(), mue);
throw new UnavailableException("Failed to initialise Servlet");
} catch (final Throwable t) {
t.printStackTrace();
log.error(t.getMessage(), t);
}
}
Aggregations