37 lines
1.0 KiB
Java
37 lines
1.0 KiB
Java
package server.handlers;
|
|
|
|
import com.sun.net.httpserver.HttpExchange;
|
|
import com.sun.net.httpserver.HttpHandler;
|
|
import server.db.UserAccessor;
|
|
import server.handlers.common.BaseHanlder;
|
|
import shared.communication.params.ValidateUser_Param;
|
|
import shared.communication.responses.ValidateUser_Res;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
|
|
public class StaticsHandler extends BaseHanlder {
|
|
|
|
private HttpHandler handler = new HttpHandler() {
|
|
@Override
|
|
public void handle(HttpExchange exchange) throws IOException {
|
|
String prefix = "db/statics";
|
|
String uri = exchange.getRequestURI().toString();
|
|
File staticFile;
|
|
try {
|
|
staticFile = new File(prefix+uri);
|
|
} catch (Exception e) {
|
|
writeServerErrorResponse(exchange);
|
|
return;
|
|
}
|
|
|
|
writeFileResponse(exchange, staticFile);
|
|
}
|
|
};
|
|
|
|
public HttpHandler getHandler() {
|
|
return handler;
|
|
}
|
|
}
|