mcardle     2005/12/23 00:04:40 CET

  Modified files:
    core/src/java/org/jahia/services/esi EsiInvalidation.java 
    core/src/java/org/jahia/params ParamBean.java 
                                   ProcessingContext.java 
  Log:
  * support for "/pid/xx" sub-pages with a UrlKey parent
  
  Revision  Changes    Path
  1.47      +10 -11    jahia/core/src/java/org/jahia/params/ParamBean.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/params/ParamBean.java.diff?r1=1.46&r2=1.47&f=h
  1.21      +11 -11    
jahia/core/src/java/org/jahia/params/ProcessingContext.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/params/ProcessingContext.java.diff?r1=1.20&r2=1.21&f=h
  1.10      +18 -24    
jahia/core/src/java/org/jahia/services/esi/EsiInvalidation.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/esi/EsiInvalidation.java.diff?r1=1.9&r2=1.10&f=h
  
  
  
  Index: EsiInvalidation.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/esi/EsiInvalidation.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- EsiInvalidation.java      22 Dec 2005 12:32:19 -0000      1.9
  +++ EsiInvalidation.java      22 Dec 2005 23:04:39 -0000      1.10
  @@ -39,7 +39,7 @@
   
       /**
        * returns the IP of the first ESI server in the configured list of ESI 
servers
  -      *
  +     *
        */
       public static String getEsiServerIP() {
           return EsiServerIPs[0];
  @@ -47,7 +47,7 @@
   
       /**
        * returns the Port of the first ESI server in the configured list of 
ESI servers
  -      *
  +     *
        */
       public static String getEsiServerPort() {
           return EsiServerPorts[0];
  @@ -150,17 +150,14 @@
   
           //are we dealing with a /pid/xx url format or does the page have a 
UrlKey?
           //if so, make sure we invalidate it via its UrlKey
  -        logger.info("pid: " + pid);
           String pageURLKeyPart = 
paramBean.getPageURLKeyPart(Integer.parseInt(pid));
  -        logger.info("pageURLKeyPart: " + pageURLKeyPart);
  +        String pageURLPart = paramBean.getPageURLPart(Integer.parseInt(pid));
           String pageMarker = pid;
           String pagePrefix = "/pid/";
  -        if (!"".equals(pageURLKeyPart)) {
  -           pageMarker = pageURLKeyPart;
  -           pagePrefix = "";
  +        if (!"".equals(pageURLKeyPart) && "".equals(pageURLPart) ) {
  +            pageMarker = pageURLKeyPart;
  +            pagePrefix = "";
           }
  -        logger.info("pageMarker: " + pageMarker);
  -        logger.info("pagePrefix: " + pagePrefix);
   
           //cycle through each IP/Port combination declared for the current 
instance of Jahia
           //and create an invalidation entry for each combo:
  @@ -169,7 +166,7 @@
               str.append("<OBJECT> \n");
               String extraSlash = 
(uriPrefix.charAt(uriPrefix.length()-1)=='/')?"":"/"; //add trailing slash if 
it's not there already
               str.append("<ADVANCEDSELECTOR 
URIPREFIX=\"").append(uriPrefix).append(extraSlash+"\" HOST=\"")
  -                       
.append(hosts[i]).append(":").append(ports[i]).append("\"");
  +                    
.append(hosts[i]).append(":").append(ports[i]).append("\"");
               //make sure this is a fragment i.e. it contains "__esi_fragment"
               str.append( " 
URIEXP=\"").append(pagePrefix).append(pageMarker).append("\\?__esi_fragment=").append(fragID).append("\"
 > \n");
               //str.append("<OTHER NAME=\"URI\" TYPE=\"REGEX\" VALUE=\"/pid/" 
+ pid + "[^0-9]\"/> ");
  @@ -247,20 +244,17 @@
           //are we dealing with a /pid/xx url format or does the page have a 
UrlKey?
           //if so, make sure we invalidate it via its UrlKey
           String pageURLKeyPart = 
paramBean.getPageURLKeyPart(Integer.parseInt(pid));
  -        logger.info("pid: " + pid);
  -        logger.info("pageURLKeyPart: " + pageURLKeyPart);
  +        String pageURLPart = paramBean.getPageURLPart(Integer.parseInt(pid));
           String pageMarker = pid;
           String pagePrefix = "/pid/";
  -        if (!"".equals(pageURLKeyPart)) {
  -           pageMarker = pageURLKeyPart;
  -           pagePrefix = "";
  +        if (!"".equals(pageURLKeyPart) && "".equals(pageURLPart) ) {
  +            pageMarker = pageURLKeyPart;
  +            pagePrefix = "";
           }
  -        logger.info("pageMarker: " + pageMarker);
  -        logger.info("pagePrefix: " + pagePrefix);
   
  -            //cycle through each IP/Port combination declared for the 
current instance of Jahia
  -            //and create an invalidation entry for each combo:
  -            for (int  i = 0; i < hosts.length; i++) {
  +        //cycle through each IP/Port combination declared for the current 
instance of Jahia
  +        //and create an invalidation entry for each combo:
  +        for (int  i = 0; i < hosts.length; i++) {
   
               str.append("<OBJECT> \n");
               str.append("<ADVANCEDSELECTOR 
URIPREFIX=\"").append(uriPrefix).append("/\" 
HOST=\"").append(hosts[i]).append(":").append(ports[i]).append("\" > \n");
  @@ -297,8 +291,8 @@
       }
   
       /**
  -    * Invalidate only the template from a specific ESI Server address
  -    * */
  +     * Invalidate only the template from a specific ESI Server address
  +     * */
       public static String getTemplateInvalidationString(ParamBean paramBean,
                                                          final String 
uriPrefix,
                                                          final String host,
  @@ -369,7 +363,7 @@
                               getTemplateInvalidationString(paramBean, 
tpl.prefix, Integer.toString(tpl.pageID))
                       );
                       //getTemplateInvalidationString(tpl.prefix, tpl.host, 
tpl.port, Integer.toString(tpl.pageID))
  -               }
  +                }
   
                   pIter = FragsToInvalidate.keySet().iterator();
                   while (pIter.hasNext()) {
  @@ -383,7 +377,7 @@
                       );
                       //getFragmentInvalidationString(frg.prefix, frg.host,
                       //                frg.port, 
Integer.toString(frg.pageID), Integer.toString(frg.fragID))
  -               }
  +                }
               }
   
           } else {
  
  
  
  Index: ProcessingContext.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/params/ProcessingContext.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ProcessingContext.java    22 Dec 2005 12:32:19 -0000      1.20
  +++ ProcessingContext.java    22 Dec 2005 23:04:40 -0000      1.21
  @@ -1604,8 +1604,8 @@
           theUrl.append(EsiURLGenerator.getESIURLPart(this, theUser, siteID));
           //theUrl.append (getLastRequestedPageURLPart (thePage.getID()));
           if (getContentPage() != null) {
  -            theUrl.append(getPageURLPart(getContentPage().getID()));
               theUrl.append(getPageURLKeyPart(getContentPage().getID()));
  +            theUrl.append(getPageURLPart(getContentPage().getID()));
           }
   
           appendParams(theUrl, params);
  @@ -1641,8 +1641,8 @@
           if (languageCode != null) {
               theUrl.append(condAppendURL(LANGUAGE_CODE, languageCode));
           }
  -        theUrl.append(getPageURLPart(pageID));
           theUrl.append(getPageURLKeyPart(pageID));
  +        theUrl.append(getPageURLPart(pageID));
           try {
               return encodeURL(theUrl.toString());
           } catch (NullPointerException npe) {
  @@ -1662,8 +1662,8 @@
           if (languageCode != null) {
               theUrl.append(condAppendURL(LANGUAGE_CODE, languageCode));
           }
  -        theUrl.append(getPageURLPart(page));
           theUrl.append(getPageURLKeyPart(page));
  +        theUrl.append(getPageURLPart(page));
           try {
               return encodeURL(theUrl.toString());
           } catch (NullPointerException npe) {
  @@ -1706,8 +1706,8 @@
           theUrl.append(getSiteURLPart());
           theUrl.append(getOpModeURLPart(getOpMode()));
           if (getContentPage() != null) {
  -            theUrl.append(getPageURLPart(getContentPage().getID()));
               theUrl.append(getPageURLKeyPart(getContentPage().getID()));
  +            theUrl.append(getPageURLPart(getContentPage().getID()));
           }
   
           appendAnchor(theUrl);
  @@ -1737,8 +1737,8 @@
           theUrl.append(getSiteURLPart());
           theUrl.append(getOpModeURLPart(getOpMode()));
           if (getContentPage() != null) {
  -            theUrl.append(getPageURLPart(getContentPage().getID()));
               theUrl.append(getPageURLKeyPart(getContentPage().getID()));
  +            theUrl.append(getPageURLPart(getContentPage().getID()));
           }
           appendParams(theUrl, params);
   
  @@ -2057,8 +2057,8 @@
               theUrl.append(EsiURLGenerator.getESIURLPart(this, theUser, 
siteID));
   
           if (getContentPage() != null) {
  -            theUrl.append(getPageURLPart(getContentPage().getID()));
               theUrl.append(getPageURLKeyPart(getContentPage().getID()));
  +            theUrl.append(getPageURLPart(getContentPage().getID()));
           }
           appendParams(theUrl, params);
   
  @@ -2101,8 +2101,8 @@
                   theUrl.append(this.getEntryStateURLPart("s"));
               }
               theUrl.append(this.getShowRevisionDiffURLPart(revisionDiffID));
  -            theUrl.append(getPageURLPart(getContentPage().getID()));
               theUrl.append(getPageURLKeyPart(getContentPage().getID()));
  +            theUrl.append(getPageURLPart(getContentPage().getID()));
           }
           appendParams(theUrl, params);
           return encodeURL(theUrl.toString());
  @@ -2127,8 +2127,8 @@
               theUrl.append(EsiURLGenerator.getESIURLPart(this, theUser, 
siteID));
   
           if (getContentPage() != null) {
  -            theUrl.append(getPageURLPart(getContentPage().getID()));
               theUrl.append(getPageURLKeyPart(getContentPage().getID()));
  +            theUrl.append(getPageURLPart(getContentPage().getID()));
           }
           return encodeURL(theUrl.toString());
       }
  @@ -2174,8 +2174,8 @@
           theUrl.append(getSiteURLPart(site.getSiteKey()));
           theUrl.append(getOpModeURLPart(ProcessingContext.NORMAL));
           
