Moises Lejter

Greenhorn
+ Follow
since Aug 10, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Moises Lejter

Ideally, this would be something that you could get the IDE to validate for you...

As an alternative, there's a question on stackoverflow that discusses several alternatives, when one is trying to use Java constants in JSP EL expressions:
http://stackoverflow.com/questions/3732608/how-to-reference-constants-in-el

The suggestion in the question, though, is one way in which you could get compile-time validation that you are indeed defining all the constants you'd need: you can use
<%=Addresses.URL%>
to reference Java constants by their name.

You could then define a class that defines a Java String constant for each key you intend to use, then reference keys in your JSPs by using references to the Java constants in your class.
If you now compile all your JSPs before deploying the application, any reference to a String constant that is not in your class will result in a compile-time exception when compiling that JSP...

Granted, this wouldn't help you, if you forget to define the value for that key...

Moises
11 years ago
Hi!

We just implemented this in an application I am working on - but I have a doubt about our implementation (which is much like yours): shouldn't the calls to isTokenValid() and resetToken() execute within a synchronized block? Otherwise, I could see two clients issue request that would get processed such that the first client would execute isTokenValid(), get a true result then get interrupted to have the second client's thread execute. In such a scenario, wouldn't they both process the request "in parallel" ?

Or alternatively, call isTokenValid(request,true), which would have this call automatically reset the token, if it was valid, before it returns...

Moises
11 years ago
just wanted to mention that your suggestion was right on the money, when I just ran into this... I had made my constructor protected (cut and paste error :-) ) and I could not figure out why it would not work ...

Thank you!

Moises
17 years ago