Skip to content

Commit

Permalink
update to Micronaut 4.6.1 (#862)
Browse files Browse the repository at this point in the history
* fix(deps): update micronaut to v4.6.1
* fix(deps): update dependency io.micronaut.serde:micronaut-serde-bom to v2.11.0
* test 4.4.0
* SQL 5.8.1
* validation 4.7.0
* platform 4.5.1
* Replace usage of `io.micronaut.http.body.RawMessageBodyHandler`
  • Loading branch information
sdelamo authored Aug 21, 2024
1 parent dd76bc0 commit 27c5ec7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
micronaut = "4.5.4"
micronaut-platform = "4.3.1"
micronaut = "4.6.1"
micronaut-platform = "4.5.1"
micronaut-docs = '2.0.0'
micronaut-test = "4.0.1"
micronaut-test = "4.4.0"
micronaut-data = "4.9.0"
micronaut-sql = "5.7.0"
micronaut-sql = "5.8.1"
micronaut-security = "4.9.1"
micronaut-serde = "2.10.2"
micronaut-validation = "4.6.1"
micronaut-serde = "2.11.0"
micronaut-validation = "4.7.0"
micronaut-gradle-plugin = "4.4.2"
managed-freemarker = "2.3.33"
managed-handlebars = "4.3.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,33 @@

import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.core.io.buffer.ByteBuffer;
import io.micronaut.core.type.Argument;
import io.micronaut.core.type.Headers;
import io.micronaut.core.type.MutableHeaders;
import io.micronaut.http.HttpHeaders;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.MediaType;
import io.micronaut.http.body.RawMessageBodyHandler;
import io.micronaut.http.body.MessageBodyWriter;
import io.micronaut.http.codec.CodecException;
import io.micronaut.http.context.ServerRequestContext;
import io.micronaut.views.ModelAndView;
import io.micronaut.views.ModelAndViewRenderer;
import io.micronaut.views.exceptions.ViewRenderingException;
import jakarta.inject.Singleton;
import org.reactivestreams.Publisher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Collections;

/**
* {@link RawMessageBodyHandler} implementation for {@link HtmxResponse}.
* {@link io.micronaut.http.body.MessageBodyHandler} implementation for {@link HtmxResponse}.
* @author Sergio del Amo
* @since 5.2.0
* @param <T> The model type
*/
@Internal
@Singleton
final class HtmxResponseRawMessageBodyHandler<T> implements RawMessageBodyHandler<HtmxResponse<T>> {
final class HtmxResponseRawMessageBodyHandler<T> implements MessageBodyWriter<HtmxResponse<T>> {
private static final Logger LOG = LoggerFactory.getLogger(HtmxResponseRawMessageBodyHandler.class);

private final ModelAndViewRenderer<T, HttpRequest<?>> modelAndViewRenderer;
Expand All @@ -59,21 +52,6 @@ public HtmxResponseRawMessageBodyHandler(ModelAndViewRenderer<T, HttpRequest<?>>
this.modelAndViewRenderer = modelAndViewRenderer;
}

@Override
public @NonNull Collection<? extends Class<?>> getTypes() {
return Collections.singletonList(HtmxResponse.class);
}

@Override
public @NonNull Publisher<? extends HtmxResponse<T>> readChunked(@NonNull Argument<HtmxResponse<T>> type, @Nullable MediaType mediaType, @NonNull Headers httpHeaders, @NonNull Publisher<ByteBuffer<?>> input) {
throw new UnsupportedOperationException("Not supported");
}

@Override
public @Nullable HtmxResponse<T> read(@NonNull Argument<HtmxResponse<T>> type, @Nullable MediaType mediaType, @NonNull Headers httpHeaders, @NonNull InputStream inputStream) throws CodecException {
throw new UnsupportedOperationException("Not supported");
}

@Override
public void writeTo(@NonNull Argument<HtmxResponse<T>> type, @NonNull MediaType mediaType, HtmxResponse<T> object, @NonNull MutableHeaders outgoingHeaders, @NonNull OutputStream outputStream) throws CodecException {
HttpRequest<?> httpRequest = ServerRequestContext.currentRequest().orElse(null);
Expand Down

0 comments on commit 27c5ec7

Please sign in to comment.