theUrl.append(EsiURLGenerator.getESITemplURLPart(site.getHomePageID(), this, 
theUser, site.getID()));
  -        theUrl.append(getPageURLPart(site.getHomePageID()));
           theUrl.append(getPageURLKeyPart(site.getHomePageID()));
  +        theUrl.append(getPageURLPart(site.getHomePageID()));
   
           return encodeURL(theUrl.toString());
       }
  @@ -2195,8 +2195,8 @@
           theUrl.append(getSiteURLPart(this.getSite().getSiteKey()));
           theUrl.append(getOpModeURLPart(ProcessingContext.NORMAL));
           
theUrl.append(EsiURLGenerator.getESITemplURLPart(site.getHomePageID(), this, 
theUser, siteID));
  -        theUrl.append(getPageURLPart(this.getSite().getHomePageID()));
           theUrl.append(getPageURLKeyPart(this.getSite().getHomePageID()));
  +        theUrl.append(getPageURLPart(this.getSite().getHomePageID()));
   
           return encodeURL(theUrl.toString());
       }
  @@ -2381,7 +2381,7 @@
       
//-------------------------------------------------------------------------
       // FH   21 Jan. 2001 :  Original implementation
       // MJ   21 Mar. 2001 :  replaced URL params with context PathInfo 
