Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class CidLogicResult extends DefaultLogicResult {
private MutableRequest request;
public CidLogicResult(...., MutableRequest request) {
this.request = request;
public <T> T redirectTo(final Class<T> type) {
logger.debug("redirecting to class {}", type.getSimpleName());
return proxifier.proxify(type, new MethodInvocation<T>() {
public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) {
checkArgument(acceptsHttpGet(method), "Your logic method must accept HTTP GET method if you want to redirect to it");
try {
String url = router.urlFor(type, method, args);
String path = request.getContextPath() + url;
if (request.getParameter("cid") != null) {
path = path + "?cid=" + request.getParameter("cid");
includeParametersInFlash(type, method, args);
logger.debug("redirecting to {}", path);
return null;
} catch (IOException e) {
throw new ProxyInvocationException(e);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment