Search in sources :

Example 1 with UrlInfo

use of org.webpieces.router.impl.UrlInfo 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);
}
Also used : UrlInfo(org.webpieces.router.impl.UrlInfo) RedirectResponse(org.webpieces.router.impl.dto.RedirectResponse) RequestContext(org.webpieces.ctx.api.RequestContext) Method(java.lang.reflect.Method) RouterRequest(org.webpieces.ctx.api.RouterRequest)

Aggregations

Method (java.lang.reflect.Method)1 RequestContext (org.webpieces.ctx.api.RequestContext)1 RouterRequest (org.webpieces.ctx.api.RouterRequest)1 UrlInfo (org.webpieces.router.impl.UrlInfo)1 RedirectResponse (org.webpieces.router.impl.dto.RedirectResponse)1