elements
  -    protected String getPageURLPart(final int id) {
  +    public String getPageURLPart(final int id) {
           boolean mustRender = true;
           try {
               final ContentPage contentPage = ContentPage.getPage(id);
  
  
  
  Index: ParamBean.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/params/ParamBean.java,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- ParamBean.java    22 Dec 2005 12:32:19 -0000      1.46
  +++ ParamBean.java    22 Dec 2005 23:04:40 -0000      1.47
  @@ -1783,8 +1783,8 @@
           theUrl.append(EsiURLGenerator.getESIURLPart(this, theUser, siteID));
           //theUrl.append (getLastRequestedPageURLPart (thePage.getID()));
           if (contentPage != null) {
  -            theUrl.append(getPageURLPart(contentPage.getID()));
               theUrl.append(getPageURLKeyPart(contentPage.getID()));
  +            theUrl.append(getPageURLPart(contentPage.getID()));
           }
   
           appendParams(theUrl, params);
  @@ -1821,9 +1821,8 @@
           if (languageCode != null) {
               theUrl.append(condAppendURL(LANGUAGE_CODE, languageCode));
           }
  -        theUrl.append(getPageURLPart(pageID));
           theUrl.append(getPageURLKeyPart(pageID));
  -
  +        theUrl.append(getPageURLPart(pageID));
           try {
               return encodeURL(theUrl.toString());
           } catch (NullPointerException npe) {
  @@ -1864,8 +1863,8 @@
           theUrl.append(getSiteURLPart());
           theUrl.append(getOpModeURLPart(opMode));
           if (contentPage != null) {
  -            theUrl.append(getPageURLPart(contentPage.getID()));
               theUrl.append(getPageURLKeyPart(contentPage.getID()));
  +            theUrl.append(getPageURLPart(contentPage.getID()));
           }
           appendAnchor(theUrl);
   
  @@ -1894,8 +1893,8 @@
           theUrl.append(getSiteURLPart());
           theUrl.append(getOpModeURLPart(opMode));
           if (contentPage != null)  {
  -            theUrl.append(getPageURLPart(contentPage.getID()));
               theUrl.append(getPageURLKeyPart(contentPage.getID()));
  +            theUrl.append(getPageURLPart(contentPage.getID()));
           }
   
           appendParams(theUrl, params);
  @@ -2211,8 +2210,8 @@
               theUrl.append(EsiURLGenerator.getESIURLPart(this, theUser, 
siteID));
   
           if (contentPage != null) {
  -            theUrl.append(getPageURLPart(contentPage.getID()));
               theUrl.append(getPageURLKeyPart(contentPage.getID()));
  +            theUrl.append(getPageURLPart(contentPage.getID()));
           }
   
           appendParams(theUrl, params);
  @@ -2256,8 +2255,8 @@
                   theUrl.append(this.getEntryStateURLPart("s"));
               }
               theUrl.append(this.getShowRevisionDiffURLPart(revisionDiffID));
  -            theUrl.append(getPageURLPart(contentPage.getID()));
               theUrl.append(getPageURLKeyPart(contentPage.getID()));
  +            theUrl.append(getPageURLPart(contentPage.getID()));
           }
           appendParams(theUrl, params);
           return encodeURL(theUrl.toString());
  @@ -2282,8 +2281,8 @@
               theUrl.append(EsiURLGenerator.getESIURLPart(this, theUser, 
siteID));
   
           if (contentPage != null) {
  -            theUrl.append(getPageURLPart(contentPage.getID()));
               theUrl.append(getPageURLKeyPart(contentPage.getID()));
  +            theUrl.append(getPageURLPart(contentPage.getID()));
           }
           return encodeURL(theUrl.toString());
       }
  @@ -2329,8 +2328,8 @@
           theUrl.append(getSiteURLPart(site.getSiteKey()));
           theUrl.append(getOpModeURLPart(ParamBean.NORMAL));
           
theUrl.append(EsiURLGenerator.getESITemplURLPart(site.getHomePageID(), this, 
theUser, site.getID()));
  -        theUrl.append(getPageURLPart(site.getHomePageID()));
           theUrl.append(getPageURLKeyPart(site.getHomePageID()));
  +        theUrl.append(getPageURLPart(site.getHomePageID()));
   
           return encodeURL(theUrl.toString());
       }
  @@ -2349,8 +2348,8 @@
           theUrl.append(getSiteURLPart(this.site.getSiteKey()));
           theUrl.append(getOpModeURLPart(ParamBean.NORMAL));
           
theUrl.append(EsiURLGenerator.getESITemplURLPart(site.getHomePageID(), this, 
theUser, siteID));
  -        theUrl.append(getPageURLPart(this.site.getHomePageID()));
           theUrl.append(getPageURLKeyPart(this.site.getHomePageID()));
  +        theUrl.append(getPageURLPart(this.site.getHomePageID()));
   
           return encodeURL(theUrl.toString());
       }
  @@ -2530,7 +2529,7 @@
       
//-------------------------------------------------------------------------
       // FH   21 Jan. 2001 :  Original implementation
       // MJ   21 Mar. 2001 :  replaced URL params with context PathInfo 
elements
  -    protected final String getPageURLPart(final int id) {
  +    public final String getPageURLPart(final int id) {
           boolean mustRender = true;
           try {
               final ContentPage contentPage = ContentPage.getPage(id);
  

Reply via email to