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/10/21 18:37:38 UTC

cvs commit: cocoon-lenya/src/webapp/lenya/content/util redirect-language.xsp

andreas     2003/10/21 09:37:38

  Added:       src/webapp/lenya/xslt/util redirect-language.xsl
               src/webapp/lenya/content/util redirect-language.xsp
  Log:
  redirecting to new language version after create-language
  
  Revision  Changes    Path
  1.1                  cocoon-lenya/src/webapp/lenya/xslt/util/redirect-language.xsl
  
  Index: redirect-language.xsl
  ===================================================================
  <?xml version="1.0" encoding="UTF-8" ?>
  
  <!--
      Document   : redirect.xsl
      Created on : 20. Mai 2003, 12:11
      Author     : andreas
      Description:
          Purpose of transformation follows.
  -->
  
  <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns="http://www.w3.org/1999/xhtml"
      >
  
  <xsl:template match="/redirect">
    <html>
      <head>
        <meta http-equiv="Refresh" content="0;url={@url}"/>
      </head>
      <body>
      </body>
    </html>
  </xsl:template>
  
  </xsl:stylesheet> 
  
  
  
  1.1                  cocoon-lenya/src/webapp/lenya/content/util/redirect-language.xsp
  
  Index: redirect-language.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!--
  This is a task preview screen that is used to create session attributes etc.
  for a TaskAction execution.
  -->
  
  <xsp:page
         language="java"
         xmlns:xsp="http://apache.org/xsp"
         xmlns:session="http://apache.org/cocoon/session/1.0"
         xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
         xmlns:xsp-request="http://apache.org/xsp/request/2.0"
         >
  
  <xsp:structure>
    <xsp:include>org.apache.lenya.cms.publication.Document</xsp:include>
    <xsp:include>org.apache.lenya.cms.publication.DocumentBuilder</xsp:include>
  </xsp:structure>
  
  <redirect>
    <xsp:logic>
      try {
        Document document = (Document)
            <input:get-attribute module="page-envelope" type="object" name="document"/>;
        DocumentBuilder builder = document.getPublication().getDocumentBuilder();
          
        String language = parameters.getParameter("language");
        Document languageDocument = builder.buildLanguageVersion(document, language);
        String url = languageDocument.getDocumentURL();
        String filename = url.substring(url.lastIndexOf("/") + 1);
          
        <xsp:attribute name="url"><xsp:expr>filename</xsp:expr></xsp:attribute>
      }
      catch (Exception e) {
          throw new ProcessingException(e);
      }
    </xsp:logic>
  
  </redirect>
  
  </xsp:page>
  
  

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