All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sirius.web.services.RawServiceCall Maven / Gradle / Ivy

There is a newer version: 22.2.3
Show newest version
/*
 * Made with all the love in the world
 * by scireum in Remshalden, Germany
 *
 * Copyright by scireum GmbH
 * http://www.scireum.de - [email protected]
 */

package sirius.web.services;

import io.netty.handler.codec.http.HttpResponseStatus;
import sirius.kernel.health.Exceptions;
import sirius.kernel.xml.StructuredOutput;
import sirius.web.http.WebContext;

import java.nio.channels.ClosedChannelException;

/**
 * RAW encoder for calls to a {@link sirius.web.services.StructuredService}.
 */
class RawServiceCall extends ServiceCall {

    RawServiceCall(WebContext ctx) {
        super(ctx);
    }

    @Override
    protected void invoke(StructuredService serv) {
        try {
            StructuredOutput output = createOutput();
            serv.call(this, output);
        } catch (ClosedChannelException ex) {
            // If the user unexpectedly closes the connection, we do not need to log an error...
            Exceptions.ignore(ex);
        } catch (Exception t) {
            ctx.respondWith().error(HttpResponseStatus.INTERNAL_SERVER_ERROR, handle(t));
        }
    }

    @Override
    protected StructuredOutput createOutput() {
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy