14 Replies Latest reply on Nov 8, 2006 11:00 AM by anil.saldhana

    Web: ENC References

    anil.saldhana

      In trunk, for Web deployments, have we taken care of establishing the ENC references?

      From previous
      AbstractWebDeployer->processEncReferences
      




        • 1. Re: Web: ENC References
          anil.saldhana

          I am testing the addition of the following line at the end of the deploy method of AbstractWarDeployer

           //Process the ENC references
           deployment.processEnc(unit.getClassLoader(), metaData);
          


          • 2. Re: Web: ENC References
            starksm64

            It should be called by the subclass deployment, like from within TomcatDeployment.performDeployInternal. I'll look into it.

            • 3. Re: Web: ENC References
              anil.saldhana

              We previously had it part of AbstractWebDeployer such that the ENC binding happened generically to all web containers integrated. Can we not retain the same pattern in AbstractWebDeployment lest we expect all integrated web deployments to remember to do this ENC binding?

              Or you thinking the subclass web deployments make the decision to process the ENC references?

              • 4. Re: Web: ENC References
                starksm64

                Subclasses had to call WebDescriptorParser.parseWebAppDescriptors which triggered the enc setup. Subclasses have always triggered the enc setup.

                • 5. Re: Web: ENC References
                  anil.saldhana

                  processEnc call on the AbstractWebDeployment should work. I tested it.

                  The JAXWS deployer is throwing a NPE for non-ws web deployments. Once you fix this issue, I will create an issue for that.

                  • 6. Re: Web: ENC References
                    anil.saldhana

                     

                    String contextID = PolicyContext.getContextID();
                    


                    is returning
                    war!


                    • 7. Re: Web: ENC References
                      starksm64

                      Now that this code is getting called, I see that there are errors in the JBossWebMetaDataObjectFactory not updating elements originally created from the web.xml by the WebMetaDataObjectFactory.

                      • 8. Re: Web: ENC References
                        anil.saldhana

                        Ok, I see that you fixed this issue with your commits. Want to ask a basic question (which may have been already asked before)

                         <bean name="WarDeployer" class="org.jboss.web.tomcat.tc6.deployers.TomcatDepl
                        oyer">
                         <property name="authenticators">
                         ....
                        


                        How do I invoke the getAuthenticators method on this bean in any arbitrary bean(pojo) in the MC?

                        With your latest changes, I see that the security context is not bound. A Classloader issue?
                        I am getting null on
                        InitialContext iniCtx = new InitialContext();
                        securityCtx = (Context) iniCtx.lookup("java:comp/env/security");
                        


                        • 9. Re: Web: ENC References
                          anil.saldhana

                          The wrong classloader was being sent to setup the enc.

                          The fix is:

                           // Build the ENC
                          - super.processEnc(loader, metaData);
                          + super.processEnc(webLoader.getClassLoader(), metaData);
                          


                          I have made the change to deployers\TomcatDeployment.java(rev 58175).

                          • 10. Re: Web: ENC References
                            starksm64

                             

                            "anil.saldhana@jboss.com" wrote:
                            Ok, I see that you fixed this issue with your commits. Want to ask a basic question (which may have been already asked before)

                             <bean name="WarDeployer" class="org.jboss.web.tomcat.tc6.deployers.TomcatDepl
                            oyer">
                             <property name="authenticators">
                             ....
                            


                            How do I invoke the getAuthenticators method on this bean in any arbitrary bean(pojo) in the MC?



                            The war deployer would have to be injected or looked up via the kernel registry by the bean wanting to call the method.



                            • 11. Re: Web: ENC References
                              anil.saldhana

                              Since I need access to the WarDeployer property from JBossContextConfig that gets instantiated by tomcat, I will have to go the Kernel Registry route.

                              Regarding the PolicyContext.getContextId() returning "war!", it was due to test deployments having an exclamation at the end of the deployment name. I have fixed it.

                              • 12. Re: Web: ENC References
                                anil.saldhana

                                Talking to Kabir, I am getting the feeling that this issue of obtaining the kernel from a pojo which you have no control of, in instantiation/injection, is a difficult thing to do.

                                Scott, any suggestions on how I can solve this issue?

                                • 13. Re: Web: ENC References
                                  starksm64

                                  It comes down to not being able to have tomcat use existing pojos. Injection is trivial when you can configure a kernel bean. Injecting stuff into objects created via other means is not. For now we should just make the kernel available from the TomcatDeployer and propagate it to the web components or lookup the WarDeployer bean and access the kernel property.

                                  • 14. Re: Web: ENC References
                                    anil.saldhana

                                     

                                    "scott.stark@jboss.org" wrote:
                                    or lookup the WarDeployer bean and access the kernel property.

                                    You suggesting a JNDI lookup?

                                    In JBossContextConfig, available options are JNDI lookup, jmx, Factory or static properties of a pojo.