-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test coverage for backport 3.8.6-41411
- Loading branch information
1 parent
36e3af3
commit a1ed08a
Showing
7 changed files
with
108 additions
and
5 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...reactive/src/main/java/io/quarkus/ts/http/advanced/reactive/HeadersMessageBodyWriter.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,28 @@ | ||
package io.quarkus.ts.http.advanced.reactive; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
|
||
import jakarta.ws.rs.WebApplicationException; | ||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.MultivaluedMap; | ||
import jakarta.ws.rs.ext.MessageBodyWriter; | ||
import jakarta.ws.rs.ext.Provider; | ||
|
||
@Provider | ||
public class HeadersMessageBodyWriter implements MessageBodyWriter<String> { | ||
|
||
@Override | ||
public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { | ||
return String.class.isAssignableFrom(aClass) && MediaType.TEXT_PLAIN_TYPE.isCompatible(mediaType); | ||
} | ||
|
||
@Override | ||
public void writeTo(String s, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, | ||
MultivaluedMap multivaluedMap, OutputStream outputStream) throws IOException, WebApplicationException { | ||
final String content = "Headers response: " + s; | ||
outputStream.write(content.getBytes()); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
http/http-advanced/src/main/java/io/quarkus/ts/http/advanced/HeadersMessageBodyWriter.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,28 @@ | ||
package io.quarkus.ts.http.advanced; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
|
||
import jakarta.ws.rs.WebApplicationException; | ||
import jakarta.ws.rs.core.MediaType; | ||
import jakarta.ws.rs.core.MultivaluedMap; | ||
import jakarta.ws.rs.ext.MessageBodyWriter; | ||
import jakarta.ws.rs.ext.Provider; | ||
|
||
@Provider | ||
public class HeadersMessageBodyWriter implements MessageBodyWriter<String> { | ||
|
||
@Override | ||
public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { | ||
return String.class.isAssignableFrom(aClass) && MediaType.TEXT_PLAIN_TYPE.isCompatible(mediaType); | ||
} | ||
|
||
@Override | ||
public void writeTo(String s, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, | ||
MultivaluedMap multivaluedMap, OutputStream outputStream) throws IOException, WebApplicationException { | ||
final String content = "Headers response: " + s; | ||
outputStream.write(content.getBytes()); | ||
} | ||
} |
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