Examples of FlashScope


Examples of grails.web.mvc.FlashScope

            return null;
        }

        HttpServletRequest servletRequest = (HttpServletRequest) request;
        HttpSession session = servletRequest.getSession(false);
        FlashScope fs;
        if (session != null) {
            fs = (FlashScope)session.getAttribute(FLASH_SCOPE);
        }
        else {
            fs = (FlashScope)request.getAttribute(FLASH_SCOPE);
View Full Code Here

Examples of grails.web.mvc.FlashScope

    private static final String ERRORS_PROPERTY = "errors";

    public void testPutNull() {
        GrailsWebMockUtil.bindMockWebRequest();

        FlashScope fs = new GrailsFlashScope();
        fs.put("test",null);
    }
View Full Code Here

Examples of grails.web.mvc.FlashScope

    public void testNextState() {

        GrailsWebMockUtil.bindMockWebRequest();

        FlashScope fs = new GrailsFlashScope();
        fs.put("test","value");
        fs.put("fred","flintstone");
        fs.getNow().put("barney", "rubble");

        assertFalse(fs.isEmpty());
        assertEquals("flintstone",fs.get("fred"));
        assertEquals("rubble",fs.get("barney"));
        assertEquals(3, fs.size());
        assertTrue(fs.containsKey("test"));
        assertTrue(fs.containsKey("barney"));
        assertTrue(fs.containsValue("value"));
        assertFalse(fs.containsKey("wilma"));

        // the state immediately following this one the map should still contain the previous entries
        fs.next();

        assertFalse(fs.isEmpty());
        assertEquals("flintstone",fs.get("fred"));
        assertEquals(2, fs.size());
        assertTrue(fs.containsKey("test"));
        assertTrue(fs.containsValue("value"));
        assertFalse(fs.containsKey("wilma"));

        // the next state it should be empty
        fs.next();

        assertTrue(fs.isEmpty());
        assertEquals(0,fs.size());
    }
View Full Code Here

Examples of grails.web.mvc.FlashScope

        map.put("barney","rabble");
        MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(value.getClass());
        mc.setProperty(value, ERRORS_PROPERTY, new Object());

        //put the map to scope
        FlashScope fs = new GrailsFlashScope();
        fs.put("test", "value");
        fs.put("flinstones", map);

        assertFalse(fs.isEmpty());
        assertEquals(2, fs.size());
        assertEquals(map,fs.get("flinstones"));
        assertEquals("value", fs.get("test"));

        // the state immediately following this one the map should still contain the previous entries
        fs.next();

        assertFalse(fs.isEmpty());
        assertEquals(2, fs.size());
        assertEquals(map,fs.get("flinstones"));
        assertEquals("value", fs.get("test"));

        // the next state it should be empty
        fs.next();

        assertTrue(fs.isEmpty());
        assertEquals(0,fs.size());
    }
View Full Code Here

Examples of grails.web.mvc.FlashScope

            WebUtils.storeGrailsWebRequest(webRequest);

            // Set the flash scope instance to its next state. We do
            // this here so that the flash is available from Grails
            // filters in a valid state.
            FlashScope fs = webRequest.getAttributes().getFlashScope(request);
            fs.next();

            // Pass control on to the next filter (or the servlet if
            // there are no more filters in the chain).
            filterChain.doFilter(request, response);
        }
View Full Code Here

Examples of net.sourceforge.stripes.controller.FlashScope

     *
     * @return a List of Message objects associated with the current request, never null.
     */
    @SuppressWarnings("unchecked")
  public List<Message> getMessages(String key) {
        FlashScope scope = FlashScope.getCurrent(getRequest(), true);
        List<Message> messages = (List<Message>) scope.get(key);

        if (messages == null) {
            messages = new ArrayList<Message>();
            scope.put(key, messages);
        }

        return messages;
    }
View Full Code Here

Examples of net.sourceforge.stripes.controller.FlashScope

            addParameters(request.getParameterMap());
        }

        // Add any beans to the flash scope
        if (this.beans != null) {
            FlashScope flash = FlashScope.getCurrent(request, true);
            for (ActionBean bean : this.beans) {
                flash.put(bean);
            }
        }

        // If a flash scope exists, add the parameter to the request
        FlashScope flash = FlashScope.getCurrent(request, false);
        if (flash != null) {
            addParameter(StripesConstants.URL_KEY_FLASH_SCOPE_ID, flash.key());
        }

        // Prepend the context path if requested
        String url = getUrl(request.getLocale());
        if (prependContext) {
View Full Code Here

Examples of net.sourceforge.stripes.controller.FlashScope

          if (attachment != null) {
            if (attachment.getSize() > 0) {
              if (tckt==null) {
                tckt = bill.createTicket(getSession(), getAccount());
                setId(tckt.id());
                FlashScope oFscope = FlashScope.getCurrent(getContext().getRequest(), true);
                oFscope.put("ticket_docid", tckt.id());
              }
              TicketNote note = tckt.createNote(getSession(), attachment.getInputStream(), incCapturedCount(), attachment.getFileName());
              if (getCapturedPage1().length()==0) setCapturedPage1(note.id());
              attachment.delete();
            } else {
View Full Code Here

Examples of net.sourceforge.stripes.controller.FlashScope

        Ticket tckt = bill.createTicket(getSession(), new AccountingAccount(getSession(), sAccount));
        disconnect();
        DepositToZespedBridge oDzb = new DepositToZespedBridge(CaptureService.BILLNOTES, lDepositId, Long.parseLong(tckt.getId()));
        oDzb.start();
        Log.out.debug("Done attaching sides");
        FlashScope oFscope = FlashScope.getCurrent(getContext().getRequest(), true);
        oFscope.put("ticket_docid", tckt.id());
      }     
      new CreditBurner(getSessionAttribute("user_uuid"),
               getSessionAttribute("customer_account_docid"),
               sService, sFlavor).start();
    } catch (Exception e) {
View Full Code Here

Examples of net.sourceforge.stripes.controller.FlashScope

      sRetVal = sDefaultValue;
    return sRetVal;
  }
 
  public void setParam(String sParamName, String sParamValue) {
    FlashScope oFscope = FlashScope.getCurrent(getContext().getRequest(), true);
    oFscope.put(sParamName, sParamValue);   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.