[ https://issues.apache.org/jira/browse/JSPWIKI-877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14321310#comment-14321310 ]
David Vittor commented on JSPWIKI-877: -------------------------------------- Current state: {noformat} WikiEngine.getRootPath() = m_rootPath = C:\opt\tomcat\apache-tomcat-8.0.15\webapps\JSPWiki PropertyReader.locateClassPathResource(context, resourceName) { result = context.getResourceAsStream( "/WEB-INF/classes"+name ); result = PropertyReader.class.getResourceAsStream( ""+name ); AuthenticationManager.findConfigFile() defaultFile = new File( engine.getRootPath() + "/WEB-INF/" + name ); DefaultFilterManager.initialize() DEFAULT_XMLFILE = /WEB-INF/filters.xml String xmlFile = props.getProperty( PROP_FILTERXML, DEFAULT_XMLFILE ); xmlStream = m_engine.getServletContext().getResourceAsStream( xmlFile ); xmlStream = getClass().getResourceAsStream( xmlFile ); XMLUserDB.initialize() defaultFile = new File( engine.getRootPath() + "/WEB-INF/" + DEFAULT_USERDATABASE ); String file = props.getProperty( PROP_USERDATABASE, defaultFile ); c_file = new File( file ); ClassUtils MAPPINGS = "ini/classmappings.xml"; List< Element > nodes = XmlUtil.parse( MAPPINGS, "/classmappings/mapping" ); XmlUtils.parse() Enumeration< URL > resources = XmlUtil.class.getClassLoader().getResources( xml ); {noformat} *Proposed solution* {noformat} public InputStream ClassUtils.getResourse( engine, props, String name, String defaultName, boolean required ) throws IOException { // 1 - get actual name String resource = props.getProperty( name, defaultName ); // 2 - check if absolute File f = new File (resource); if (f.exists()) return f.getStream(); // 3 - Check WEB-INF/ resourceName = "WEB-INF/"+resource; xmlStream = m_engine.getServletContext().getResourceAsStream( resourceName ); xmlStream = getClass().getResourceAsStream( resourceName ); File f = new File (engine.getRootPath()+"/"+resourceName); if (f.exists()) xmlStream = f.getStream(); if not null - return xmlStream // 4 - Check WEB-INF/classes/ resourceName = "WEB-INF/classes/"+resource; xmlStream = m_engine.getServletContext().getResourceAsStream( resourceName ); xmlStream = getClass().getResourceAsStream( resourceName ); File f = new File (engine.getRootPath()+"/"+resourceName); if (f.exists()) xmlStream = f.getStream(); if not null - return // 5. throw exception if (required) throw new IOException(resource+" not found, but required"); return null; } {noformat} > Allow jspwiki.properties filterConfig and policy.file to have fully qualified > paths > ----------------------------------------------------------------------------------- > > Key: JSPWIKI-877 > URL: https://issues.apache.org/jira/browse/JSPWIKI-877 > Project: JSPWiki > Issue Type: Bug > Components: Core & storage > Affects Versions: 2.10.1 > Reporter: David Vittor > > Currently adding the following properties does not work: > * jspwiki.policy.file=C:/temp/jspwiki-custom.policy > * jspwiki.filterConfig=C:/temp/jspwiki-filters.xml > The policy file only checks certain locations, and not fully qualified paths. > The filterConfig has the same problem, but does work in linux, but not in > windows as this expects a URL, e.g. file:/C:/temp/... but this causes a > SEVERE filterStart error in tomcat. > Note: These seem to be inconsistant with UserDatabase and GroupDatabase -- This message was sent by Atlassian JIRA (v6.3.4#6332)