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

org.bdware.doip.audit.writer.ServerContext Maven / Gradle / Ivy

The newest version!
package org.bdware.doip.audit.writer;

import io.netty.channel.ChannelHandlerContext;

public class ServerContext extends EndpointContext {

    private final ChannelHandlerContext ctx;
    private final String serviceDoid;

    public ServerContext(ChannelHandlerContext ctx, String serviceDoid) {
        this.ctx = ctx;
        this.serviceDoid = serviceDoid;
    }

    public String getClientIP() {
        try {
            return extractIP(ctx.channel().remoteAddress());
        } catch (Exception e) {
            return null;
        }
    }

    public String getClientDoId() {
        return "unknown";
    }

    public String getServerIP() {
        try {
            return extractIP(ctx.channel().localAddress());
        } catch (Exception e) {
            return null;
        }
    }

    public String getServerDoId() {
        try {
            return serviceDoid;
        } catch (Exception e) {
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy