You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by lukaszlenart <gi...@git.apache.org> on 2017/03/24 10:04:09 UTC
[GitHub] struts pull request #125: Immutable context
GitHub user lukaszlenart opened a pull request:
https://github.com/apache/struts/pull/125
Immutable context
WIP
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/lukaszlenart/struts immutable-context
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/struts/pull/125.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #125
----
commit 7627b835556b0ecbd945a3ae1f27693eec41969f
Author: Lukasz Lenart <lu...@apache.org>
Date: 2017-03-24T09:34:39Z
Moves documentation to wiki
commit 9d330eee27ba6c74d1fcb8d0c6223d322af9f11b
Author: Lukasz Lenart <lu...@apache.org>
Date: 2017-03-24T10:02:35Z
Uses OGNL without #context magical key
commit dc2f122d9e4bb66605e4ea9f8cd2c9683c8c0819
Author: Lukasz Lenart <lu...@apache.org>
Date: 2017-03-24T10:03:30Z
Adjusts OGNL usage to avoid modify immutable context
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
[GitHub] struts issue #125: Immutable context
Posted by yasserzamani <gi...@git.apache.org>.
Github user yasserzamani commented on the issue:
https://github.com/apache/struts/pull/125
@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' the it puts the result in div3, if result was from '/APP/jsp/customer/payment.jsp' the it puts the result in div1, if result was from '/APP/jsp/customer/free.jsp' the it puts the result in div2.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
[GitHub] struts issue #125: Immutable context
Posted by aleksandr-m <gi...@git.apache.org>.
Github user aleksandr-m commented on the issue:
https://github.com/apache/struts/pull/125
Spoted same `#context['com.opensymphony.xwork2.dispatcher.HttpServletRequest']` expression [here](https://stackoverflow.com/q/44291034/1700321). @yasserzamani What do you use it for?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
[GitHub] struts issue #125: Immutable context
Posted by cnenning <gi...@git.apache.org>.
Github user cnenning commented on the issue:
https://github.com/apache/struts/pull/125
Sounds like a very good idea! A short check showed that my apps are not affected \U0001f606
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
[GitHub] struts issue #125: Immutable context
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:
https://github.com/apache/struts/pull/125
Can one of the admins verify this patch?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
[GitHub] struts issue #125: Immutable context
Posted by yasserzamani <gi...@git.apache.org>.
Github user yasserzamani commented on the issue:
https://github.com/apache/struts/pull/125
Below is my new design which may be helpful as an example for whom is affected. Those are about access to `%{#context['com.opensymphony.xwork2.dispatcher.HttpServletRequest'].requestURI}`.
I wrote following Filter which operates after struts-prepare but before struts-execute. It supplies an utility into request scope:
```
package utils;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.StrutsStatics;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.ValueStack;
/**
* @author zamani
*
*/
public class MYStrutsPrepareFilter implements Filter {
private MYUtils MYUtils;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
MYUtils = new MYUtils();
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
ValueStack stack = ActionContext.getContext().getValueStack();
stack.setValue("#request['MYUtils']", MYUtils);
chain.doFilter(req, res);
}
@Override
public void destroy() {
MYUtils = null;
}
public class MYUtils {
public String getRequestURI() {
HttpServletRequest httpsr = ((HttpServletRequest) ActionContext.getContext()
.get(StrutsStatics.HTTP_REQUEST));
return httpsr.getRequestURI();
}
}
}
```
Then `"#request['MYUtils'].requestURI"` can be used in jsp, instead.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org