Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0dffd4
commit 3b58375
Showing
4 changed files
with
142 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/org/jenkinsci/plugins/urltrigger/URLTriggerResolvedEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.jenkinsci.plugins.urltrigger; | ||
|
||
/** | ||
* @author Gregory Boissinot | ||
*/ | ||
public class URLTriggerResolvedEntry { | ||
|
||
private String resolvedURL; | ||
|
||
private URLTriggerEntry entry; | ||
|
||
public URLTriggerResolvedEntry(String resolvedURL, URLTriggerEntry entry) { | ||
if (resolvedURL == null) { | ||
throw new NullPointerException("A resolved URL is required."); | ||
} | ||
this.resolvedURL = resolvedURL; | ||
|
||
if (entry == null) { | ||
throw new NullPointerException("An entry object is required."); | ||
} | ||
this.entry = entry; | ||
} | ||
|
||
public String getResolvedURL() { | ||
return resolvedURL; | ||
} | ||
|
||
public URLTriggerEntry getEntry() { | ||
return entry; | ||
} | ||
|
||
public boolean isURLTriggerValidURL() { | ||
return isHttp() | ||
|| isHttps() | ||
|| isFtp(); | ||
} | ||
|
||
public boolean isHttp() { | ||
return resolvedURL.startsWith("http"); | ||
} | ||
|
||
public boolean isHttps() { | ||
return resolvedURL.startsWith("https"); | ||
} | ||
|
||
public boolean isFtp() { | ||
return resolvedURL.startsWith("ftp"); | ||
} | ||
} |