continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r571476 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/BuildResultAction.java resources/localization/Continuum.properties resources/xwork.xml webapp/WEB-INF/jsp/buildResult.jsp
Date Fri, 31 Aug 2007 14:17:58 GMT
Author: evenisse
Date: Fri Aug 31 07:17:57 2007
New Revision: 571476

URL: http://svn.apache.org/viewvc?rev=571476&view=rev
Log:
[CONTINUUM-1391] Add "Download as text " link
Submitted by: Olivier Lamy

Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java?rev=571476&r1=571475&r2=571476&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
Fri Aug 31 07:17:57 2007
@@ -20,6 +20,8 @@
  */
 
 import com.opensymphony.webwork.ServletActionContext;
+
+import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.configuration.ConfigurationException;
@@ -32,6 +34,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.List;
 
 /**
@@ -91,13 +94,8 @@
         }
         changeSet = getContinuum().getChangesSinceLastSuccess( getProjectId(), getBuildId()
);
 
-        File buildOutputFile = getContinuum().getConfiguration().getBuildOutputFile( getBuildId(),
getProjectId() );
-
-        if ( buildOutputFile.exists() )
-        {
-            buildOutput = StringEscapeUtils.escapeHtml( FileUtils.fileRead( buildOutputFile
) );
-        }
-
+        buildOutput = getBuildOutputText();
+        
         state = StateGenerator.generate( buildResult.getState(), ServletActionContext.getRequest().getContextPath()
);
 
         return SUCCESS;
@@ -120,6 +118,33 @@
     }
 
 
+    public String buildLogAsText()
+        throws ConfigurationException, IOException
+    {
+        buildOutput = getBuildOutputText();
+        return SUCCESS;
+    }
+    
+    public InputStream getBuildOutputInputStream()
+    throws ConfigurationException, IOException
+    {
+        String outputText = getBuildOutputText();
+        return outputText == null ? null : IOUtils.toInputStream( outputText );
+    }
+
+    private String getBuildOutputText()
+        throws ConfigurationException, IOException
+    {
+        File buildOutputFile = getContinuum().getConfiguration().getBuildOutputFile( getBuildId(),
getProjectId() );
+
+        if ( buildOutputFile.exists() )
+        {
+            return StringEscapeUtils.escapeHtml( FileUtils.fileRead( buildOutputFile ) );
+        }
+        return null;
+    }
+    
+    
     public int getBuildId()
     {
         return buildId;

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=571476&r1=571475&r2=571476&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Fri Aug 31 07:17:57 2007
@@ -463,6 +463,7 @@
 buildResult.changesSinceLastSuccess = Other Changes Since Last Success
 buildResult.generatedReports.title = Generated Reports
 buildResult.generatedReports.surefire = Surefire Report
+buildResult.buildOutput.text = Download as Text
 
 # From ContinuumProjectState
 buildResult.trigger.0 = Scheduled
@@ -632,6 +633,7 @@
 installation.envvar.type.label = Environment Variable
 installation.ant.type.label = ANT
 installation.automaticProfile.label=Create a Profile with the installation name
+
 
 
 

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?rev=571476&r1=571475&r2=571476&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Fri Aug 31 07:17:57
2007
@@ -339,6 +339,12 @@
       <result name="success">/WEB-INF/jsp/buildResult.jsp</result>
     </action>
     
+    <action name="buildOutputText" class="buildResult">
+      <result name="success" type="stream">
+        <param name="inputName">buildOutputInputStream</param>
+      </result>
+    </action>    
+    
     <action name="removeBuildResult" class="buildResult" method="remove">
       <result name="success" type="redirect-action">
         <param name="actionName">buildResults</param>

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp?rev=571476&r1=571475&r2=571476&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/buildResult.jsp Fri
Aug 31 07:17:57 2007
@@ -180,6 +180,11 @@
                 <ww:text name="buildResult.noOutput"/>
             </ww:if>
             <ww:else>
+              <ww:url id="buildOutputTextUrl" action="buildOutputText">
+                <ww:param name="projectId" value="projectId"/>
+                <ww:param name="buildId" value="buildId"/>
+              </ww:url>
+              <ww:a href="%{buildOutputTextUrl}"><ww:text name="buildResult.buildOutput.text"/></ww:a>
               <div style="width:100%; height:500px; overflow:auto; border-style: solid;
border-width: 1px">
                 <pre><ww:property value="buildOutput"/></pre>
               </div>



Mime
View raw message