Code format, tabs to space, etc.
This commit is contained in:
parent
c707b342aa
commit
32a1bf3875
13 changed files with 588 additions and 516 deletions
15
.idea/modules/httpstatus.iml
generated
15
.idea/modules/httpstatus.iml
generated
|
@ -1,12 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="httpstatus" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.version="1.0.3" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
||||
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../..">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/../../build" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: javax.servlet:javax.servlet-api:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: javax.servlet.jsp:jsp-api:2.2" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.testng:testng:6.9.12" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.beanshell:bsh:2.0b4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: com.beust:jcommander:1.48" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant:1.7.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Gradle: org.apache.ant:ant-launcher:1.7.0" level="project" />
|
||||
</component>
|
||||
</module>
|
15
.idea/modules/httpstatus_main.iml
generated
15
.idea/modules/httpstatus_main.iml
generated
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="httpstatus:main" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="1.0.3" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/../../build/classes/main" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../src/main">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/main/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Gradle: javax.servlet:javax.servlet-api:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: javax.servlet.jsp:jsp-api:2.2" level="project" />
|
||||
</component>
|
||||
</module>
|
22
.idea/modules/httpstatus_test.iml
generated
22
.idea/modules/httpstatus_test.iml
generated
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="httpstatus:test" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="" external.system.module.type="sourceSet" external.system.module.version="1.0.3" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
||||
<output-test url="file://$MODULE_DIR$/../../build/classes/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/../../src/test">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../src/test/resources" type="java-test-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="httpstatus_main" />
|
||||
<orderEntry type="library" name="Gradle: javax.servlet:javax.servlet-api:3.1.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: javax.servlet.jsp:jsp-api:2.2" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.testng:testng:6.9.12" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.beanshell:bsh:2.0b4" level="project" />
|
||||
<orderEntry type="library" name="Gradle: com.beust:jcommander:1.48" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.ant:ant:1.7.0" level="project" />
|
||||
<orderEntry type="library" name="Gradle: org.apache.ant:ant-launcher:1.7.0" level="project" />
|
||||
</component>
|
||||
<component name="TestModuleProperties" production-module="httpstatus_main" />
|
||||
</module>
|
181
HttpStatus.ipr
181
HttpStatus.ipr
|
@ -57,10 +57,6 @@
|
|||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="httpstatus_main" target="1.8" />
|
||||
<module name="httpstatus_test" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
<component name="CopyrightManager" default="">
|
||||
<copyright>
|
||||
|
@ -75,7 +71,7 @@
|
|||
</LanguageOptions>
|
||||
</component>
|
||||
<component name="DependencyValidationManager">
|
||||
<scope name="Source" pattern="file[httpstatus]:src/main/java//*.java" />
|
||||
<scope name="Source" pattern="file[httpstatus]:src/main/java//*.java||file[httpstatus]:src/test/java//*.java" />
|
||||
</component>
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
|
@ -83,12 +79,35 @@
|
|||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="modificationStamps">
|
||||
<map>
|
||||
<entry key="K:/GitHub/CompileOnlyPlugin" value="2933943731758" />
|
||||
<entry key="K:/ect/groovy/SshotCleaner" value="2892856534549" />
|
||||
<entry key="K:/ect/java/Captcha" value="2894636758390" />
|
||||
<entry key="K:/ect/java/FileSplitter" value="2846829504112" />
|
||||
<entry key="K:/ect/java/GZIPFilter" value="2894567636586" />
|
||||
<entry key="K:/ect/java/Lotto" value="2894619520256" />
|
||||
<entry key="K:/ect/java/SshotCleaner" value="1446415498070" />
|
||||
<entry key="K:/ect/java/TorrentCleaner" value="2894593616839" />
|
||||
<entry key="K:/ect/java/click" value="2894595659515" />
|
||||
<entry key="K:/ect/java/iFit2Workout" value="2894645931218" />
|
||||
<entry key="K:/imacination/jtalk" value="2865986493991" />
|
||||
<entry key="$PROJECT_DIR$/../DataProviderTest" value="2935655621669" />
|
||||
<entry key="$PROJECT_DIR$" value="2921271906937" />
|
||||
<entry key="$PROJECT_DIR$/../SemanticVersion" value="2905451385982" />
|
||||
<entry key="$PROJECT_DIR$/../mobibot" value="2865248599040" />
|
||||
<entry key="$PROJECT_DIR$/../semver" value="2921872379706" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="externalProjectsViewState">
|
||||
<projects_view />
|
||||
</option>
|
||||
</component>
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="createEmptyContentRootDirectories" value="true" />
|
||||
<option name="disableWrapperSourceDistributionNotification" value="true" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:/gradle" />
|
||||
<option name="gradleJvm" value="#JAVA_HOME" />
|
||||
|
@ -97,6 +116,7 @@
|
|||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useAutoImport" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
|
@ -157,6 +177,33 @@
|
|||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="mavenHome" value="Bundled (Maven 3)" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||
<entry key="Project Default">
|
||||
<profile-state>
|
||||
<expanded-state>
|
||||
<State>
|
||||
<id />
|
||||
</State>
|
||||
<State>
|
||||
<id>Android Lint</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Java</id>
|
||||
</State>
|
||||
<State>
|
||||
<id>Portability issuesJava</id>
|
||||
</State>
|
||||
</expanded-state>
|
||||
</profile-state>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
||||
<OptionsSetting value="true" id="Add" />
|
||||
<OptionsSetting value="true" id="Remove" />
|
||||
|
@ -170,15 +217,110 @@
|
|||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/httpstatus.iml" filepath="$PROJECT_DIR$/.idea/modules/httpstatus.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/httpstatus_main.iml" filepath="$PROJECT_DIR$/.idea/modules/httpstatus_main.iml" group="httpstatus" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/httpstatus_test.iml" filepath="$PROJECT_DIR$/.idea/modules/httpstatus_test.iml" group="httpstatus" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="GoToClass.includeLibraries" value="false" />
|
||||
<property name="GoToClass.toSaveIncludeLibraries" value="false" />
|
||||
<property name="GoToFile.includeJavaFiles" value="false" />
|
||||
<property name="MemberChooser.sorted" value="false" />
|
||||
<property name="MemberChooser.showClasses" value="true" />
|
||||
<property name="MemberChooser.copyJavadoc" value="false" />
|
||||
<property name="settings.editor.selected.configurable" value="Errors" />
|
||||
<property name="settings.editor.splitter.proportion" value="0.2" />
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
|
||||
<module name="" />
|
||||
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Applet" factoryName="Applet">
|
||||
<option name="WIDTH" value="400" />
|
||||
<option name="HEIGHT" value="300" />
|
||||
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
|
||||
<module />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="VM_PARAMETERS" />
|
||||
<option name="PROGRAM_PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="TEST_OBJECT" value="class" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="Remote" factoryName="Remote">
|
||||
<option name="USE_SOCKET_TRANSPORT" value="true" />
|
||||
<option name="SERVER_MODE" value="false" />
|
||||
<option name="SHMEM_ADDRESS" value="javadebug" />
|
||||
<option name="HOST" value="localhost" />
|
||||
<option name="PORT" value="5005" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="true" type="TestNG" factoryName="TestNG">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="SUITE_NAME" />
|
||||
<option name="PACKAGE_NAME" />
|
||||
<option name="MAIN_CLASS_NAME" />
|
||||
<option name="METHOD_NAME" />
|
||||
<option name="GROUP_NAME" />
|
||||
<option name="TEST_OBJECT" value="CLASS" />
|
||||
<option name="VM_PARAMETERS" value="-ea" />
|
||||
<option name="PARAMETERS" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="ANNOTATION_TYPE" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="singleModule" />
|
||||
</option>
|
||||
<option name="USE_DEFAULT_REPORTERS" value="false" />
|
||||
<option name="PROPERTIES_FILE" />
|
||||
<envs />
|
||||
<properties />
|
||||
<listeners />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
<component name="libraryTable">
|
||||
<library name="Gradle: com.beust:jcommander:1.48">
|
||||
|
@ -233,7 +375,6 @@
|
|||
</library>
|
||||
<library name="Gradle: org.testng:testng:6.9.12">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/Could not find org.testng:testng:6.9.12. Searched in the following locations: https:/repo1.maven.org/maven2/org/testng/testng/6.9.12/testng-6.9.12.pom https:/repo1.maven.org/maven2/org/testng/testng/6.9.12/testng-6.9.12.jar!/" />
|
||||
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.testng/testng/6.9.12/354eba9b34737190bad0a72dd5671683cfbae24d/testng-6.9.12.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
|
@ -242,4 +383,20 @@
|
|||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
<state key="ProjectJDKs.UI">
|
||||
<settings>
|
||||
<last-edited>1.8.x</last-edited>
|
||||
<splitter-proportions>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.19944212" />
|
||||
</list>
|
||||
</option>
|
||||
</splitter-proportions>
|
||||
</settings>
|
||||
</state>
|
||||
</states>
|
||||
</component>
|
||||
</project>
|
278
build.gradle
278
build.gradle
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id "com.jfrog.bintray" version "1.5"
|
||||
id "com.jfrog.bintray" version "1.5"
|
||||
}
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'idea'
|
||||
|
@ -29,26 +29,26 @@ def pkgIssueTrackerUrl = mavenUrl + '/issues'
|
|||
def pkgLabels = ['jsp', 'tag library', 'http', 'status code', 'java']
|
||||
|
||||
def getVersion(isIncrement = false) {
|
||||
def propsFile = 'version.properties'
|
||||
def majorKey = 'version.major'
|
||||
def minorKey = 'version.minor'
|
||||
def patchKey = 'version.patch'
|
||||
def metaKey = 'version.buildmeta'
|
||||
def preKey = 'version.prerelease'
|
||||
if (isIncrement) {
|
||||
ant.propertyfile(file: propsFile) {
|
||||
entry(key: patchKey,
|
||||
type: 'int',
|
||||
default: '-1',
|
||||
operation: '+')
|
||||
}
|
||||
}
|
||||
def p = new Properties()
|
||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||
def metadata = p.getProperty(metaKey, '')
|
||||
def prerelease = p.getProperty(preKey, '')
|
||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||
def propsFile = 'version.properties'
|
||||
def majorKey = 'version.major'
|
||||
def minorKey = 'version.minor'
|
||||
def patchKey = 'version.patch'
|
||||
def metaKey = 'version.buildmeta'
|
||||
def preKey = 'version.prerelease'
|
||||
if (isIncrement) {
|
||||
ant.propertyfile(file: propsFile) {
|
||||
entry(key: patchKey,
|
||||
type: 'int',
|
||||
default: '-1',
|
||||
operation: '+')
|
||||
}
|
||||
}
|
||||
def p = new Properties()
|
||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||
def metadata = p.getProperty(metaKey, '')
|
||||
def prerelease = p.getProperty(preKey, '')
|
||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||
}
|
||||
|
||||
version = getVersion();
|
||||
|
@ -57,178 +57,174 @@ mainClassName = 'net.thauvin.erik.httpstatus.Reasons'
|
|||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'javax.servlet:javax.servlet-api:3.1.0'
|
||||
compile 'javax.servlet.jsp:jsp-api:2.2'
|
||||
compile 'javax.servlet:javax.servlet-api:3.1.0'
|
||||
compile 'javax.servlet.jsp:jsp-api:2.2'
|
||||
|
||||
testCompile 'org.testng:testng:6.9.12'
|
||||
testCompile 'org.testng:testng:6.9.12'
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
||||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||
publications = ['MyPublication']
|
||||
dryRun = false
|
||||
pkg {
|
||||
repo = 'maven'
|
||||
name = mavenName
|
||||
licenses = pkgLicenses
|
||||
desc = mavenDescription
|
||||
websiteUrl = mavenUrl
|
||||
issueTrackerUrl = pkgIssueTrackerUrl
|
||||
vcsUrl = mavenScmCon
|
||||
labels = pkgLabels
|
||||
publicDownloadNumbers = true
|
||||
version {
|
||||
name = project.version
|
||||
desc = 'Version ' + project.version
|
||||
vcsTag = project.version
|
||||
gpg {
|
||||
sign = true
|
||||
}
|
||||
}
|
||||
}
|
||||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
||||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||
publications = ['MyPublication']
|
||||
dryRun = false
|
||||
pkg {
|
||||
repo = 'maven'
|
||||
name = mavenName
|
||||
licenses = pkgLicenses
|
||||
desc = mavenDescription
|
||||
websiteUrl = mavenUrl
|
||||
issueTrackerUrl = pkgIssueTrackerUrl
|
||||
vcsUrl = mavenScmCon
|
||||
labels = pkgLabels
|
||||
publicDownloadNumbers = true
|
||||
version {
|
||||
name = project.version
|
||||
desc = 'Version ' + project.version
|
||||
vcsTag = project.version
|
||||
gpg {
|
||||
sign = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def pomConfig = {
|
||||
licenses {
|
||||
license {
|
||||
name mavenLicense
|
||||
url mavenLicenseUrl
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'ethauvin'
|
||||
name 'Erik C. Thauvin'
|
||||
email 'erik@thauvin.net'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection 'scm:git:' + mavenScmCon
|
||||
developerConnection 'scm:git:' + mavenScmDevCon
|
||||
url mavenScmCon
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name mavenLicense
|
||||
url mavenLicenseUrl
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'ethauvin'
|
||||
name 'Erik C. Thauvin'
|
||||
email 'erik@thauvin.net'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection 'scm:git:' + mavenScmCon
|
||||
developerConnection 'scm:git:' + mavenScmDevCon
|
||||
url mavenScmCon
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
MyPublication(MavenPublication) {
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
groupId mavenGroupId
|
||||
artifactId rootProject.name
|
||||
version project.version
|
||||
publications {
|
||||
MyPublication(MavenPublication) {
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
groupId mavenGroupId
|
||||
artifactId rootProject.name
|
||||
version project.version
|
||||
|
||||
pom.withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('name', mavenName)
|
||||
root.appendNode('description', mavenDescription)
|
||||
root.appendNode('url', mavenUrl)
|
||||
root.children().last() + pomConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
pom.withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('name', mavenName)
|
||||
root.appendNode('description', mavenDescription)
|
||||
root.appendNode('url', mavenUrl)
|
||||
root.children().last() + pomConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the javadoc docs.'
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the javadoc docs.'
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the source code.'
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the source code.'
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
javadoc {
|
||||
title = mavenDescription + ' ' + version
|
||||
options.tags = ['created']
|
||||
options.author = true
|
||||
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
||||
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
||||
if (JavaVersion.current().isJava8Compatible())
|
||||
{
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
title = mavenDescription + ' ' + version
|
||||
options.tags = ['created']
|
||||
options.author = true
|
||||
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
||||
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
||||
if (JavaVersion.current().isJava8Compatible()) {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
doFirst {
|
||||
project.version = getVersion(isRelease)
|
||||
}
|
||||
//options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
doFirst {
|
||||
project.version = getVersion(isRelease)
|
||||
}
|
||||
//options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
}
|
||||
|
||||
|
||||
jar {
|
||||
manifest.attributes('Main-Class': mainClassName)
|
||||
manifest.attributes('Main-Class': mainClassName)
|
||||
}
|
||||
|
||||
clean {
|
||||
delete deployDir
|
||||
delete deployDir
|
||||
}
|
||||
|
||||
test {
|
||||
useTestNG()
|
||||
useTestNG()
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = gradle.gradleVersion
|
||||
gradleVersion = gradle.gradleVersion
|
||||
}
|
||||
|
||||
task copyToDeploy(type: Copy) {
|
||||
from(configurations.runtime) {
|
||||
exclude 'javax.servlet-api-*.jar'
|
||||
exclude 'jsp-api-*.jar'
|
||||
}
|
||||
from jar
|
||||
into deployDir
|
||||
from(configurations.runtime) {
|
||||
exclude 'javax.servlet-api-*.jar'
|
||||
exclude 'jsp-api-*.jar'
|
||||
}
|
||||
from jar
|
||||
into deployDir
|
||||
}
|
||||
|
||||
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||
group = 'Publishing'
|
||||
outputs.dir deployDir
|
||||
inputs.files copyToDeploy
|
||||
mustRunAfter clean
|
||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||
group = 'Publishing'
|
||||
outputs.dir deployDir
|
||||
inputs.files copyToDeploy
|
||||
mustRunAfter clean
|
||||
}
|
||||
|
||||
task release(dependsOn: ['wrapper', 'clean', 'deploy']) << {
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
isRelease = true
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
isRelease = true
|
||||
}
|
||||
|
||||
task pandoc(type: Exec) {
|
||||
group = 'Documentation'
|
||||
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS))
|
||||
{
|
||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||
}
|
||||
else
|
||||
{
|
||||
executable 'pandoc'
|
||||
args pandoc_args
|
||||
}
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
ext.output = {
|
||||
return standardOutput.toString()
|
||||
}
|
||||
group = 'Documentation'
|
||||
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||
} else {
|
||||
executable 'pandoc'
|
||||
args pandoc_args
|
||||
}
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
ext.output = {
|
||||
return standardOutput.toString()
|
||||
}
|
||||
}
|
|
@ -43,66 +43,55 @@ import java.util.TreeMap;
|
|||
* @created 2015-12-02
|
||||
* @since 1.0
|
||||
*/
|
||||
public class Reasons
|
||||
{
|
||||
/**
|
||||
* The resource bundle base name.
|
||||
*/
|
||||
public static final String BUNDLE_BASENAME = "net.thauvin.erik.httpstatus.reasons";
|
||||
public class Reasons {
|
||||
/**
|
||||
* The resource bundle base name.
|
||||
*/
|
||||
public static final String BUNDLE_BASENAME = "net.thauvin.erik.httpstatus.reasons";
|
||||
|
||||
/**
|
||||
* The reason phrases map.
|
||||
*/
|
||||
private static final Map<String, String> REASON_PHRASES = new TreeMap<String, String>();
|
||||
/**
|
||||
* The reason phrases map.
|
||||
*/
|
||||
private static final Map<String, String> REASON_PHRASES = new TreeMap<String, String>();
|
||||
|
||||
/**
|
||||
* Returns the reason phrase for the specified status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
*
|
||||
* @return The reason phrase, or <code>null</code>.
|
||||
*/
|
||||
public static String getReasonPhrase(final int statusCode)
|
||||
{
|
||||
return getReasonPhrase(Integer.toString(statusCode));
|
||||
}
|
||||
// Initializes the reason phrases map.
|
||||
static {
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
|
||||
for (final String key : bundle.keySet()) {
|
||||
REASON_PHRASES.put(key, bundle.getString(key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reason phrase for the specified status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
*
|
||||
* @return The reason phrase, or <code>null</code>.
|
||||
*/
|
||||
public static String getReasonPhrase(final String statusCode)
|
||||
{
|
||||
return REASON_PHRASES.get(statusCode);
|
||||
}
|
||||
/**
|
||||
* Returns the reason phrase for the specified status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
* @return The reason phrase, or <code>null</code>.
|
||||
*/
|
||||
public static String getReasonPhrase(final int statusCode) {
|
||||
return getReasonPhrase(Integer.toString(statusCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the status codes and reason phrases.
|
||||
*
|
||||
* @param args The command line arguments.
|
||||
*/
|
||||
public static void main(final String... args)
|
||||
{
|
||||
for (final Map.Entry<String, String> entry : REASON_PHRASES.entrySet())
|
||||
{
|
||||
System.out.println(entry.getKey() + ": " + entry.getValue());
|
||||
}
|
||||
/**
|
||||
* Returns the reason phrase for the specified status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
* @return The reason phrase, or <code>null</code>.
|
||||
*/
|
||||
public static String getReasonPhrase(final String statusCode) {
|
||||
return REASON_PHRASES.get(statusCode);
|
||||
}
|
||||
|
||||
System.out.println("Total: " + REASON_PHRASES.entrySet().size());
|
||||
}
|
||||
/**
|
||||
* Prints the status codes and reason phrases.
|
||||
*
|
||||
* @param args The command line arguments.
|
||||
*/
|
||||
public static void main(final String... args) {
|
||||
for (final Map.Entry<String, String> entry : REASON_PHRASES.entrySet()) {
|
||||
System.out.println(entry.getKey() + ": " + entry.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the reason phrases map.
|
||||
*/
|
||||
static
|
||||
{
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_BASENAME);
|
||||
for (final String key : bundle.keySet())
|
||||
{
|
||||
REASON_PHRASES.put(key, bundle.getString(key));
|
||||
}
|
||||
}
|
||||
System.out.println("Total: " + REASON_PHRASES.entrySet().size());
|
||||
}
|
||||
}
|
|
@ -41,95 +41,78 @@ import java.io.Writer;
|
|||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
public final class Utils
|
||||
{
|
||||
public final class Utils {
|
||||
|
||||
/**
|
||||
* Disables the default constructor.
|
||||
*
|
||||
* @throws UnsupportedOperationException If the constructor is called.
|
||||
*/
|
||||
private Utils()
|
||||
throws UnsupportedOperationException
|
||||
{
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
/**
|
||||
* Disables the default constructor.
|
||||
*
|
||||
* @throws UnsupportedOperationException If the constructor is called.
|
||||
*/
|
||||
private Utils()
|
||||
throws UnsupportedOperationException {
|
||||
throw new UnsupportedOperationException("Illegal constructor call.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a string value to the specified writer. The default value is used when the actual value is null.
|
||||
*
|
||||
* @param out The writer to output the value to.
|
||||
* @param value The string value.
|
||||
* @param defaultValue The default value.
|
||||
* @param xml The {@link #escapeXml(String) xml} flag.
|
||||
*
|
||||
* @throws IOException f an I/O error occurs.
|
||||
*/
|
||||
public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
|
||||
throws IOException
|
||||
{
|
||||
if (xml)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
out.write(escapeXml(value));
|
||||
}
|
||||
else if (defaultValue != null)
|
||||
{
|
||||
out.write(escapeXml(defaultValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
out.write(value);
|
||||
}
|
||||
else if (defaultValue != null)
|
||||
{
|
||||
out.write(defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Converts <code><</code>, <code>></code>, <code>&</code>, <code>'</code>, <code>"</code>
|
||||
* to their corresponding entity codes.
|
||||
*
|
||||
* @param value The string value to convert.
|
||||
* @return The converted string value.
|
||||
*/
|
||||
public static String escapeXml(final String value) {
|
||||
final StringBuilder escaped = new StringBuilder();
|
||||
|
||||
/**
|
||||
* Converts <code><</code>, <code>></code>, <code>&</code>, <code>'</code>, <code>"</code>
|
||||
* to their corresponding entity codes.
|
||||
*
|
||||
* @param value The string value to convert.
|
||||
*
|
||||
* @return The converted string value.
|
||||
*/
|
||||
public static String escapeXml(final String value)
|
||||
{
|
||||
final StringBuilder escaped = new StringBuilder();
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
final char c = value.charAt(i);
|
||||
switch (c) {
|
||||
case '<':
|
||||
escaped.append("<");
|
||||
break;
|
||||
case '>':
|
||||
escaped.append(">");
|
||||
break;
|
||||
case '&':
|
||||
escaped.append("&");
|
||||
break;
|
||||
case '\'':
|
||||
escaped.append("'");
|
||||
break;
|
||||
case '"':
|
||||
escaped.append(""");
|
||||
break;
|
||||
default:
|
||||
escaped.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < value.length(); i++)
|
||||
{
|
||||
final char c = value.charAt(i);
|
||||
switch (c)
|
||||
{
|
||||
case '<':
|
||||
escaped.append("<");
|
||||
break;
|
||||
case '>':
|
||||
escaped.append(">");
|
||||
break;
|
||||
case '&':
|
||||
escaped.append("&");
|
||||
break;
|
||||
case '\'':
|
||||
escaped.append("'");
|
||||
break;
|
||||
case '"':
|
||||
escaped.append(""");
|
||||
break;
|
||||
default:
|
||||
escaped.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return escaped.toString();
|
||||
}
|
||||
|
||||
return escaped.toString();
|
||||
}
|
||||
/**
|
||||
* Writes a string value to the specified writer. The default value is used when the actual value is null.
|
||||
*
|
||||
* @param out The writer to output the value to.
|
||||
* @param value The string value.
|
||||
* @param defaultValue The default value.
|
||||
* @param xml The {@link #escapeXml(String) xml} flag.
|
||||
* @throws IOException f an I/O error occurs.
|
||||
*/
|
||||
public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
|
||||
throws IOException {
|
||||
if (xml) {
|
||||
if (value != null) {
|
||||
out.write(escapeXml(value));
|
||||
} else if (defaultValue != null) {
|
||||
out.write(escapeXml(defaultValue));
|
||||
}
|
||||
} else {
|
||||
if (value != null) {
|
||||
out.write(value);
|
||||
} else if (defaultValue != null) {
|
||||
out.write(defaultValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,29 +45,24 @@ import java.io.IOException;
|
|||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
public class CauseTag extends XmlSupport
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException
|
||||
{
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
public class CauseTag extends XmlSupport {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException {
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
|
||||
String cause;
|
||||
String cause;
|
||||
|
||||
try
|
||||
{
|
||||
cause = pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage();
|
||||
}
|
||||
catch (NullPointerException ignore)
|
||||
{
|
||||
cause = defaultValue;
|
||||
}
|
||||
try {
|
||||
cause = pageContext.getErrorData().getThrowable().getCause().getLocalizedMessage();
|
||||
} catch (NullPointerException ignore) {
|
||||
cause = defaultValue;
|
||||
}
|
||||
|
||||
Utils.outWrite(out, cause, defaultValue, escapeXml);
|
||||
}
|
||||
Utils.outWrite(out, cause, defaultValue, escapeXml);
|
||||
}
|
||||
}
|
|
@ -44,18 +44,16 @@ import java.io.IOException;
|
|||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
public class CodeTag extends SimpleTagSupport
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException
|
||||
{
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
public class CodeTag extends SimpleTagSupport {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException {
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
|
||||
out.write(String.valueOf(pageContext.getErrorData().getStatusCode()));
|
||||
}
|
||||
out.write(String.valueOf(pageContext.getErrorData().getStatusCode()));
|
||||
}
|
||||
}
|
|
@ -47,50 +47,41 @@ import java.io.IOException;
|
|||
* @created 2015-12-02
|
||||
* @since 1.0
|
||||
*/
|
||||
public class ReasonTag extends XmlSupport
|
||||
{
|
||||
private int statusCode;
|
||||
public class ReasonTag extends XmlSupport {
|
||||
private int statusCode;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException
|
||||
{
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void doTag()
|
||||
throws JspException, IOException {
|
||||
final PageContext pageContext = (PageContext) getJspContext();
|
||||
final JspWriter out = pageContext.getOut();
|
||||
|
||||
try
|
||||
{
|
||||
if (statusCode >= 0)
|
||||
{
|
||||
Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.outWrite(out,
|
||||
Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()),
|
||||
defaultValue,
|
||||
escapeXml);
|
||||
}
|
||||
}
|
||||
catch (IOException ignore)
|
||||
{
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (statusCode >= 0) {
|
||||
Utils.outWrite(out, Reasons.getReasonPhrase(statusCode), defaultValue, escapeXml);
|
||||
} else {
|
||||
Utils.outWrite(out,
|
||||
Reasons.getReasonPhrase(pageContext.getErrorData().getStatusCode()),
|
||||
defaultValue,
|
||||
escapeXml);
|
||||
}
|
||||
} catch (IOException ignore) {
|
||||
// Ignore.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setCode(final int statusCode)
|
||||
{
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
/**
|
||||
* Sets the status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setCode(final int statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -40,37 +40,34 @@ import javax.servlet.jsp.tagext.SimpleTagSupport;
|
|||
* @created 2015-12-03
|
||||
* @since 1.0
|
||||
*/
|
||||
public abstract class XmlSupport extends SimpleTagSupport
|
||||
{
|
||||
/**
|
||||
* Default value string.
|
||||
*/
|
||||
protected String defaultValue;
|
||||
public abstract class XmlSupport extends SimpleTagSupport {
|
||||
/**
|
||||
* Default value string.
|
||||
*/
|
||||
protected String defaultValue;
|
||||
|
||||
/**
|
||||
* Escape XML flag.
|
||||
*/
|
||||
protected boolean escapeXml = true;
|
||||
/**
|
||||
* Escape XML flag.
|
||||
*/
|
||||
protected boolean escapeXml = true;
|
||||
|
||||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param defaultValue The default value.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setDefault(final String defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param defaultValue The default value.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setDefault(final String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link net.thauvin.erik.httpstatus.Utils#escapeXml(String) xml} flag.
|
||||
*
|
||||
* @param escapeXml <code>true</code> or <code>false</code>
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setEscapeXml(final boolean escapeXml)
|
||||
{
|
||||
this.escapeXml = escapeXml;
|
||||
}
|
||||
/**
|
||||
* Sets the {@link net.thauvin.erik.httpstatus.Utils#escapeXml(String) xml} flag.
|
||||
*
|
||||
* @param escapeXml <code>true</code> or <code>false</code>
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setEscapeXml(final boolean escapeXml) {
|
||||
this.escapeXml = escapeXml;
|
||||
}
|
||||
}
|
|
@ -1,35 +1,33 @@
|
|||
/*
|
||||
* ReasonsTest.java
|
||||
*
|
||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
||||
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* Neither the name of this project nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.thauvin.erik.httpstatus;
|
||||
|
||||
|
@ -47,27 +45,23 @@ import java.util.ResourceBundle;
|
|||
* @since 1.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class ReasonsTest
|
||||
{
|
||||
@DataProvider(name = "reasons")
|
||||
public Object[][] reasons()
|
||||
{
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
|
||||
final Object[][] reasons = new String[bundle.keySet().size()][2];
|
||||
int i = 0;
|
||||
for (final String key : bundle.keySet())
|
||||
{
|
||||
reasons[i][0] = key;
|
||||
reasons[i][1] = bundle.getString(key);
|
||||
i++;
|
||||
}
|
||||
return reasons;
|
||||
}
|
||||
public class ReasonsTest {
|
||||
@DataProvider(name = "reasons")
|
||||
public Object[][] reasons() {
|
||||
final ResourceBundle bundle = ResourceBundle.getBundle(Reasons.BUNDLE_BASENAME);
|
||||
final Object[][] reasons = new String[bundle.keySet().size()][2];
|
||||
int i = 0;
|
||||
for (final String key : bundle.keySet()) {
|
||||
reasons[i][0] = key;
|
||||
reasons[i][1] = bundle.getString(key);
|
||||
i++;
|
||||
}
|
||||
return reasons;
|
||||
}
|
||||
|
||||
@Test(dataProvider = "reasons")
|
||||
public void testGetReasonPhrase(String code, String reason)
|
||||
throws Exception
|
||||
{
|
||||
Assert.assertEquals(reason, Reasons.getReasonPhrase(code));
|
||||
}
|
||||
@Test(dataProvider = "reasons")
|
||||
public void testGetReasonPhrase(String code, String reason)
|
||||
throws Exception {
|
||||
Assert.assertEquals(reason, Reasons.getReasonPhrase(code));
|
||||
}
|
||||
}
|
|
@ -1,35 +1,33 @@
|
|||
/*
|
||||
* UtilsTest.java
|
||||
*
|
||||
* Copyright (c) 2015, Erik C. Thauvin (erik@thauvin.net)
|
||||
* Copyright (c) 2015-2016, Erik C. Thauvin (erik@thauvin.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* Neither the name of the author nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
* Neither the name of this project nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.thauvin.erik.httpstatus;
|
||||
|
||||
|
@ -44,15 +42,13 @@ import org.testng.annotations.Test;
|
|||
* @since 1.0
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class UtilsTest
|
||||
{
|
||||
@Test
|
||||
public void testEscapeXml()
|
||||
throws Exception
|
||||
{
|
||||
Assert.assertEquals(
|
||||
"This is a test. We wan't to make sure that everything is <encoded> according the "encoding" parameter & value.",
|
||||
Utils.escapeXml(
|
||||
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" parameter & value."));
|
||||
}
|
||||
public class UtilsTest {
|
||||
@Test
|
||||
public void testEscapeXml()
|
||||
throws Exception {
|
||||
Assert.assertEquals(
|
||||
"This is a test. We wan't to make sure that everything is <encoded> according the "encoding" parameter & value.",
|
||||
Utils.escapeXml(
|
||||
"This is a test. We wan't to make sure that everything is <encoded> according the \"encoding\" parameter & value."));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue