Remove duplicate variable context
This commit is contained in:
parent
8ea733c637
commit
700aa28779
1 changed files with 3 additions and 3 deletions
|
@ -26,7 +26,7 @@ public class Client<U extends User> extends Thread{
|
||||||
reader.readHeaders();
|
reader.readHeaders();
|
||||||
|
|
||||||
RequestType type = RequestType.valueOf(headers[0]);
|
RequestType type = RequestType.valueOf(headers[0]);
|
||||||
context = new Context(type, headers[1], isLogin(router, type, reader), writer, router.getDefaultHeaders(type));
|
context = new Context(type, headers[1], isLogin(type, reader), writer, router.getDefaultHeaders(type));
|
||||||
router.exec(context, reader, writer);
|
router.exec(context, reader, writer);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
writer.close();
|
writer.close();
|
||||||
|
@ -44,7 +44,7 @@ public class Client<U extends User> extends Thread{
|
||||||
if(context != null) logger.setValue(context);
|
if(context != null) logger.setValue(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
private User isLogin(Router<U> router, RequestType type, HttpReader reader) throws InvalidJwtException{
|
private User isLogin(RequestType type, HttpReader reader) throws InvalidJwtException{
|
||||||
String auth = reader.getHeader("Authorization");
|
String auth = reader.getHeader("Authorization");
|
||||||
if(auth == null) return null;
|
if(auth == null) return null;
|
||||||
auth = auth.substring(7);
|
auth = auth.substring(7);
|
||||||
|
@ -52,7 +52,7 @@ public class Client<U extends User> extends Thread{
|
||||||
return this.router.getUser(auth);
|
return this.router.getUser(auth);
|
||||||
}catch(InvalidJwtException e){
|
}catch(InvalidJwtException e){
|
||||||
try{
|
try{
|
||||||
writer.response(401, router.getDefaultHeaders(type));
|
writer.response(401, this.router.getDefaultHeaders(type));
|
||||||
writer.flush();
|
writer.flush();
|
||||||
writer.close();
|
writer.close();
|
||||||
}catch(Exception ex){}
|
}catch(Exception ex){}
|
||||||
|
|
Loading…
Add table
Reference in a new issue