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

graphql.servlet.GraphQLContext Maven / Gradle / Ivy

The newest version!
package graphql.servlet;

import org.dataloader.DataLoaderRegistry;

import javax.security.auth.Subject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Part;
import javax.websocket.server.HandshakeRequest;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public class GraphQLContext {
    private HttpServletRequest httpServletRequest;
    private HandshakeRequest handshakeRequest;

    private Subject subject;
    private Map> files;

    private DataLoaderRegistry dataLoaderRegistry;

    public GraphQLContext(HttpServletRequest httpServletRequest, HandshakeRequest handshakeRequest, Subject subject) {
        this.httpServletRequest = httpServletRequest;
        this.handshakeRequest = handshakeRequest;
        this.subject = subject;
    }

    public GraphQLContext(HttpServletRequest httpServletRequest) {
        this(httpServletRequest, null, null);
    }

    public GraphQLContext(HandshakeRequest handshakeRequest) {
        this(null, handshakeRequest, null);
    }

    public GraphQLContext() {
        this(null, null, null);
    }

    public Optional getHttpServletRequest() {
        return Optional.ofNullable(httpServletRequest);
    }

    public Optional getSubject() {
        return Optional.ofNullable(subject);
    }

    public Optional getHandshakeRequest() {
        return Optional.ofNullable(handshakeRequest);
    }

    public Optional>> getFiles() {
        return Optional.ofNullable(files);
    }

    public void setFiles(Map> files) {
        this.files = files;
    }

    public Optional getDataLoaderRegistry() {
        return Optional.ofNullable(dataLoaderRegistry);
    }

    public void setDataLoaderRegistry(DataLoaderRegistry dataLoaderRegistry) {
        this.dataLoaderRegistry = dataLoaderRegistry;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy