java

http错误码

public static final int INVALID_PARAM = 400; // invalid param(参数错误)
public static final int NO_RIGHT = 403; // no right(鉴权失败)
public static final int NOT_FOUND = 404; //not found
public static final int CONFLICT = 409; //conflict(写并发冲突)
public static final int SERVER_ERROR = 500; //server异常,如超时
public static final int BAD_GATEWAY = 502; //路由异常,如nginx后面的Server挂掉
public static final int OVER_THRESHOLD = 503; //超过server端的限流阈值

请求的参数位置

request->coyoteRequest->parameters->paramHashValues

java获取请求路径相关信息

例如请求路径:http://localhost:8080/projname/servlet/DemoServlet.do

名称 代码 结果
协议名 request.getScheme(); http
服务器 request.getServerName(); localhost
端口 request.getServerPort(); 8080
项目名 request.getContextPath(); /projname
ServletPath request.getServletPath(); /servlet/DemoServlet
RequestURI request.getRequestURI(); /projname/servlet/DemoServlet.do
整个请求路径 request.getRequestURL(); 详见请求路径
项目的路径 request.getSession().getServletContext().getRealPath(""); D:/Tomcat6.0/webapps

java方法内获取类名方法名

String clazz = Thread.currentThread().getStackTrace() [1].getClassName();
String method = Thread.currentThread().getStackTrace()[1].getMethodName();

lambda

List authoritys = Arrays.asList(roleNameArr).stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList());

多线程

@Async("asyncServiceExecutor")
[OR]
ExecutorService exec = Executors.newFixedThreadPool(10);
exec.execute(() -> {});
exec.shutdown();

RocketMQ启动不了broker

c:/user/用户名/store所有文件全部删除

posted @ 2020-09-29 15:38  微云mis  阅读(97)  评论(0)    收藏  举报