rogerrut    2005/02/03 17:07:20

  Modified:    portals-bridges/perl/src/java/org/apache/portals/bridges/perl
                        PerlPortlet.java
               portals-bridges/php/src/java/org/apache/portals/bridges/php
                        PHPApplicationPortlet.java
  Log:
  Cleanup of code to get the context/real path for PHP and PERL portlets
  
  Revision  Changes    Path
  1.5       +7 -6      
jakarta-jetspeed-2/portals-bridges/perl/src/java/org/apache/portals/bridges/perl/PerlPortlet.java
  
  Index: PerlPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portals-bridges/perl/src/java/org/apache/portals/bridges/perl/PerlPortlet.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PerlPortlet.java  14 Jan 2005 21:07:56 -0000      1.4
  +++ PerlPortlet.java  4 Feb 2005 01:07:19 -0000       1.5
  @@ -31,6 +31,7 @@
   import javax.servlet.http.HttpServletResponseWrapper;
   
   import javax.portlet.PortletConfig;
  +import javax.portlet.PortletContext;
   import javax.portlet.PortletException;
   import javax.portlet.PortletURL;
   import javax.portlet.RenderRequest;
  @@ -268,11 +269,11 @@
        // Open the perl script and extract the perl executable path. It's the 
same way as apache HTTP executes PERL
        String perlExecutable = null;
        
  -     String pathTranslated = 
((HttpServletRequest)((HttpServletRequestWrapper) 
request).getRequest()).getPathTranslated();
  -     String contextPath =   request.getContextPath();
  -     
  -     contextPath = pathTranslated.substring(0, 
pathTranslated.indexOf("webapps") + 7) + contextPath + "/";
  -     contextPath += scriptPath;
  +             PortletContext portletApplication = getPortletContext(); 
  +        String path = portletApplication.getRealPath("/WEB-INF");
  +        String contextPath = path + "/";
  + 
  +        contextPath += scriptPath;
       
        // Build full path to scripts
        if (perlScript.startsWith("/") == false )
  
  
  
  1.3       +5 -3      
jakarta-jetspeed-2/portals-bridges/php/src/java/org/apache/portals/bridges/php/PHPApplicationPortlet.java
  
  Index: PHPApplicationPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portals-bridges/php/src/java/org/apache/portals/bridges/php/PHPApplicationPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PHPApplicationPortlet.java        14 Jan 2005 21:05:50 -0000      1.2
  +++ PHPApplicationPortlet.java        4 Feb 2005 01:07:20 -0000       1.3
  @@ -23,6 +23,7 @@
   import javax.portlet.ActionResponse;
   import javax.portlet.GenericPortlet;
   import javax.portlet.PortletConfig;
  +import javax.portlet.PortletContext;
   import javax.portlet.PortletException;
   import javax.portlet.PortletSession;
   import javax.portlet.PortletURL;
  @@ -273,8 +274,9 @@
           
            // Build the context path
           String contextPath =         request.getContextPath();
  -        String pathTranslated =      
((HttpServletRequest)((HttpServletRequestWrapper) 
request).getRequest()).getPathTranslated();
  -        String rootContextPath = pathTranslated.substring(0, 
pathTranslated.indexOf("webapps") + 7) + contextPath + "/";
  +        PortletContext portletApplication = getPortletContext(); 
  +        String path = portletApplication.getRealPath("/WEB-INF");
  +        String rootContextPath = path + "/";
           
           /*
            * At this point we have all the information to run the PHP servlet:
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to