Skip to content

Commit

Permalink
Merge branch '3.7.x' into 3.8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelamo committed Oct 26, 2022
2 parents 84d9b7a + 29f2295 commit 909d46f
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 123 deletions.
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ managed-micronaut-problem = "2.5.1"
managed-micronaut-rabbitmq = "3.3.0"
managed-micronaut-r2dbc = "4.0.0"
managed-micronaut-reactor = "2.4.1"
managed-micronaut-redis = "5.3.0"
managed-micronaut-redis = "5.3.1"
managed-micronaut-rss = "3.2.0"
managed-micronaut-rxjava1 = "1.0.0"
managed-micronaut-rxjava2 = "1.3.0"
Expand Down Expand Up @@ -413,6 +413,7 @@ log4j = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j"
logbook-netty = { module = "org.zalando:logbook-netty", version.ref = "logbook-netty" }

micronaut-docs = { module = "io.micronaut.docs:micronaut-docs-asciidoc-config-props", version.ref = "micronaut-docs" }
micronaut-runtime-groovy = { module = "io.micronaut.groovy:micronaut-runtime-groovy", version.ref = "managed-micronaut-groovy" }

mysql-driver = { module = "mysql:mysql-connector-java" }

Expand Down
1 change: 1 addition & 0 deletions http-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {
api project(":router")
compileOnly libs.kotlinx.coroutines.core
compileOnly libs.kotlinx.coroutines.reactor
compileOnly(libs.micronaut.runtime.groovy)
implementation libs.managed.reactor
annotationProcessor project(":inject-java")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public HateoasErrorResponseProcessor(JsonConfiguration jacksonConfiguration) {
* Constructor for binary compatibility. Equivalent to
* {@link HateoasErrorResponseProcessor#HateoasErrorResponseProcessor(JsonConfiguration)}
*
* @deprecated Use {@link HateoasErrorResponseProcessor#HateoasErrorResponseProcessor(JsonConfiguration)} instead.
* @param jacksonConfiguration the configuration to use for processing.
* @deprecated Use {@link HateoasErrorResponseProcessor(JsonConfiguration)}
*/
Expand All @@ -61,6 +62,11 @@ public HateoasErrorResponseProcessor(JacksonConfiguration jacksonConfiguration)
@Override
@NonNull
public MutableHttpResponse<JsonError> processResponse(@NonNull ErrorContext errorContext, @NonNull MutableHttpResponse<?> response) {
return getJsonErrorMutableHttpResponse(alwaysSerializeErrorsAsList, errorContext, response);
}

@NonNull
static MutableHttpResponse<JsonError> getJsonErrorMutableHttpResponse(boolean alwaysSerializeErrorsAsList, ErrorContext errorContext, MutableHttpResponse<?> response) {
if (errorContext.getRequest().getMethod() == HttpMethod.HEAD) {
return (MutableHttpResponse<JsonError>) response;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2017-2022 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.http.server.exceptions.response;

import io.micronaut.context.annotation.Replaces;
import io.micronaut.context.annotation.Requires;
import io.micronaut.context.env.groovy.GroovyPropertySourceLoader;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.http.MutableHttpResponse;
import io.micronaut.http.hateoas.JsonError;
import io.micronaut.json.JsonConfiguration;
import jakarta.inject.Singleton;

/**
* @deprecated Replacement is no longer necessary for Micronaut Framework 4.0 since {@link io.micronaut.http.server.exceptions.response.HateoasErrorResponseProcessor} jackson constructor will be removed.
* @author Tim Yates
* @since 3.7.3
*/
@Deprecated
@Singleton
@Requires(classes = GroovyPropertySourceLoader.class)
@Replaces(HateoasErrorResponseProcessor.class)
public class HateoasErrorResponseProcessorReplacement implements ErrorResponseProcessor<JsonError> {

private final boolean alwaysSerializeErrorsAsList;

public HateoasErrorResponseProcessorReplacement(JsonConfiguration jacksonConfiguration) {
this.alwaysSerializeErrorsAsList = jacksonConfiguration.isAlwaysSerializeErrorsAsList();
}

@Override
@NonNull
public MutableHttpResponse<JsonError> processResponse(@NonNull ErrorContext errorContext,
@NonNull MutableHttpResponse<?> response) {
return HateoasErrorResponseProcessor.getJsonErrorMutableHttpResponse(alwaysSerializeErrorsAsList, errorContext, response);
}
}

0 comments on commit 909d46f

Please sign in to comment.