1 17 18 19 20 package org.apache.lenya.cms.publication; 21 22 25 public class URLInformation { 26 27 private String publicationId = null; 28 private String area = null; 29 private String completeArea = null; 30 private String documentUrl = null; 31 32 36 public String getArea() { 37 return area; 38 } 39 40 44 public String getCompleteArea() { 45 return completeArea; 46 } 47 48 52 public String getDocumentUrl() { 53 return documentUrl; 54 } 55 56 60 public String getPublicationId() { 61 return publicationId; 62 } 63 64 68 public URLInformation(String webappUrl) { 69 assert webappUrl.startsWith("/"); 70 71 String url = webappUrl.substring(1); 72 73 String [] fragments = url.split("/"); 74 this.publicationId = fragments[0]; 75 76 if (fragments.length > 1) { 77 this.completeArea = fragments[1]; 78 79 if (url.length() > (this.publicationId + "/" + completeArea).length()) { 80 this.documentUrl = url.substring((this.publicationId + "/" + completeArea).length()); 81 } 82 else { 83 this.documentUrl = ""; 84 } 85 86 if (completeArea.startsWith(Publication.INFO_AREA_PREFIX)) { 87 this.area = completeArea.substring(Publication.INFO_AREA_PREFIX.length()); 88 } 89 else if (completeArea.startsWith(Publication.SEARCH_AREA_PREFIX)) { 90 this.area = completeArea.substring(Publication.SEARCH_AREA_PREFIX.length()); 91 } 92 else { 93 this.area = completeArea; 94 } 95 } 96 } 97 98 99 } 100 | Popular Tags |