4 Replies Latest reply on Aug 11, 2007 2:53 PM by zacwolfe

    Changing the A4J resource location?

    zacwolfe

      Is it possible to take all the JavaScript files that A4J requires and place them in different location, external to the a4j jar file, and then use those instead?

      For various reasons, in our production environment none of the various provided methods for telling A4J from where to load the javascript resources work. For example, when I deploy an A4J app the ajax.js javascript is loaded at the top of the generated page by the following:

      <script type='text/javascript' src='/auth/ajax/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript'></script>
      


      However, the way our apps are locked down (by a system outside of our control), the Javascript is unreachable at the specified location, regardless of how I try to configure it. As a result, of course, nothing A4J-related works.

      The only way I was able to use A4J in production was to hack org.ajax4jsf.framework.util.config.WebXml.java and hardcode the resource url to point to an external location of my choosing (i.e. ../js/AJAX.js).

      So now the generated script tag looks like this:

      <script type='text/javascript' src='../js/AJAX.js'></script>


      Obviously this is an ugly hack. Is there a better way?


        • 1. Re: Changing the A4J resource location?

          That is sad situation. So, you have some crazy locked configuration that never assume that JS content can be generated by code? What about images? Other resources (css)?

          We perhaps can implement something for static resources, but we have tons of dynamically generated resources in Richfaces.

          That is general problem now, many frameworks make an assumptions, and sometimes it is bad assemptions.

          • 2. Re: Changing the A4J resource location?
            zacwolfe

            Yes basically we have a list of "accepted" url's and anything outside of that is automatically redirected to the login page. So, in order to make A4J work without hacks I'd have to submit the additional urls to be added to this list by somebody in a different department...doable but annoying.

            I know this is probably more my problem than a problem with A4J, but it would just be nice to have the option.

            • 3. Re: Changing the A4J resource location?

              May be you can just add resource location to the accepted URL list?

              I think your request is reasonable, but it hard to determine overall impact. And again, we have tons of dynamically generated resources.

              Question - how your system determine that something like http://myserver.foo.bar/myapp/pages/just-stuff-not-fluff.jsf
              is valid, but
              http://myserver.foo.bar/myapp/a4j.res/js/ASDEQWHGGFDFDF.js.jsf
              is not?

              • 4. Re: Changing the A4J resource location?
                zacwolfe

                Yes adding the resource location to the list of accepted URL's would probably work but just less convenient--I'd have to enlist the assistance of people outside of my immediate team since we don't have control over much of our deployment environment (which sucks!).

                Additionally, each piece of additional environmental setup required is just another opportunity for screw-ups to happen when they finally promote our code to the production environment.

                But I think you answered my question. I can see the advantages of having dynamically generated resources in a typical environment and, from the lack of other people making similar complaints, it looks like our environment is anything but typical.