Compare commits
2 commits
7bbfeea23a
...
5be25735ae
Author | SHA1 | Date | |
---|---|---|---|
|
5be25735ae | ||
|
0e65f6648b |
9 changed files with 18 additions and 9 deletions
|
@ -2,9 +2,9 @@
|
|||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="jose4j-0.9.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="password4j-1.6.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="slf4j-api-2.0.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="C:/Users/jeffc/eclipse-workspace/peer-at-code-framework/PeerAtCodeParser.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="jose4j-0.9.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="password4j-1.8.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="slf4j-api-2.0.12.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="PeerAtCodeParser.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
Binary file not shown.
Binary file not shown.
BIN
password4j-1.8.1.jar
Normal file
BIN
password4j-1.8.1.jar
Normal file
Binary file not shown.
BIN
slf4j-api-2.0.12.jar
Normal file
BIN
slf4j-api-2.0.12.jar
Normal file
Binary file not shown.
Binary file not shown.
|
@ -29,14 +29,17 @@ public class Client<U extends User> extends Thread{
|
|||
writer.flush();
|
||||
writer.close();
|
||||
}catch(InvalidJwtException e){
|
||||
this.router.getExceptionLogger().setValue(e);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
this.router.getExceptionLogger().setValue(e);
|
||||
if(context != null && context.getResponseCode() == 0){
|
||||
try{
|
||||
context.response(500);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}catch(Exception ex){}
|
||||
}catch(Exception ex){
|
||||
this.router.getExceptionLogger().setValue(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(context != null) router.getLogger().setValue(context);
|
||||
|
@ -53,7 +56,9 @@ public class Client<U extends User> extends Thread{
|
|||
writer.response(401, this.router.getDefaultHeaders(type));
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}catch(Exception ex){}
|
||||
}catch(Exception ex){
|
||||
this.router.getExceptionLogger().setValue(ex);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ import java.util.concurrent.LinkedBlockingQueue;
|
|||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import dev.peerat.framework.Locker.Key;
|
||||
|
||||
public class Locker<V>{
|
||||
|
||||
private Map<Key, BlockingQueue<V>> map;
|
||||
|
|
|
@ -30,6 +30,7 @@ public class Router<U extends User>{
|
|||
}
|
||||
|
||||
private Locker<Context> logger;
|
||||
private Locker<Exception> exceptions;
|
||||
private RouteMapper<U>[] mappers;
|
||||
private List<RouteInterceptor> interceptors;
|
||||
private Response noFileFound;
|
||||
|
@ -42,6 +43,7 @@ public class Router<U extends User>{
|
|||
|
||||
public Router() throws Exception{
|
||||
this.logger = new Locker<>();
|
||||
this.exceptions = new Locker<>();
|
||||
int types = RequestType.values().length;
|
||||
this.mappers = new RouteMapper[types];
|
||||
this.interceptors = new ArrayList<>();
|
||||
|
@ -142,6 +144,10 @@ public class Router<U extends User>{
|
|||
return this.logger;
|
||||
}
|
||||
|
||||
public Locker<Exception> getExceptionLogger(){
|
||||
return this.exceptions;
|
||||
}
|
||||
|
||||
public void listen(int port, boolean ssl) throws Exception{
|
||||
if (ssl) { // Not needed with the use of a proxy
|
||||
try {
|
||||
|
|
Loading…
Add table
Reference in a new issue