Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flash doesn't load value on the next request but on the request after #57

Closed
chelm-spotuse opened this issue Jun 21, 2011 · 5 comments
Closed

Comments

@chelm-spotuse
Copy link

My scenario is this:

  1. I submit a form using post
  2. I set the flash message and redirect from the post action to another url
  3. The flash is EMPTY on this request and the message doesn't show on the page
  4. I load another page and the message appears
  5. On the next request it is gone again

The get action that follows the original post action is located in another ScalatraServlet.

I'm using scalatra version 2.0.0-SNAPSHOT with scala version 2.9.0-1.

I don't use flash.keep anywhere. What could be the problem?

@rossabaker
Copy link
Member

I was not able to reproduce this: https://gist.github.com/1055654. Could you post an example that demonstrates the problem?

@rossabaker
Copy link
Member

The following things happen:

When I submit the form the message is shown.
When I reload the message is still there
When I access /other-servlet/show-flash2 the message is still there
When I reload the message is still there
When I access /form-servlet/show-flash the message is still there
When I reload the message is gone (exception)

This is a side effect of the fix in #41. Only the servlet or filter that created the flash map sweeps the stale entries, in order to support nested filters. You don't have nested filters, so in your case, form-servlet creates the flash, and as long as you stay in other-servlet the entry persists. When you return to form-servlet, the message renders once and then gets swept. I consider this a bug.

Another interesting detail:

If I access /other-servlet/show-flash as the first request, I get an exception (of course).
But if I submit the form afterwards it doesn't work anymore. I always get a NoSuchElementException, even if I repeat submitting the form.

I can reproduce this, but can't precisely explain why yet. Will add a unit test to be sure that the fix covers it.

@chelm-spotuse
Copy link
Author

Thank you so much. Do you already know when you're going to make the next release containing this fix? Otherwise I don't know how to get it into our maven repository.

@rossabaker
Copy link
Member

I don't like to promise dates because I have many other commitments (kids, new job, and this week, jury duty). But my plan is to fix one more flash map quirk and release another milestone. We're not currently depending on any snapshots, so that means we're not waiting on anyone else. I hope it's very soon.

If we're too slow, you should be able to get a local build into a Maven repository by overriding the publishTo setting. I've also resorted to using maven's deploy:deploy-file goal.

@chelm-spotuse
Copy link
Author

Thanks for the quick reply. Of course that's totally understandable.

If we have to launch before you're able to release the new version I will take your advice to build it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants