如何快速更新自己的技术积累?
- 在现有的项目里,深挖技术,比如用到netty可以把相关底层代码和要点都看起来。
- 如果不知道目前的努力方向,就看自己的领导或公司里技术强的人在学什么。
- 知道努力方向后不知道该怎么学,就到处去找相关资料然后练习。
- 学习以后不知道有没有学成,则可以通过面试去检验。
我个人觉得面试也像是一场全新的征程,失败和胜利都是平常之事。所以,劝各位不要因为面试失败而灰心、丧失斗志。也不要因为面试通过而沾沾自喜,等待你的将是更美好的未来,继续加油!
以上面试专题的答小编案整理成面试文档了,文档里有答案详解,以及其他一些大厂面试题目
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.util.WebUtils;
import javax.servlet.ServletInputStream;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.Objects;
import java.util.function.Predicate;
public class WebUtil extends WebUtils {
private static final Logger log = LoggerFactory.getLogger(WebUtil.class);
public static final String USER_AGENT_HEADER = “user-agent”;
private static final String[] IP_HEADER_NAMES = new String[]{“x-forwarded-for”, “Proxy-Client-IP”, “WL-Proxy-Client-IP”, “HTTP_CLIENT_IP”, “HTTP_X_FORWARDED_FOR”};
private static final Predicate IP_PREDICATE = (ip) -> {
return StringUtils.isBlank(ip) || “unknown”.equalsIgnoreCase(ip);
};
public WebUtil() {
}
public static boolean isBody(HandlerMethod handlerMethod) {
ResponseBody responseBody = (ResponseBody) ClassUtil.getAnnotation(handlerMethod, ResponseBody.class);
return responseBody != null;
}
@Nullable
public static String getCookieVal(String name) {
HttpServletRequest request = getRequest();
Assert.notNull(request, “request from RequestContextHolder is null”);
return getCookieVal(request, name);
}
@Nullable
public static String getCookieVal(HttpServletRequest request, String name) {
Cookie cookie = getCookie(request, name);
return cookie != null ? cookie.getValue() : null;
}
public static void removeCookie(HttpServletResponse response, String key) {
setCookie(response, key, (String)null, 0);
}
public static void setCookie(HttpServletResponse response, String name, @Nullable String value, int maxAgeInSeconds) {
Cookie cookie = new Cookie(name, value);
cookie.setPath(“/”);
cookie.setMaxAge(maxAgeInSeconds);
cookie.setHttpOnly(true);
response.addCookie(cookie);
}
public static HttpServletRequest getRequest() {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
return requestAttributes == null ? null : ((ServletRequestAttributes)requestAttributes).getRequest();
}
public static void renderJson(HttpServletResponse response, Object result) {
renderJson(response, result, “application/json;charset=UTF-8”);
}
public static void renderJson(HttpServletResponse response, Object result, String contentType) {
response.setCharacterEncoding(“UTF-8”);
response.setContentType(contentType);
try {
PrintWriter out = response.getWriter();
Throwable var4 = null;
try {
out.append(JsonUtil.toJson(result));
} catch (Throwable var14) {
var4 = var14;
throw var14;
} finally {
if (out != null) {
if (var4 != null) {
try {
out.close();
} catch (Throwable var13) {
var4.addSuppressed(var13);
}
} else {
out.close();
}
}
}
} catch (IOException var16) {
log.error(var16.getMessage(), var16);
}
}
public static String getIP() {
return getIP(getRequest());
}
@Nullable
public static String getIP(@Nullable HttpServletRequest request) {
if (request == null) {
return “”;
} else {
String ip = null;
String[] var2 = IP_HEADER_NAMES;
int var3 = var2.length;
for(int var4 = 0; var4 < var3; ++var4) {
String ipHeader = var2[var4];
ip = request.getHeader(ipHeader);
if (!IP_PREDICATE.test(ip)) {
break;
}
}
if (IP_PREDICATE.test(ip)) {
ip = request.getRemoteAddr();
}
return StringUtils.isBlank(ip) ? null :splitTrim(ip, “,”)[0];
}
}
public static String[] splitTrim(String splitStr,String regex) {
return splitStr.trim().split(regex);
}
学习分享,共勉
这里是小编拿到的学习资源,其中包括“中高级Java开发面试高频考点题笔记300道.pdf”和“Java核心知识体系笔记.pdf”文件分享,内容丰富,囊括了JVM、锁、并发、Java反射、Spring原理、微服务、Zookeeper、数据库、数据结构等大量知识点。同时还有Java进阶学习的知识笔记脑图(内含大量学习笔记)!
资料整理不易,读者朋友可以转发分享下!
Java核心知识体系笔记.pdf
中高级Java开发面试高频考点题笔记300道.pdf
架构进阶面试专题及架构学习笔记脑图
Java架构进阶学习视频分享
06159440)]
架构进阶面试专题及架构学习笔记脑图
[外链图片转存中…(img-gx9mTIfh-1715306159441)]
Java架构进阶学习视频分享