InputStream is = null;
// extract data from the web.xml file
WebAppContext appContext;
Web_App_Xml webXmlDoc;
try {
is = dispatchedContext.getResourceAsStream(WEB_XML_FILE);
webXmlDoc = Web_App_Xml.parse(is);
} catch (Exception e) {
logger.error("Error during loading of web.xml file for application "+ context, e);
return null;
} finally {
IOUtils.closeQuietly(is);
}
appContext = new WebAppContext(context,
webXmlDoc.getDisplayName (),
webXmlDoc.getdesc (),
null,
webXmlDoc.getServletMappings (),
null,
webXmlDoc.getWelcomeFiles ());
List<Servlet_Element> servlets = webXmlDoc.getServlets ();
Servlet_Element servlet;
ServletBean servletBean;
for (int i = 0; i < servlets.size (); i++) {
servlet = servlets.get (i);
servletBean = new ServletBean (
applicationID,
servlet.getType (),
servlet.getDisplayName (),
servlet.getName (),
servlet.getSource (),
context,
servlet.getdesc ()
);
appContext.addServlet (servletBean);
}
List<Security_Role> roles = webXmlDoc.getRoles ();
Security_Role role;
for (int i = 0; i < roles.size (); i++) {
role = roles.get (i);
appContext.addRole (role.getName ());
}