You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2003/09/05 16:40:22 UTC

cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/publication/xsp DocumentLanguagesHelper.java

andreas     2003/09/05 07:40:22

  Modified:    src/java/org/apache/lenya/cms/publication/xsp
                        DocumentLanguagesHelper.java
  Log:
  added getInfoUrl() method
  
  Revision  Changes    Path
  1.2       +30 -4     cocoon-lenya/src/java/org/apache/lenya/cms/publication/xsp/DocumentLanguagesHelper.java
  
  Index: DocumentLanguagesHelper.java
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/publication/xsp/DocumentLanguagesHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DocumentLanguagesHelper.java	3 Sep 2003 14:12:20 -0000	1.1
  +++ DocumentLanguagesHelper.java	5 Sep 2003 14:40:22 -0000	1.2
  @@ -103,7 +103,34 @@
        * @throws ProcessingException if the document for the given language could not be created.
        */
       public String getUrl(String language) throws ProcessingException {
  -        String url = null;
  +        Document doc = getDocument(language);
  +        return pageEnvelope.getContext() + doc.getCompleteURL();
  +    }
  +
  +    /**
  +     * Compute the info area URL for a given language and the parameters given in the contructor.
  +     * 
  +     * @param language the language
  +     * 
  +     * @return the url for the given language
  +     * 
  +     * @throws ProcessingException if the document for the given language could not be created.
  +     */
  +    public String getInfoUrl(String language) throws ProcessingException {
  +        Document doc = getDocument(language);
  +        return pageEnvelope.getContext() + doc.getCompleteInfoURL();
  +    }
  +
  +    /**
  +     * Create a document for a given language and the parameters given in the contructor.
  +     * 
  +     * @param language the language
  +     * 
  +     * @return the document with the given language
  +     * 
  +     * @throws ProcessingException if the document for the given language could not be created.
  +     */
  +    protected Document getDocument(String language) throws ProcessingException {
           DocumentBuilder builder = DefaultDocumentBuilder.getInstance();
           String canonicalURL =
               builder.buildCanonicalUrl(
  @@ -120,7 +147,6 @@
           } catch (DocumentBuildException e) {
               throw new ProcessingException(e);
           }
  -        url = pageEnvelope.getContext() + doc.getCompleteURL();
  -        return url;
  +        return doc;
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org