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

tech.guyi.ipojo.module.coap.utils.CoapCurrent Maven / Gradle / Ivy

The newest version!
package tech.guyi.ipojo.module.coap.utils;

import org.eclipse.californium.core.server.resources.CoapExchange;

public class CoapCurrent {

    private ThreadLocal exchange = new ThreadLocal<>();
    private ThreadLocal clientIp = new ThreadLocal<>();

    public CoapExchange exchange(){
        return this.exchange.get();
    }
    public void exchange(CoapExchange exchange){
        this.exchange.set(exchange);
        this.clientIp.set(exchange.getSourceAddress().getHostAddress());
    }

    public String clientIp(){
        return this.clientIp.get();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy