com.xqbase.util.servlet.Servlets Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xqbase-util-jdk17 Show documentation
Show all versions of xqbase-util-jdk17 Show documentation
Reusable Java components for www.xqbase.com
package com.xqbase.util.servlet;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Servlets {
static ThreadLocal local = new ThreadLocal<>();
ServletContext context;
HttpServletRequest request;
HttpServletResponse response;
public static ServletContext getContext() {
Servlets servlets = local.get();
return servlets == null ? null : servlets.context;
}
public static HttpServletRequest getRequest() {
Servlets servlets = local.get();
return servlets == null ? null : servlets.request;
}
public static HttpServletResponse getResponse() {
Servlets servlets = local.get();
return servlets == null ? null : servlets.response;
}
}