rebue.wheel.vertx.web.HistoryHtml5Handler Maven / Gradle / Ivy
The newest version!
package rebue.wheel.vertx.web;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.handler.PlatformHandler;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import rebue.wheel.api.dic.HttpStatusCodeDic;
/**
* 历史模式为HTML5的处理器
* ...
*
* @author zbz
*/
@Slf4j
@AllArgsConstructor
public class HistoryHtml5Handler implements PlatformHandler {
/**
* 子路径
*/
private String subPath;
@Override
public void handle(RoutingContext routingContext) {
log.info("HistoryHtml5Handler.handle");
HttpServerRequest request = routingContext.request();
HttpServerResponse response = routingContext.response();
if ("GET".equals(request.method().name()) && HttpStatusCodeDic.NOT_FOUND.getCode() == response.getStatusCode()) {
routingContext.reroute(subPath + "index.html");
} else {
routingContext.next();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy