[ 
http://jira.magnolia-cms.com/browse/MAGNOLIA-3094?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=26671#action_26671
 ] 

Fabrizio Giustina edited comment on MAGNOLIA-3094 at 2/19/10 3:43 PM:
----------------------------------------------------------------------

well, the patch would be ok if changed to use reflection instead of calling 
servletContext.getServletPath() directly, which would require compiling all the 
code with servlet api 2.5.

{quote}
Granted, it might not be very useful in production, when you often have an 
empty contextPath - but not always, and when you do, using the "real" 
contextPath is probably a better solution than the directory name ({webapp}) 
which can be somewhat random, depending on your container.
{quote}


FYI we are now mostly using a context parameter instead of the webapp name for 
production configuration. That also allow you to start an author and public 
instance starting from the same deployed webapp.
This a sample configuration with two instances mapped to the root context, 
assigned to two different hosts and with the same webapp folder.

{code}
<Server port="9063" shutdown="SHUTDOWN">

  <Service name="Catalina">

    <Connector port="8063" enableLookups="false" protocol="AJP/1.3" 
URIEncoding="UTF-8"/>

    <Engine name="Catalina" defaultHost="">
      <Realm className="org.apache.catalina.realm.MemoryRealm" />

      <Host name="www.mysite.com" appBase="/www/tomcat/empty"
            unpackWARs="true" autoDeploy="false" xmlValidation="false" 
xmlNamespaceAware="false">
               <Context path="" docBase="/www/webapps/mysite" debug="0" >
                <Parameter name="instance" value="mysite-public" 
override="false"/>
            </Context>
      </Host>

      <Host name="author.mysite.com" appBase="/www/tomcatempty"
            unpackWARs="true" autoDeploy="false" xmlValidation="false" 
xmlNamespaceAware="false">
               <Context path="" docBase="/www/webapps/mysite" debug="0" >
                <Parameter name="instance" value="mysite-author" 
override="false"/>
                <Manager 
className="org.apache.catalina.session.PersistentManager" debug="0" 
saveOnRestart="false">
                        <Store 
className="org.apache.catalina.session.FileStore"/>
                </Manager>
            </Context>
      </Host>
    </Engine>
  </Service>
</Server>
{code}


      was (Author: fgiust):
    well, the patch would be ok if changed to use reflection instead of calling 
servletContext.getServletPath() directly, which would require compiling all the 
code with servlet api 2.5.

{code}
Granted, it might not be very useful in production, when you often have an 
empty contextPath - but not always, and when you do, using the "real" 
contextPath is probably a better solution than the directory name ({webapp}) 
which can be somewhat random, depending on your container.
{code}


FYI we are now mostly using a context parameter instead of the webapp name for 
production configuration. That also allow you to start an author and public 
instance starting from the same deployed webapp.
This a sample configuration with two instances mapped to the root context, 
assigned to two different hosts and with the same webapp folder.

{code}
<Server port="9063" shutdown="SHUTDOWN">

  <Service name="Catalina">

    <Connector port="8063" enableLookups="false" protocol="AJP/1.3" 
URIEncoding="UTF-8"/>

    <Engine name="Catalina" defaultHost="">
      <Realm className="org.apache.catalina.realm.MemoryRealm" />

      <Host name="www.mysite.com" appBase="/www/tomcat/empty"
            unpackWARs="true" autoDeploy="false" xmlValidation="false" 
xmlNamespaceAware="false">
               <Context path="" docBase="/www/webapps/mysite" debug="0" >
                <Parameter name="instance" value="mysite-public" 
override="false"/>
            </Context>
      </Host>

      <Host name="author.mysite.com" appBase="/www/tomcatempty"
            unpackWARs="true" autoDeploy="false" xmlValidation="false" 
xmlNamespaceAware="false">
               <Context path="" docBase="/www/webapps/mysite" debug="0" >
                <Parameter name="instance" value="mysite-author" 
override="false"/>
                <Manager 
className="org.apache.catalina.session.PersistentManager" debug="0" 
saveOnRestart="false">
                        <Store 
className="org.apache.catalina.session.FileStore"/>
                </Manager>
            </Context>
      </Host>
    </Engine>
  </Service>
</Server>
{code}

  
> Also use contextPath when resolving magnolia.properties files at startup
> ------------------------------------------------------------------------
>
>                 Key: MAGNOLIA-3094
>                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3094
>             Project: Magnolia
>          Issue Type: Improvement
>          Components: core
>            Reporter: Grégory Joseph
>            Assignee: Philipp Bärfuss
>             Fix For: 4.3
>
>         Attachments: use-contextPath.patch
>
>
> When looking up {{magnolia.properties}} [1] files, we're using the current 
> host name, as well as the webapp folder name (i.e the last element of the 
> path in which the webapp is deployed) - which is not necessarily the servlet 
> context path for the webapp.
> Using the webapp's context path might help in a bunch of situations (while 
> developing I often have a context path differing from the webapp's name. same 
> goes when deploying multiple apps under different vhosts of a single tomcat, 
> for instance; some appservers deploy their webapps in folder whose name 
> doesn't correspond to the contextPath either)
> Unfortunately, {{javax.servlet.ServletContext#getContextPath}} is only 
> available since the 2.5 version of the Servlet API. Can we update ? 
> (marking this as fix-for 4.3, only in the case we can quickly decide on 
> upgrading the servlet api dependency, in which case adding this should be 
> trivial)
> [1] 
> http://documentation.magnolia-cms.com/cookbook/using-a-single-war-file-with-multiple-configurations.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to