Search in sources :

Example 36 with ServerResponse

use of io.helidon.webserver.ServerResponse in project metro-jax-ws by eclipse-ee4j.

the class HelidonAdapter method publishWSDLX.

public void publishWSDLX(WSHTTPConnection c) throws IOException {
    // res.status(Http.Status.OK_200);
    // res.headers().add("Content-Type", Collections.singletonList("text/xml;charset=utf-8"));
    // res.send();
    HelidonConnectionImpl con = (HelidonConnectionImpl) c;
    // con.getInput().close();
    SDDocument doc = wsdls.get(con.getQueryString());
    if (doc == null) {
        // writeNotFoundErrorPage(con,"Invalid Request");
        return;
    }
    // con.req.
    ServerResponse res = con.getResponse();
    res.status(Http.Status.OK_200);
    res.headers().add("Content-Type", Collections.singletonList("text/xml;charset=utf-8"));
    // res.send(con.getOutput(), OutputStream.class);
    // res.send("<s>hello</s>");
    // con.setStatus(HttpURLConnection.HTTP_OK);
    // con.setContentTypeResponseHeader("text/xml;charset=utf-8");
    // 
    // //        OutputStream os = con.getProtocol().contains("1.1") ? con.getOutput() : new Http10OutputStream(con);
    // //con.res.
    // OutputStream os = con.getOutput();
    // OutputStream os = new ByteArrayOutputStream();
    MultiFromOutputStream os = IoMulti.outputStreamMulti();
    PortAddressResolver portAddressResolver = getPortAddressResolver(con.getBaseAddress());
    DocumentAddressResolver resolver = getDocumentAddressResolver(portAddressResolver);
    res.send(os.map(byteBuffer -> DataChunk.create(false, true, byteBuffer)));
    doc.writeTo(portAddressResolver, resolver, os);
    // con.res.send(() -> {
    // });
    os.close();
}
Also used : ServerResponse(io.helidon.webserver.ServerResponse) WebModule(com.sun.xml.ws.api.server.WebModule) IoMulti(io.helidon.common.reactive.IoMulti) DataChunk(io.helidon.common.http.DataChunk) URISyntaxException(java.net.URISyntaxException) MultiFromOutputStream(io.helidon.common.reactive.MultiFromOutputStream) DocumentAddressResolver(com.sun.xml.ws.api.server.DocumentAddressResolver) IOException(java.io.IOException) SDDocument(com.sun.xml.ws.api.server.SDDocument) Logger(java.util.logging.Logger) ServerRequest(io.helidon.webserver.ServerRequest) Level(java.util.logging.Level) WSEndpoint(com.sun.xml.ws.api.server.WSEndpoint) HttpAdapterList(com.sun.xml.ws.transport.http.HttpAdapterList) PathMatcher(io.helidon.webserver.PathMatcher) PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver) WSHTTPConnection(com.sun.xml.ws.transport.http.WSHTTPConnection) ServerResponse(io.helidon.webserver.ServerResponse) Packet(com.sun.xml.ws.api.message.Packet) BoundEndpoint(com.sun.xml.ws.api.server.BoundEndpoint) URI(java.net.URI) Http(io.helidon.common.http.Http) Collections(java.util.Collections) HttpAdapter(com.sun.xml.ws.transport.http.HttpAdapter) PortAddressResolver(com.sun.xml.ws.api.server.PortAddressResolver) MultiFromOutputStream(io.helidon.common.reactive.MultiFromOutputStream) SDDocument(com.sun.xml.ws.api.server.SDDocument) DocumentAddressResolver(com.sun.xml.ws.api.server.DocumentAddressResolver)

Example 37 with ServerResponse

use of io.helidon.webserver.ServerResponse in project metro-jax-ws by eclipse-ee4j.

the class HelidonAdapter method addSatellites.

@Override
protected void addSatellites(Packet packet) {
    ServerRequest req = (ServerRequest) packet.get(HelidonProperties.REQUEST);
    ServerResponse res = (ServerResponse) packet.get(HelidonProperties.RESPONSE);
    packet.addSatellite(APISupport.createPropertySet(req, res));
}
Also used : ServerResponse(io.helidon.webserver.ServerResponse) ServerRequest(io.helidon.webserver.ServerRequest)

Aggregations

ServerResponse (io.helidon.webserver.ServerResponse)37 ServerRequest (io.helidon.webserver.ServerRequest)36 Routing (io.helidon.webserver.Routing)23 Logger (java.util.logging.Logger)18 JsonObject (jakarta.json.JsonObject)13 Config (io.helidon.config.Config)12 Map (java.util.Map)12 Service (io.helidon.webserver.Service)11 Json (jakarta.json.Json)11 Optional (java.util.Optional)11 Single (io.helidon.common.reactive.Single)10 DbClient (io.helidon.dbclient.DbClient)10 Test (org.junit.jupiter.api.Test)10 Http (io.helidon.common.http.Http)9 Pokemon (io.helidon.tests.integration.dbclient.appl.model.Pokemon)9 AppResponse (io.helidon.tests.integration.tools.service.AppResponse)9 RemoteTestException (io.helidon.tests.integration.tools.service.RemoteTestException)9 List (java.util.List)9 SecurityContext (io.helidon.security.SecurityContext)8 AbstractService (io.helidon.tests.integration.dbclient.appl.AbstractService)8