Package hirondelle.web4j.action

Examples of hirondelle.web4j.action.ResponsePage


   <P>This method simply forwards all parameters to
   {@link ResponsePage#ResponsePage(String, String, String, java.lang.Class)}. Please
   see that constructor for important information. 
  */
  public static ResponsePage get(String aTitle, String aBodyJsp, Class aRepresentativeClass) {
    return new ResponsePage(aTitle, aBodyJsp, MAIN, aRepresentativeClass);
  }
View Full Code Here


  public void testList() throws AppException {
    HttpServletRequest req = FakeRequest.forGET(LIST, NO_PARAMS);
    HttpServletResponse resp = new FakeResponse();
    MemberAction action = new MemberAction(new RequestParserImpl(req, resp));
   
    ResponsePage responsePage = action.execute();
    Object item = req.getAttribute(ITEMS_FOR_LISTING);
    assertTrue(item != null);
    assertTrue(item instanceof List);
    List<Member> members = (List<Member>)item;
    assertTrue( members.size() > 0 );
View Full Code Here

  public void testFetch() throws AppException {
    HttpServletRequest req = FakeRequest.forGET(FETCH, "Id=3");
    HttpServletResponse resp = new FakeResponse();
    MemberAction action = new MemberAction(new RequestParserImpl(req, resp));
   
    ResponsePage responsePage = action.execute();
    Object item = req.getAttribute(ITEM_FOR_EDIT);
    //log(item);
    assertTrue(item != null);
    assertTrue(item instanceof Member);
  }
View Full Code Here

  /**
   Returns a non-<tt>null</tt> value only if <tt>aResponsePage</tt> ends with <tt>'Visit.jsp'</tt>.
  */
  @Override protected ResponsePage swapResponsePage(ResponsePage aResponsePage, Locale aLocale){
    fLogger.fine("Custom Controller : " + aResponsePage);
    ResponsePage result = null;
    if (aResponsePage.toString().endsWith("Visit.jsp")){
      int idx = aResponsePage.toString().indexOf("Visit.jsp");
      String alteredURI = aResponsePage.toString().substring(0,idx) + "Visit_" + aLocale.toString() + ".jsp";
      fLogger.fine("Forward Response Page updated for locale: " + alteredURI);
      result = new ResponsePage(alteredURI).setIsRedirect(Boolean.FALSE);
    }
    return result;
  }
View Full Code Here

   <P>Toggles the value of a {@link Boolean} item in session scoped, identified by
   {@link ShowHelpTag#KEY}.
  */
  public ResponsePage execute() throws AppException {
    toggleDisplayOfHelp();
    return new ResponsePage(getRedirect());
  }
View Full Code Here

  /**
   Fetch a {@link PredictionList} and display it. Shows the title of the list, and its average score.
   See {@link Prediction#calculateAverageScore(List)}.
  */
  @Override public ResponsePage execute() throws AppException {
    ResponsePage result = getResponsePage();
    List<Prediction> predictions = fDAO.list(getIdParam(LIST_ID));
    if( ! predictions.isEmpty() ) {
      addToRequest(ITEMS_FOR_LISTING, predictions);
      SafeText title = getPredictionListTitle();
      addToRequest("title", title);
View Full Code Here

   <P>This method simply forwards all parameters to
   {@link ResponsePage#ResponsePage(String, String, String, java.lang.Class)}, using a hard-coded
   String for the template JSP. Please see that constructor for important information. 
  */
  public static ResponsePage get(String aTitle, String aBodyJsp, Class aRepresentativeClass) {
    return new ResponsePage(aTitle, aBodyJsp, MAIN, aRepresentativeClass);
  }
View Full Code Here

      Action action = requestParser.getWebAction();
      ApplicationFirewall appFirewall = BuildImpl.forApplicationFirewall();
      appFirewall.doHardValidation(action, requestParser);
      logAttributesForAllScopes(aRequest);
      ensureDatabasesOk();
      ResponsePage responsePage = checkOwnershipThenExecuteAction(action, requestParser);
      if ( responsePage.hasBinaryData() ) {
        fLogger.fine("Serving binary data. Controller not performing a forward or redirect.");
      }
      else {
        if ( responsePage.getIsRedirect() ) {
          redirect(responsePage, aResponse);
        }
        else {
          forward(responsePage, aRequest, aResponse);
        }
View Full Code Here

  }

  private void forward (
    ResponsePage aResponsePage, HttpServletRequest aRequest, HttpServletResponse aResponse
  ) throws ServletException, IOException {
    ResponsePage responsePage = possiblyAlterForLocale(aResponsePage, aRequest);
    RequestDispatcher dispatcher = aRequest.getRequestDispatcher(responsePage.toString());
    fLogger.fine("Forward : " + responsePage);
    dispatcher.forward(aRequest, aResponse);
  }
View Full Code Here

    dispatcher.forward(aRequest, aResponse);
  }
 
  private ResponsePage possiblyAlterForLocale(ResponsePage aNominalForward, HttpServletRequest aRequest){
    Locale locale = BuildImpl.forLocaleSource().get(aRequest);
    ResponsePage langSpecificForward = swapResponsePage(aNominalForward, locale);
    if ( langSpecificForward != null && langSpecificForward.getIsRedirect() ){
      throw new RuntimeException(
        "A 'forward' ResponsePage has been altered for Locale, but is no longer a forward : " + langSpecificForward
      );
    }
    return (langSpecificForward != null) ?  langSpecificForward : aNominalForward;
View Full Code Here

TOP

Related Classes of hirondelle.web4j.action.ResponsePage

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.