tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1519352 - in /tomcat/maven-plugin/trunk: common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/ tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/ tomcat7-maven-plugin/src/main/java/o...
Date Mon, 02 Sep 2013 06:10:32 GMT
Author: olamy
Date: Mon Sep  2 06:10:32 2013
New Revision: 1519352

URL: http://svn.apache.org/r1519352
Log:
[MTOMCAT-165] http status 401 reported as success
report fix to tomcat 7 mojo.

Modified:
    tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages.properties
    tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages_fr.properties
    tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractDeployMojo.java
    tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractI18NTomcat6Mojo.java
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractTomcat7Mojo.java
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java
    tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/UndeployMojo.java

Modified: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages.properties
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages.properties?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages.properties
(original)
+++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages.properties
Mon Sep  2 06:10:32 2013
@@ -108,4 +108,8 @@ ReloadMojo.reloadingApp = Reloading appl
 
 # AbstractI18NTomcat6Mojo
 
-AbstractI18NTomcat6Mojo.tomcatHttStatusError = Tomcat return http status error: {0}
\ No newline at end of file
+AbstractI18NTomcat6Mojo.tomcatHttStatusError = Tomcat return http status error: {0}
+
+#AbstractTomcat7Mojo
+
+AbstractTomcat7Mojo.tomcatHttStatusError = Tomcat return http status error: {0}

Modified: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages_fr.properties
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages_fr.properties?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages_fr.properties
(original)
+++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/resources/org/apache/tomcat/maven/common/messages/messages_fr.properties
Mon Sep  2 06:10:32 2013
@@ -108,4 +108,8 @@ ReloadMojo.reloadingApp = Rechargement d
 
 # AbstractI18NTomcat6Mojo
 
-AbstractI18NTomcat6Mojo.tomcatHttStatusError = Tomcat a retourn\u00E9 un code HTTP en erreur:
{0}
\ No newline at end of file
+AbstractI18NTomcat6Mojo.tomcatHttStatusError = Tomcat a retourn\u00E9 un code HTTP en erreur:
{0}
+
+#AbstractTomcat7Mojo
+
+AbstractTomcat7Mojo.tomcatHttStatusError = Tomcat a retourn\u00E9 un code HTTP en erreur:
{0}
\ No newline at end of file

Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractDeployMojo.java?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractDeployMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractDeployMojo.java
Mon Sep  2 06:10:32 2013
@@ -190,10 +190,11 @@ public abstract class AbstractDeployMojo
         getLog().info( messagesProvider.getMessage( "AbstractDeployMojo.deployingContext",
getDeployedURL() ) );
 
         URL contextURL = getContextFile().toURL();
-        
-        TomcatManagerResponse tomcatResponse = getManager().deployContext( getPath(), contextURL,
isUpdate(), getTag() ) ;
-        
-        checkTomcatResponse(tomcatResponse) ;  
+
+        TomcatManagerResponse tomcatResponse =
+            getManager().deployContext( getPath(), contextURL, isUpdate(), getTag() );
+
+        checkTomcatResponse( tomcatResponse );
     }
 
     /**

Modified: tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractI18NTomcat6Mojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractI18NTomcat6Mojo.java?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractI18NTomcat6Mojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat6-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat6/AbstractI18NTomcat6Mojo.java
Mon Sep  2 06:10:32 2013
@@ -61,10 +61,10 @@ public abstract class AbstractI18NTomcat
      * @param tomcatResponse response of tomcat return by TomcatManager class
      * @throws MojoExecutionException if HTTP status code greater than 400 (included)
      */
