Search in sources :

Example 1 with StreamingOutput

use of jakarta.ws.rs.core.StreamingOutput in project jaxrs-api by eclipse-ee4j.

the class StreamOutputTest method testIOException.

@GET
@Path("IOExceptionTest")
public Response testIOException() {
    StreamingOutput so = new StreamingOutput() {

        public void write(OutputStream output) throws IOException {
            throw new IOException("TckIOExceptionTest");
        }
    };
    Response response = Response.ok(so).build();
    return response;
}
Also used : Response(jakarta.ws.rs.core.Response) OutputStream(java.io.OutputStream) StreamingOutput(jakarta.ws.rs.core.StreamingOutput) IOException(java.io.IOException) Path(jakarta.ws.rs.Path) GET(jakarta.ws.rs.GET)

Example 2 with StreamingOutput

use of jakarta.ws.rs.core.StreamingOutput in project jaxrs-api by eclipse-ee4j.

the class JAXRSClientIT method clientStreamingOutputWriterTest.

/*
   * @testName: clientStreamingOutputWriterTest
   * 
   * @assertion_ids: JAXRS:SPEC:70;
   * 
   * @test_Strategy: See Section 4.2.4 for a list of entity providers that MUST
   * be supported by all JAX-RS implementations
   */
@Test
public void clientStreamingOutputWriterTest() throws Fault {
    setProperty(Property.REQUEST_HEADERS, buildContentType(MediaType.APPLICATION_FORM_URLENCODED_TYPE));
    StreamingOutput output = new StringStreamingOutput(entity);
    standardWriterInvocation(output);
}
Also used : StringStreamingOutput(ee.jakarta.tck.ws.rs.common.impl.StringStreamingOutput) StreamingOutput(jakarta.ws.rs.core.StreamingOutput) StringStreamingOutput(ee.jakarta.tck.ws.rs.common.impl.StringStreamingOutput) Test(org.junit.jupiter.api.Test)

Aggregations

StreamingOutput (jakarta.ws.rs.core.StreamingOutput)2 StringStreamingOutput (ee.jakarta.tck.ws.rs.common.impl.StringStreamingOutput)1 GET (jakarta.ws.rs.GET)1 Path (jakarta.ws.rs.Path)1 Response (jakarta.ws.rs.core.Response)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 Test (org.junit.jupiter.api.Test)1