@Override public void end() { rsp.end(); }
public void handle(final Client<?, ?> client, final HttpAction action) { if (!rsp.committed()) { int statusCode = action.getCode(); // on error, let jooby handle it if (statusCode >= 400) { if (client instanceof IndirectBasicAuthClient) { rsp.status(statusCode).end(); } else { throw new Err(statusCode, action); } } } } }
private static Route[] routes(final Set<Route.Definition> routeDefs, final String method, final String path, final MediaType type, final List<MediaType> accept) { List<Route> routes = findRoutes(routeDefs, method, path, type, accept); routes.add(RouteImpl.fallback((req, rsp, chain) -> { if (!rsp.status().isPresent()) { // 406 or 415 Err ex = handle406or415(routeDefs, method, path, type, accept); if (ex != null) { throw ex; } // 405 ex = handle405(routeDefs, method, path, type, accept); if (ex != null) { throw ex; } // favicon.ico if (path.equals("/favicon.ico")) { // default /favicon.ico handler: rsp.status(Status.NOT_FOUND).end(); } else { throw new Err(Status.NOT_FOUND, req.path(true)); } } }, method, path, "err", accept)); return routes.toArray(new Route[routes.size()]); }
@Override public void handle(final Request req, final Response rsp) throws Throwable { String path = req.path(); URL resource = resolve(req, path); if (resource != null) { String localpath = resource.getPath(); int jarEntry = localpath.indexOf("!/"); if (jarEntry > 0) { localpath = localpath.substring(jarEntry + 2); } URLAsset asset = new URLAsset(resource, path, MediaType.byPath(localpath).orElse(MediaType.octetstream)); if (asset.exists()) { // cdn? if (cdn != null) { String absUrl = cdn + path; rsp.redirect(absUrl); rsp.end(); } else { doHandle(req, rsp, asset); } } } else if (statusCode > 0) { throw new Err(statusCode); } }
rsp.status(Status.OK).end();
ctx.setSessionAttribute(Pac4jConstants.REQUESTED_URL, requestedUrl); client.redirect(ctx); rsp.end(); } catch (HttpAction ex) { new AuthResponse(rsp).handle(client, ex);
@Override public void end() { rsp.end(); }
public void handle(final Client<?, ?> client, final HttpAction action) { if (!rsp.committed()) { int statusCode = action.getCode(); // on error, let jooby handle it if (statusCode >= 400) { if (client instanceof IndirectBasicAuthClient) { rsp.status(statusCode).end(); } else { throw new Err(statusCode, action); } } } } }
private static Route[] routes(final Set<Route.Definition> routeDefs, final String method, final String path, final MediaType type, final List<MediaType> accept) { List<Route> routes = findRoutes(routeDefs, method, path, type, accept); routes.add(RouteImpl.fallback((req, rsp, chain) -> { if (!rsp.status().isPresent()) { // 406 or 415 Err ex = handle406or415(routeDefs, method, path, type, accept); if (ex != null) { throw ex; } // 405 ex = handle405(routeDefs, method, path, type, accept); if (ex != null) { throw ex; } // favicon.ico if (path.equals("/favicon.ico")) { // default /favicon.ico handler: rsp.status(Status.NOT_FOUND).end(); } else { throw new Err(Status.NOT_FOUND, req.path(true)); } } }, method, path, "err", accept)); return routes.toArray(new Route[routes.size()]); }
@Override public void handle(final Request req, final Response rsp) throws Throwable { String path = req.path(); URL resource = resolve(req, path); if (resource != null) { String localpath = resource.getPath(); int jarEntry = localpath.indexOf("!/"); if (jarEntry > 0) { localpath = localpath.substring(jarEntry + 2); } URLAsset asset = new URLAsset(resource, path, MediaType.byPath(localpath).orElse(MediaType.octetstream)); if (asset.exists()) { // cdn? if (cdn != null) { String absUrl = cdn + path; rsp.redirect(absUrl); rsp.end(); } else { doHandle(req, rsp, asset); } } } else if (statusCode > 0) { throw new Err(statusCode); } }
rsp.status(Status.OK).end();
ctx.setSessionAttribute(Pac4jConstants.REQUESTED_URL, requestedUrl); client.redirect(ctx); rsp.end(); } catch (HttpAction ex) { new AuthResponse(rsp).handle(client, ex);