-
Notifications
You must be signed in to change notification settings - Fork 809
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
Immutable context #125
Immutable context #125
Conversation
Sounds like a very good idea! A short check showed that my apps are not affected 😆 |
Below is my new design which may be helpful as an example for whom is affected. Those are about access to I wrote following Filter which operates after struts-prepare but before struts-execute. It supplies an utility into request scope:
Then |
Spotted same |
@aleksandr-m , not me but my workmate has used it as an ID for each jsp. I do not know his work details but in general, he then uses this ID to decide where he should place the result after an AJAX call. For example a parent jsp that have div1, div2 and div3 calls an AJAX then if result was from '/APP/jsp/customer/error.jsp' then it puts the result in div3, if result was from '/APP/jsp/customer/payment.jsp' then it puts the result in div1, if result was from '/APP/jsp/customer/free.jsp' then it puts the result in div2. |
Can one of the admins verify this patch? |
@apache/struts-committers this is ready for another look. |
@@ -185,6 +187,10 @@ public void setContextMap(Map<String, Object> contextMap) { | |||
* @return the context map. | |||
*/ | |||
public Map<String, Object> getContextMap() { | |||
Map<String, Object> context = getContext().context; | |||
if (context instanceof OgnlContext) { | |||
((OgnlContext) context).put(TypeConverter.TYPE_CONVERTER_CONTEXT_KEY, ((OgnlContext) context).getTypeConverter()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the deal with the type converter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, probably it's a workaround :/ Need to re-think this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whooops... it can be thrown away, goot catch 👍
AccessibleObject accessible = (AccessibleObject) member; | ||
|
||
if (!accessible.isAccessible()) { | ||
result = Boolean.TRUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will result
be used in restore
method as state
parameter? if so I think it should be Boolean.FALSE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... this was copy/pasted from existing code but I think you are right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done :)
LGTM 👍 Thanks! |
This PR uses the latest OGNL version which drops access to
#context
via a magical key and makesOgnlContext
a bit immutable.OGNL 3.2 version notes
Implements WW-4927