top.cutexingluo.tools.bridge.servlet.adapter.HttpServletResponseDataAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xingtools-pkg-jdk8 Show documentation
Show all versions of xingtools-pkg-jdk8 Show documentation
xingtools 依赖core包,jdk 分类包,对不同的jdk版本提供兼容性
The newest version!
package top.cutexingluo.tools.bridge.servlet.adapter;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import top.cutexingluo.tools.bridge.servlet.HttpServletResponseData;
import top.cutexingluo.tools.common.base.IData;
import top.cutexingluo.tools.common.base.IResult;
import top.cutexingluo.tools.utils.ee.web.front.XTResponseUtil;
import java.io.IOException;
/**
* HttpServletResponseData 适配器
*
* @author XingTian
* @version 1.0.0
* @date 2024/8/12 11:40
*/
@Data
@AllArgsConstructor
public class HttpServletResponseDataAdapter implements HttpServletResponseAdapter, IData {
protected HttpServletResponseData data;
@Contract("_ -> new")
public static @NotNull HttpServletResponseDataAdapter of(HttpServletResponseData data) {
return new HttpServletResponseDataAdapter(data);
}
@Override
public HttpServletResponseData data() {
return data;
}
@Override
public void response(String content, int rspStatusCode) throws IOException {
XTResponseUtil.response(data.getResponse(), content, rspStatusCode);
}
@Override
public void response(IResult result, int rspStatusCode) throws IOException {
XTResponseUtil.response(data.getResponse(), result, rspStatusCode);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy