5 Replies Latest reply on Mar 8, 2010 7:21 PM by Craig Bensemann

    resolving server contextPath

    Craig Bensemann Novice

      I have JBPM emails configured to use seam mail. I also have in my components.xml defined a couple of factories for the context path the application is deployed under and the base path url of the server.


      <factory name="contextPath" scope="APPLICATION" value="#{facesContext.externalContext.request.contextPath}" auto-create="true"/>
           
      <factory name="basePath" scope="APPLICATION"
           value="#{facesContext.externalContext.request.scheme}://#{facesContext.externalContext.request.serverName}:#{facesContext.externalContext.request.serverPort}#{contextPath}/" auto-create="true"/>



      I would like them to be application scope so that they are not always calculated and so that I can then use the values in seam mail.


      This works fine if after server startup these variables are initialised by someone browsing to a page and any subsequent email sent by jbpm (such as reminder emails) work fine. However if the first thing to request these variables is a scheduelled job to send out reminder emails (jbpm seems to do this on startup if there are outstanding tasks) then the basePath is resolved to ://:0/project. This is due to the Renderer used for sending emails initialising MockHttpServletRequest.


      So hopefullly you have followed all of that. My questions are:


      1. Is it possible to have these factories initialised on startup to their correct values so that if they are called by jbpm prior to the user browsing to a page the values are still correct.


      2. Is there a better way to work out the server url / context path than using the facesContext



      thanks