Replace String literals with HttpHeaders constants
Recipe ID
org.openrewrite.java.spring.http.ReplaceStringLiteralsWithHttpHeadersConstantsArtifactorg.openrewrite.recipe:rewrite-springReplace String literals with org.springframework.http.HttpHeaders constants.
Composite recipeMSAL
Add to your build
Get a download tokenThis recipe is Moderne licensed, so the token must belong to a Moderne customer. It replaces YOUR_DOWNLOAD_TOKEN below.
~/.gradle/gradle.properties
codeGenomeUsername=you@example.com
codeGenomeToken=YOUR_DOWNLOAD_TOKEN
build.gradle.kts
plugins {
id("org.openrewrite.rewrite") version("latest.release")
}
rewrite {
activeRecipe("org.openrewrite.java.spring.http.ReplaceStringLiteralsWithHttpHeadersConstants")
}
repositories {
mavenCentral()
maven {
url = uri("https://artifacts.codegenomeproject.org/maven")
credentials {
username = providers.gradleProperty("codeGenomeUsername").get()
password = providers.gradleProperty("codeGenomeToken").get()
}
}
}
dependencies {
rewrite("org.openrewrite.recipe:rewrite-spring:6.40.0")
}
Then run
./gradlew rewriteRunUsage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.java.spring.http.ReplaceStringLiteralsWithHttpHeadersConstantsIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-spring:RELEASEDefinition
This recipe runs the following recipes in order.
- Replace String literal with constant
org.springframework.http.HttpHeaders.ACCEPTorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCEPT_CHARSETorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCEPT_ENCODINGorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCEPT_LANGUAGEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCEPT_PATCHorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCEPT_RANGESorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALSorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERSorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_ALLOW_METHODSorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGINorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERSorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_MAX_AGEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERSorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ACCESS_CONTROL_REQUEST_METHODorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.AGEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ALLOWorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.AUTHORIZATIONorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CACHE_CONTROLorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONNECTIONorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONTENT_ENCODINGorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONTENT_DISPOSITIONorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONTENT_LANGUAGEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONTENT_LENGTHorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONTENT_LOCATIONorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONTENT_RANGEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.CONTENT_TYPEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.COOKIEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.DATEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ETAGorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.EXPECTorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.EXPIRESorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.FROMorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.HOSTorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.IF_MATCHorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.IF_MODIFIED_SINCEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.IF_NONE_MATCHorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.IF_RANGEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.IF_UNMODIFIED_SINCEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.LAST_MODIFIEDorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.LINKorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.LOCATIONorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.MAX_FORWARDSorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.ORIGINorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.PRAGMAorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.PROXY_AUTHENTICATEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.PROXY_AUTHORIZATIONorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.RANGEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.REFERERorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.RETRY_AFTERorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.SERVERorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.SET_COOKIEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.SET_COOKIE2org.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.TEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.TRAILERorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.TRANSFER_ENCODINGorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.UPGRADEorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.USER_AGENTorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.VARYorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.VIAorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.WARNINGorg.openrewrite.java.ReplaceStringLiteralWithConstant - Replace String literal with constant
org.springframework.http.HttpHeaders.WWW_AUTHENTICATEorg.openrewrite.java.ReplaceStringLiteralWithConstant
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats