Re: [Stripes-users] Stripes Clean URLs
On 11/10/10 05:09 AM, Ben Gunter wrote: The plus sign thing was fixed since 1.5.3, and I had forgotten about it. I just released 1.5.4 so that should not be a problem anymore. See this link for more information: http://stripesframework.org/jira/browse/STS-743 Thanks for the pointer Ben. The embedded slash is a bit trickier. I can see where you'd want the thing not to encode the slash, but if, for example, you had a UrlBinding that looked like @UrlBinding(/foo/{param1}/bar/{param2}) and you passed param1 with a slash in it, then the encoded slash might be necessary to allow Stripes to properly parse the parameters out of the URL. (That might not be a perfect example, but I trust you'll get what I'm saying.) I'm inclined to say that encoding the slash is the proper behavior. If you must have the URLs with slashes not encoded (a valid requirement) then I suggest just appending the string to the URL using EL instead of using a s:param tag. Yep, I understand the issue. My only concern is that when a '/' is encoded, it becomes '%2F'. At least with Tomcat, this is regarded as an invalid request, and a HTTP 400 is returned. The request does not make it to Stripes, so the above example would not work even if encoding was done. I am unsure whether this is a problem with Stripes, or a problem with Tomcat. Unfortunately I have been unable to test this behavior on other web servers up to now. I will look into getting the param appended with EL instead. Thanks for the response, Martin -Ben On Fri, Nov 5, 2010 at 9:27 AM, Martin Walsh martin.wa...@oracle.com mailto:martin.wa...@oracle.com wrote: I am running into a few issues with clean URLs. I am using Stripes 1.5.2 and Tomcat 6.0.26. I am attempting to use clean URLs with parameters that represent a file path. e.g. binding = /action/test/{path} parameter = String path = tmp/test.txt I am using the stripes:link tag to generate the link on a JSP page using the path variable. I am currently running into two issues. Firstly, the link generated is escaped, escaping the '/'. This results in a link of http://localhost:8080/test/action/test/tmp%2Ftest.txt. When clicked on, Tomcat returns a error 400 (Bad Request). The request does not even make it through to Stripes. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. Thanks in advance for any help. M -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net mailto:Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- Centralized Desktop Delivery: Dell and VMware Reference Architecture Simplifying enterprise desktop deployment and management using Dell EqualLogic storage and VMware View: A highly scalable, end-to-end client virtualization framework. Read more! http://p.sf.net/sfu/dell-eql-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
[Stripes-users] Stripes Clean URLs
I am running into a few issues with clean URLs. I am using Stripes 1.5.2 and Tomcat 6.0.26. I am attempting to use clean URLs with parameters that represent a file path. e.g. binding = /action/test/{path} parameter = String path = tmp/test.txt I am using the stripes:link tag to generate the link on a JSP page using the path variable. I am currently running into two issues. Firstly, the link generated is escaped, escaping the '/'. This results in a link of http://localhost:8080/test/action/test/tmp%2Ftest.txt. When clicked on, Tomcat returns a error 400 (Bad Request). The request does not even make it through to Stripes. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. Thanks in advance for any help. M -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Clean URLs
Please try 1.5.3 and see if that helps. -Ben On Fri, Nov 5, 2010 at 9:27 AM, Martin Walsh martin.wa...@oracle.comwrote: I am running into a few issues with clean URLs. I am using Stripes 1.5.2 and Tomcat 6.0.26. I am attempting to use clean URLs with parameters that represent a file path. e.g. binding = /action/test/{path} parameter = String path = tmp/test.txt I am using the stripes:link tag to generate the link on a JSP page using the path variable. I am currently running into two issues. Firstly, the link generated is escaped, escaping the '/'. This results in a link of http://localhost:8080/test/action/test/tmp%2Ftest.txt. When clicked on, Tomcat returns a error 400 (Bad Request). The request does not even make it through to Stripes. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. Thanks in advance for any help. M -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Clean URLs
Nope, same issues described below. M On 11/ 5/10 01:39 PM, Ben Gunter wrote: Please try 1.5.3 and see if that helps. -Ben On Fri, Nov 5, 2010 at 9:27 AM, Martin Walsh martin.wa...@oracle.com mailto:martin.wa...@oracle.com wrote: I am running into a few issues with clean URLs. I am using Stripes 1.5.2 and Tomcat 6.0.26. I am attempting to use clean URLs with parameters that represent a file path. e.g. binding = /action/test/{path} parameter = String path = tmp/test.txt I am using the stripes:link tag to generate the link on a JSP page using the path variable. I am currently running into two issues. Firstly, the link generated is escaped, escaping the '/'. This results in a link of http://localhost:8080/test/action/test/tmp%2Ftest.txt. When clicked on, Tomcat returns a error 400 (Bad Request). The request does not even make it through to Stripes. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. Thanks in advance for any help. M -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net mailto:Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Clean URLs
Martin, Comments in-line... Martin Walsh wrote: Nope, same issues described below. M On 11/ 5/10 01:39 PM, Ben Gunter wrote: Please try 1.5.3 and see if that helps. -Ben On Fri, Nov 5, 2010 at 9:27 AM, Martin Walsh martin.wa...@oracle.com mailto:martin.wa...@oracle.com wrote: I am running into a few issues with clean URLs. I am using Stripes 1.5.2 and Tomcat 6.0.26. I am attempting to use clean URLs with parameters that represent a file path. e.g. binding = /action/test/{path} parameter = String path = tmp/test.txt I am using the stripes:link tag to generate the link on a JSP page using the path variable. I am currently running into two issues. Firstly, the link generated is escaped, escaping the '/'. This results in a link of http://localhost:8080/test/action/test/tmp%2Ftest.txt. When clicked on, Tomcat returns a error 400 (Bad Request). The request does not even make it through to Stripes. That appears to be encoded properly. Is the URL correct i.e. have you tried simply going to: http://localhost:8080/test/action/test/tmp_test_txt Otherwise it seems quite bizarre. The other thing I would suggest is perhaps setting up a root binding like /action and then in debug mode see what the request looks like that may be tripping up Stripes and not matching. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. That isn't totally surprising to me. Just use: java.net.URLDecoder.decode(string, encoding); In say the setPath(...) method as you expect that you might have a case wherein the parameter has encoded characters. HTH, --Nikolaos Thanks in advance for any help. M -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Clean URLs
Thanks Nikolaos. Response in-line... On 11/ 5/10 04:14 PM, Nikolaos Giannopoulos wrote: Martin, Comments in-line... Martin Walsh wrote: Nope, same issues described below. M On 11/ 5/10 01:39 PM, Ben Gunter wrote: Please try 1.5.3 and see if that helps. -Ben On Fri, Nov 5, 2010 at 9:27 AM, Martin Walshmartin.wa...@oracle.com mailto:martin.wa...@oracle.com wrote: I am running into a few issues with clean URLs. I am using Stripes 1.5.2 and Tomcat 6.0.26. I am attempting to use clean URLs with parameters that represent a file path. e.g. binding = /action/test/{path} parameter = String path = tmp/test.txt I am using the stripes:link tag to generate the link on a JSP page using the path variable. I am currently running into two issues. Firstly, the link generated is escaped, escaping the '/'. This results in a link of http://localhost:8080/test/action/test/tmp%2Ftest.txt. When clicked on, Tomcat returns a error 400 (Bad Request). The request does not even make it through to Stripes. That appears to be encoded properly. Is the URL correct i.e. have you tried simply going to: http://localhost:8080/test/action/test/tmp_test_txt The URL would be correct if the %2F was a '/'. i.e. The following works: http://localhost:8080/test/action/test/tmp/test.txt But with the final '/' being encoded because it is technically a parameter, it results in a request of http://localhost:8080/test/action/test/tmp%2Ftest.txt This request then does not even make it to Stripes. Tomcat just returns a 400 error, before it even invokes Stripes. So I think the question really is, which side is wrong. Tomcat not even trying to handle the URL, or Stripes encoding the '/' when generating the clean URL. Otherwise it seems quite bizarre. The other thing I would suggest is perhaps setting up a root binding like /action and then in debug mode see what the request looks like that may be tripping up Stripes and not matching. Unfortunately, the request does not even make it to Stripes, so this would not work. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. That isn't totally surprising to me. Just use: java.net.URLDecoder.decode(string, encoding); In say the setPath(...) method as you expect that you might have a case wherein the parameter has encoded characters. I can do that as a fix for now. Should this not be fixed in Stripes though? M HTH, --Nikolaos Thanks in advance for any help. M -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Clean URLs
Martin, Comments in-line... Martin Walsh wrote: Thanks Nikolaos. Response in-line... That appears to be encoded properly. Is the URL correct i.e. have you tried simply going to: http://localhost:8080/test/action/test/tmp_test_txt The URL would be correct if the %2F was a '/'. i.e. The following works: http://localhost:8080/test/action/test/tmp/test.txt But with the final '/' being encoded because it is technically a parameter, it results in a request of http://localhost:8080/test/action/test/tmp%2Ftest.txt This request then does not even make it to Stripes. Tomcat just returns a 400 error, before it even invokes Stripes. So I think the question really is, which side is wrong. Tomcat not even trying to handle the URL, or Stripes encoding the '/' when generating the clean URL. How do you know it isn't making it to Stripes? Personally I think part of the issue is that you are trying to inject data that can have spaces or slashes or whatever as part of a base URL. Typically that would be part of a parameter. How about if you did something like: http://localhost:8080/test/action/test?file=tmp%2Ftest.txt i.e. create a link with a parameter called file? I know that changes things slightly but that makes more sense to me. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. That isn't totally surprising to me. Just use: java.net.URLDecoder.decode(string, encoding); In say the setPath(...) method as you expect that you might have a case wherein the parameter has encoded characters. I can do that as a fix for now. Should this not be fixed in Stripes though? I would imagine there is a reason why Stripes does not URL decode every single parameter... and personally I would not want it to... as having to URL decode data is not often a requirement and would be an often needless performance penalty i.e. often clear text with spaces et al. is collected via a form POST wherein it doesn't matter how the data is formatted. So... No I don't think this is a bug. I think you are simply combining data that doesn't belong in a base part of a URL normally - and most often gets form POST'ed - into a URL and then having this issue. Said differently I think what you are trying to do is a little odd ;-) --Nikolaos -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Clean URLs
On 11/ 5/10 07:04 PM, Nikolaos Giannopoulos wrote: Martin, Comments in-line... Martin Walsh wrote: Thanks Nikolaos. Response in-line... That appears to be encoded properly. Is the URL correct i.e. have you tried simply going to: http://localhost:8080/test/action/test/tmp_test_txt The URL would be correct if the %2F was a '/'. i.e. The following works: http://localhost:8080/test/action/test/tmp/test.txt But with the final '/' being encoded because it is technically a parameter, it results in a request of http://localhost:8080/test/action/test/tmp%2Ftest.txt This request then does not even make it to Stripes. Tomcat just returns a 400 error, before it even invokes Stripes. So I think the question really is, which side is wrong. Tomcat not even trying to handle the URL, or Stripes encoding the '/' when generating the clean URL. How do you know it isn't making it to Stripes? I have Stripes debugging enabled. The request is not being passed to Stripes to even attempt to match it to an action. Personally I think part of the issue is that you are trying to inject data that can have spaces or slashes or whatever as part of a base URL. Typically that would be part of a parameter. How about if you did something like: http://localhost:8080/test/action/test?file=tmp%2Ftest.txt Yes, this would work. However, as the URLs are often distributed for others to load up and view files it seems cleaner for the parameters to be contained within the URL, not as URL parameters. If it comes down to it, I can switch it to work as above, but I thought that the whole point of clean urls where so that any parameter that is included as a URL parameter normally, could be included within the URL. i.e. create a link with a parameter called file? I know that changes things slightly but that makes more sense to me. Secondly, if the parameter includes a special char, i.e. a space. e.g. parameter = String path = test file.txt the link is encoded, which gives http://localhost:8080/test/action/test/test+file.txt. However the parameter is not decoded, so in my action bean, the path variable is test+file.txt instead of test file.txt. That isn't totally surprising to me. Just use: java.net.URLDecoder.decode(string, encoding); In say the setPath(...) method as you expect that you might have a case wherein the parameter has encoded characters. I can do that as a fix for now. Should this not be fixed in Stripes though? I would imagine there is a reason why Stripes does not URL decode every single parameter... and personally I would not want it to... as having to URL decode data is not often a requirement and would be an often needless performance penalty i.e. often clear text with spaces et al. is collected via a form POST wherein it doesn't matter how the data is formatted. Yet when the parameter is included as part of a URL parameter i.e. http://localhost:8080/test/action/test?file=tmp+test.txt it is automatically decoded by Stripes. Whether they are parameters passed via clean URLs or parameters passed as URL parameters they should be handled the same way. So... No I don't think this is a bug. I think you are simply combining data that doesn't belong in a base part of a URL normally - and most often gets form POST'ed - into a URL and then having this issue. Said differently I think what you are trying to do is a little odd ;-) :-) The requests wont get posted. They are normally accessed via a GET method, i.e. users loading the link from an external source e.g. link in an email. M --Nikolaos -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book Blueprint to a Billion shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users