-    protected void checkTomcatResponse( final TomcatManagerResponse tomcatResponse )
+    protected void checkTomcatResponse( TomcatManagerResponse tomcatResponse )
         throws MojoExecutionException
     {
-        final int statusCode = tomcatResponse.getStatusCode();
+        int statusCode = tomcatResponse.getStatusCode();
 
         if ( statusCode >= 400 )
         {

Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractTomcat7Mojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractTomcat7Mojo.java?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractTomcat7Mojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/AbstractTomcat7Mojo.java
Mon Sep  2 06:10:32 2013
@@ -19,8 +19,10 @@ package org.apache.tomcat.maven.plugin.t
  */
 
 import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.tomcat.maven.common.deployer.TomcatManagerResponse;
 import org.apache.tomcat.maven.common.messages.MessagesProvider;
 
 /**
@@ -49,4 +51,25 @@ public abstract class AbstractTomcat7Moj
     {
         return path;
     }
+
+    /**
+     * Check response of Tomcat to know if ok or not.
+     *
+     * @param tomcatResponse response of tomcat return by TomcatManager class
+     * @throws org.apache.maven.plugin.MojoExecutionException if HTTP status code greater
than 400 (included)
+     */
+    protected void checkTomcatResponse( TomcatManagerResponse tomcatResponse )
+        throws MojoExecutionException
+    {
+        int statusCode = tomcatResponse.getStatusCode();
+
+        if ( statusCode >= 400 )
+        {
+            getLog().error( messagesProvider.getMessage( "AbstractTomcat7Mojo.tomcatHttStatusError",
statusCode ) );
+
+            throw new MojoExecutionException(
+                messagesProvider.getMessage( "AbstractTomcat7Mojo.tomcatHttStatusError",
statusCode ) + ": "
+                    + tomcatResponse.getHttpResponseBody() );
+        }
+    }
 }

Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployMojo.java
Mon Sep  2 06:10:32 2013
@@ -22,6 +22,7 @@ package org.apache.tomcat.maven.plugin.t
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.tomcat.maven.common.deployer.TomcatManagerException;
+import org.apache.tomcat.maven.common.deployer.TomcatManagerResponse;
 import org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo;
 
 import java.io.File;
@@ -215,6 +216,11 @@ public abstract class AbstractDeployMojo
 
         URL warURL = getWarFile().toURL();
         URL contextURL = getContextFile().toURL();
-        log( getManager().deployContext( getPath(), contextURL, warURL, isUpdate(), getTag()
).getHttpResponseBody() );
+
+        TomcatManagerResponse tomcatResponse = getManager().deployContext( getPath(), contextURL,
warURL, isUpdate(), getTag() );
+
+        checkTomcatResponse( tomcatResponse );
+
+        log( tomcatResponse.getHttpResponseBody() );
     }
 }

Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/AbstractDeployWarMojo.java
Mon Sep  2 06:10:32 2013
@@ -85,6 +85,8 @@ public class AbstractDeployWarMojo
         TomcatManagerResponse tomcatManagerResponse =
             getManager().deploy( getPath(), warFile, isUpdate(), getTag(), warFile.length()
);
 
+        checkTomcatResponse( tomcatManagerResponse );
+
         getLog().info( "tomcatManager status code:" + tomcatManagerResponse.getStatusCode()
+ ", ReasonPhrase:"
                            + tomcatManagerResponse.getReasonPhrase() );
 

Modified: tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/UndeployMojo.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/UndeployMojo.java?rev=1519352&r1=1519351&r2=1519352&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/UndeployMojo.java
(original)
+++ tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/deploy/UndeployMojo.java
Mon Sep  2 06:10:32 2013
@@ -23,6 +23,7 @@ import org.apache.maven.plugin.MojoExecu
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.tomcat.maven.common.deployer.TomcatManagerException;
+import org.apache.tomcat.maven.common.deployer.TomcatManagerResponse;
 import org.apache.tomcat.maven.plugin.tomcat7.AbstractWarCatalinaMojo;
 
 import java.io.IOException;
@@ -61,7 +62,13 @@ public class UndeployMojo
 
         try
         {
-            log( getManager().undeploy( getPath() ).getHttpResponseBody() );
+
+            TomcatManagerResponse tomcatResponse = getManager().undeploy( getPath() );
+
+            checkTomcatResponse( tomcatResponse );
+
+            log( tomcatResponse.getHttpResponseBody() );
+
         }
         catch ( TomcatManagerException e )
         {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message