use of org.b3log.latke.servlet.advice.RequestReturnAdviceException in project solo by b3log.
the class ProcessAuthAdvice method doAdvice.
@Override
public void doAdvice(final HTTPRequestContext context, final Map<String, Object> args) throws RequestProcessAdviceException {
final LatkeBeanManager beanManager = Lifecycle.getBeanManager();
final UserQueryService userQueryService = beanManager.getReference(UserQueryService.class);
if (!userQueryService.isLoggedIn(context.getRequest(), context.getResponse())) {
try {
context.getResponse().sendError(HttpServletResponse.SC_FORBIDDEN);
} catch (final IOException e) {
throw new RuntimeException(e);
}
throw new RequestReturnAdviceException(null);
}
}
Aggregations