use of org.takes.facets.forward.RsForward in project wring by yegor256.
the class TkPipeDelete method act.
@Override
public Response act(final Request req) throws IOException {
final Pipe pipe = this.base.user(new RqUser(req).urn()).pipes().pipe(Long.parseLong(new RqHref.Base(req).href().param("id").iterator().next()));
final String msg = new XePrint(pipe.asXembly()).text("Pipe #{/pipe/id/text()} deleted");
pipe.delete();
return new RsForward(new RsFlash(msg), "/pipes");
}
use of org.takes.facets.forward.RsForward in project wring by yegor256.
the class TkEventDelete method act.
@Override
public Response act(final Request req) throws IOException {
final User user = this.base.user(new RqUser(req).urn());
final Href href = new RqHref.Base(req).href();
final Event event = user.events().event(href.param("title").iterator().next());
final String hash = new XePrint(event.asXembly()).text("{/event/md5/text()}");
if (!hash.equals(href.param("hash").iterator().next())) {
throw new RsForward(new RsFlash("Reload the page, the event has changed", Level.WARNING));
}
final String msg = new XePrint(event.asXembly()).text("Event \"{/event/title/text()}\" deleted");
event.delete();
return new RsForward(new RsFlash(msg));
}
use of org.takes.facets.forward.RsForward in project wring by yegor256.
the class TkEventDown method act.
@Override
public Response act(final Request req) throws IOException {
final User user = this.base.user(new RqUser(req).urn());
final Event event = user.events().event(new RqHref.Base(req).href().param("title").iterator().next());
event.vote(-Tv.TEN);
return new RsForward(new RsFlash("Event down-voted"));
}
Aggregations