1 2 Previous Next 16 Replies Latest reply on Apr 29, 2015 7:49 AM by Kiran Kumar

    Replacement for context.xml in AS7? Access files outside the WAR?

    Christoph Gaffga Newbie



      I'm in big trouble migrating from AS6 to AS7, as of the missing possibility to configure the tomcat catalina container via context.xml. In AS6 I had a WEB-INF/context.xml like this to set a custom DirContext implementation:

      {code:xml}<?xml version="1.0" encoding="UTF-8"?>

      <Context allowLinking="true" cookies="true" crossContext="true" override="true">

          <Resources allowLinking="true" className="com.triplemind.site.engine.SourceResolverContext"

              homeDir="/home/myapp/files" />



      This custom SourceResolverContext was wrapping the FileDirContext and made it possible for my webapp to access files not bundles with the WAR.


      As the context.xml file is not supported in JBoss AS 7 anymore, here my question:

      Is there any way to configure a custom "Resource" for SevletContext.getResource/AsStream()? Could I access the Catalina Container directly somehow? Then I could use Container.setResource(MyDirContextImplementation) to set it directly (maybe from within a ServletContainerInitializer). How could I look up the Catalina Container for my WAR?


      Or any better idea how to make files outside the WAR accessable from SevletContext.getResource()?


      I would appreciate any help on this topic. Thanks

        1 2 Previous Next