Package javango.http

Examples of javango.http.HttpResponseRedirect


    if (path.length() > 0 && !path.endsWith("/")) {
      if ("POST".equals(request.getMethod())) {
        return new SimpleHttpResponse("Cannot append trailing slash to POSTed you should update the form.");
      }
      path = request.getContext() + "/" + path + "/";
      return new HttpResponseRedirect(path);
    }
   
    if (request.getUser() == null) {
      request.setUser(new AnonymousUser());
    }
View Full Code Here


    Choice selected_choice = (Choice)form.getCleanedValue(form.choice);

    int votes = selected_choice.getVotes() == null ? 0 : selected_choice.getVotes().intValue();
    selected_choice.setVotes(votes + 1);
    // due to the way hibernate works this will automatically save when the middleware commits
    return new HttpResponseRedirect("/polls/" + poll_id + "/results/");
  }
View Full Code Here

      form.bind(request.getParameterMap());
      if (form.isValid()) {
        // TODO better way to get the relative 'admin' part of the url
        Map<String, String> params = new HashMap<String, String>();
        generateSearchParams(request, params);
        return new HttpResponseRedirect("../", params);
      }
    }
   
    Map<String, Object> context = new HashMap<String, Object>();
    context.put("form", form);
View Full Code Here

            } else {
              manager.save(object);
            }
           
            if (request.getParameterMap().containsKey("_addanother")) {
              return new HttpResponseRedirect("../add");
            } else if (request.getParameterMap().containsKey("_continue")) {
              return new HttpResponseRedirect(String.format("../%s/", manager.getPk(object)));
            }
            return new HttpResponseRedirect("..");
          } catch (ManagerException e) {
            request.getSession().addError(e.getMessage());
          }
        }
      } else {
View Full Code Here

//      }
       
      if ("POST".equals(request.getMethod())) {
        try {
          manager.delete(object);
          return new HttpResponseRedirect("../..");
        } catch (ManagerException e) {
          request.getSession().addError(e.getMessage());
        }
      }
     
View Full Code Here

    if ("POST".equals(request.getMethod())) {
      Configuration cfg = hibernateUtil.getConfiguration();
      new SchemaExport(cfg).drop(false, true);
      new SchemaExport(cfg).create(false, true);
      request.getSession().addMessage("Tables created successfully");
      return new HttpResponseRedirect("..");
    }
   
    Map<String, Object> context = new HashMap<String, Object>();
    context.put("page_title", "Are you sure?");
    return renderToResponse("/javango/contrib/admin/templates/confirm_reset_db.ftl", context);
View Full Code Here

        return renderToResponse("src/main/webapp/templates/detail.html", context);
      } else {
        int votes = selected_choice.getVotes() == null ? 0 : selected_choice.getVotes().intValue();
        selected_choice.setVotes(votes + 1);
        // due to the way hibernate works this will automatically save when the middleware commits
        return new HttpResponseRedirect("/polls/" + poll_id + "/results/");
      }
    } catch (DaoException e) {
      throw new HttpException(e);
    }
  }
View Full Code Here

TOP

Related Classes of javango.http.HttpResponseRedirect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.