use of org.webpieces.router.impl.dto.RedirectResponse in project webpieces by deanhiller.
the class ProxyStreamHandle method sendRedirectAndClearCookie.
public XFuture<StreamWriter> sendRedirectAndClearCookie(RouterRequest req, String badCookieName) {
RedirectResponse httpResponse = new RedirectResponse(false, req.isHttps, req.domain, req.port, req.relativePath);
Http2Response response = responseCreator.createRedirect(originalHttp2Request, httpResponse);
responseCreator.addDeleteCookie(response, badCookieName);
log.info("sending REDIRECT(due to bad cookie) response responseSender=" + this);
return process(response);
}
use of org.webpieces.router.impl.dto.RedirectResponse in project webpieces by deanhiller.
the class ResponseProcessorHtml method createRawRedirect.
public XFuture<Void> createRawRedirect(MethodMeta meta, RawRedirect controllerResponse, ProxyStreamHandle handle) {
RequestContext ctx = meta.getCtx();
String url = controllerResponse.getUrl();
if (url.startsWith("http")) {
return handle.sendRedirect(new RedirectResponse(url));
}
RouterRequest request = ctx.getRequest();
RedirectResponse redirectResponse = new RedirectResponse(false, request.isHttps, request.domain, request.port, url);
return handle.sendRedirect(redirectResponse);
}
use of org.webpieces.router.impl.dto.RedirectResponse in project webpieces by deanhiller.
the class ProxyStreamHandle method createRedirect.
private XFuture<Void> createRedirect(HttpPort requestedPort, RouteId id, Map<String, Object> args, boolean isAjaxRedirect) {
if (methodMeta == null) {
throw new IllegalStateException("Somehow methodMeta is missing. This method should only be called from filters and controllers");
}
RequestContext ctx = methodMeta.getCtx();
RouterRequest request = ctx.getRequest();
Method method = methodMeta.getLoadedController().getControllerMethod();
UrlInfo urlInfo = reverseRoutes.routeToUrl(id, method, args, ctx, requestedPort);
boolean isSecure = urlInfo.isSecure();
int port = urlInfo.getPort();
String path = urlInfo.getPath();
RedirectResponse redirectResponse = new RedirectResponse(isAjaxRedirect, isSecure, request.domain, port, path);
return sendRedirect(redirectResponse);
}
Aggregations