You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2006/01/15 02:31:16 UTC
svn commit: r369155 - in /maven/maven-1/plugins/trunk/linkcheck: ./
src/main/org/apache/maven/plugin/linkcheck/
src/main/org/apache/maven/plugin/linkcheck/validation/
src/test/org/apache/maven/plugin/linkcheck/validation/ xdocs/
Author: aheritier
Date: Sat Jan 14 17:31:04 2006
New Revision: 369155
URL: http://svn.apache.org/viewcvs?rev=369155&view=rev
Log:
PR: MPLINKCHECK-19
Using NTLM proxy
Modified:
maven/maven-1/plugins/trunk/linkcheck/project.properties
maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java
maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java
maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java
maven/maven-1/plugins/trunk/linkcheck/xdocs/changes.xml
Modified: maven/maven-1/plugins/trunk/linkcheck/project.properties
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/linkcheck/project.properties?rev=369155&r1=369154&r2=369155&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/project.properties (original)
+++ maven/maven-1/plugins/trunk/linkcheck/project.properties Sat Jan 14 17:31:04 2006
@@ -24,6 +24,8 @@
maven.proxy.port \
maven.proxy.username \
maven.proxy.password \
+ maven.proxy.ntlm.host \
+ maven.proxy.ntlm.domain \
maven.mode.online
maven.jar.override = on
Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java?rev=369155&r1=369154&r2=369155&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/LinkCheck.java Sat Jan 14 17:31:04 2006
@@ -58,6 +58,10 @@
private static final long MEG = 1024 * 1024;
+ private static final String MAVEN_PROXY_NTLM_HOST = "maven.proxy.ntlm.host";
+
+ private static final String MAVEN_PROXY_NTLM_DOMAIN = "maven.proxy.ntlm.domain";
+
private File basedir;
private String cache;
@@ -169,7 +173,9 @@
if ( ctx.getOnline().booleanValue() )
{
lvm.addLinkValidator( new OnlineHTTPLinkValidator( ctx.getProxyHost(), ctx.getProxyPort(), ctx
- .getProxyUserName(), ctx.getProxyPassword() ) );
+ .getProxyUserName(), ctx.getProxyPassword(), (String) ctx.getVariable( MAVEN_PROXY_NTLM_HOST ),
+ (String) ctx
+ .getVariable( MAVEN_PROXY_NTLM_DOMAIN ) ) );
}
else
{
Modified: maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java?rev=369155&r1=369154&r2=369155&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/main/org/apache/maven/plugin/linkcheck/validation/OnlineHTTPLinkValidator.java Sat Jan 14 17:31:04 2006
@@ -6,6 +6,7 @@
import java.io.IOException;
import java.net.URL;
+import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
@@ -13,6 +14,7 @@
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.NTCredentials;
import org.apache.commons.httpclient.StatusLine;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.methods.HeadMethod;
@@ -41,9 +43,14 @@
private String proxyPass;
+ private String proxyNtlmHost;
+
+ private String proxyNtlmDomain;
+
private transient HttpClient cl;
- public OnlineHTTPLinkValidator( String proxyHost, String proxyPort, String proxyUser, String proxyPass )
+ public OnlineHTTPLinkValidator( String proxyHost, String proxyPort, String proxyUser, String proxyPass,
+ String proxyNtlmHost, String proxyNtlmDomain )
{
if ( proxyHost == null || proxyHost.trim().equals( "" ) )
{
@@ -67,6 +74,11 @@
}
this.proxyUser = proxyUser;
this.proxyPass = proxyPass;
+ if ( proxyNtlmHost != null && proxyNtlmHost.trim().equals( "" ) )
+ {
+ this.proxyNtlmHost = proxyNtlmHost;
+ this.proxyNtlmDomain = proxyNtlmDomain;
+ }
}
initHttpClient();
}
@@ -159,8 +171,17 @@
{
if ( LOG.isDebugEnabled() )
LOG.debug( "Proxy User:" + proxyUser );
- state
- .setProxyCredentials( null, null, new UsernamePasswordCredentials( this.proxyUser, this.proxyPass ) );
+ Credentials credentials;
+ if ( this.proxyNtlmHost != null )
+ {
+ credentials = new NTCredentials( this.proxyUser, this.proxyPass, this.proxyNtlmHost,
+ this.proxyNtlmDomain );
+ }
+ else
+ {
+ credentials = new UsernamePasswordCredentials( this.proxyUser, this.proxyPass );
+ }
+ state.setProxyCredentials( null, null, credentials );
}
}
Modified: maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java?rev=369155&r1=369154&r2=369155&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java (original)
+++ maven/maven-1/plugins/trunk/linkcheck/src/test/org/apache/maven/plugin/linkcheck/validation/HTTPLinkValidatorTest.java Sat Jan 14 17:31:04 2006
@@ -41,7 +41,8 @@
{
hlv = new OnlineHTTPLinkValidator( System.getProperty( "maven.proxy.host" ), System
.getProperty( "maven.proxy.port" ), System.getProperty( "maven.proxy.username" ), System
- .getProperty( "maven.proxy.password" ) );
+ .getProperty( "maven.proxy.password" ), System.getProperty( "maven.proxy.ntlm.host" ), System
+ .getProperty( "maven.proxy.ntlm.domain" ) );
assertEquals( LinkValidationResult.VALID, checkLink( "http://www.apache.org" ).getStatus() );
assertEquals( LinkValidationResult.ERROR, checkLink( "http://www.example.com>);" ).getStatus() );
Modified: maven/maven-1/plugins/trunk/linkcheck/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/linkcheck/xdocs/changes.xml?rev=369155&r1=369154&r2=369155&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/linkcheck/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/linkcheck/xdocs/changes.xml Sat Jan 14 17:31:04 2006
@@ -34,6 +34,7 @@
<action dev="aheritier" type="fix" issue="MPLINKCHECK-22">Sites requiring authentication are reported as NOT FOUND.</action>
<action dev="aheritier" type="fix" issue="MPLINKCHECK-21">java.lang.NumberFormatException if proxy port is setted to ""</action>
<action dev="aheritier" type="fix" issue="MPLINKCHECK-20" due-to="Ignacio G. Mac Dowell">StackOverflowError processing apidocs/index-all.html.</action>
+ <action dev="aheritier" type="add" issue="MPLINKCHECK-19">Support NTLM proxies.</action>
<action dev="aheritier" type="update" issue="MPLINKCHECK-10">"Moved Permanently" sites are reported as a warning and not as an error.</action>
<action dev="aheritier" type="add">If maven is in offline mode the report doesn't test external urls. A warning is displayed in the report.</action>
<action dev="brett" type="update">Make compatible with Maven 1.1</action>