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

org.yeauty.support.SessionMethodArgumentResolver Maven / Gradle / Ivy

There is a newer version: 0.12.0
Show newest version
package org.yeauty.support;

import io.netty.channel.Channel;
import org.springframework.core.MethodParameter;
import org.yeauty.pojo.Session;

import static org.yeauty.pojo.PojoEndpointServer.SESSION_KEY;

public class SessionMethodArgumentResolver implements MethodArgumentResolver {
    @Override
    public boolean supportsParameter(MethodParameter parameter) {
        return Session.class.isAssignableFrom(parameter.getParameterType());
    }

    @Override
    public Object resolveArgument(MethodParameter parameter, Channel channel, Object object) throws Exception {
        Session session = channel.attr(SESSION_KEY).get();
        return session;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy