How to handle URL containing slash within the input parameters - jboss

I am working on a Web Service, in which the URL is given with 2 inputs-- input1 & input2 such as . The input2 contains a slash within it like onj\hjk. When I hit the URL, it is considering as 3 input parameters which is supposed to be only 2. Can you please let me know how to handle this situation and how the code has to be changed accordingly

If you are generating the URLs from Javascript then use either encodeURIComponent(str) or encodeURI(str) .
But in case your are generating URLs through PHP then use urlencode() .
For details visit urlencode() and encodeURI(uri)

Related

VWO Split URL test no redirect link

I'm using VWO to do some split url testing. Is there some query param you can pass in the url so it doesn't get put into the a/b test and doesn't get redirected.
For example lets say I'm running a split URL test on
mywebsite.com/a vs. mywebsite.com/b
I want to give someone a link to mywebsite.com/a without being included in the split URL test, ensuring that they actually get to mywebsite.com/a and not mywebsite.com/b
Is there some query param or some other way I can ensure this?
(example: mywebsite.com/a?vwo_testing=false)
You can exclude someone from the test by using a Query Parameter segmentation to exclude the query parameter. You can refer to the article below to create a Custom Visitor Segment for this.
https://vwo.com/knowledge/how-to-define-custom-visitor-segments/
Segmentation would look like -
Query Parameter: vwo_testing IS NOT EQUAL TO false
You can reach out to support#vwo.com in case you have any further query.
In my use case I was able to go to https://vwo.com/opt-out/ and opt out of being redirected. Another option is to add ?vwo_opt_out=1 param to the url.

How to write Response.redirect with Query_string server variables in ASP

I'm trying to redirect users to my mobile page equivalent of a desktop page. Right now I can only get them to the home page.
If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp") End If
I'd like to redirect to the mobile page with the additional correct variables. So the redirect response should be to "/mobile.asp?m=here" from the "/home.asp?m=here" page and "/mobile.asp?m=there" from the "/home.asp?m=there" etc.
I can get the variables with <% Response.Write(Request.ServerVariables("QUERY_STRING")) %> but my syntax must be off when I try to concat the redirect
If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp?&Response.Write(Request.ServerVariables("QUERY_STRING"))&""") End If
Little help. Thanks.
You don't need the response.write in there. Something like this (not tested it though)
response.redirect("/mobile.asp?" & Request.ServerVariables("QUERY_STRING"))
In order to put something dynamic into your string it has to be determinated first, then use a & to concatenate other strings / variables. So you want your code to look like this:
If b.test(u) or v.test(Left(u,4)) then response.redirect("/mobile.asp?" & Response.Write(Request.ServerVariables("QUERY_STRING"))) End If
also, you should check for any query strings to know weather to put the ? or not.

How can I get multiple %-encoded parameters into an apiary URI template?

The ApiaryIO spec—actually the RFC to which it points—indicates that you cannot use "." in a parameter name, you need to encode it to "%2E". That's fine, but there seems to be a bug where Apiary can only handle one such encoding. For example, the following
## Notes Collection [/notes{?foo%2Ebar}]
yields the following Code Example
request = Request('http://private-d1ee7-testingnewapiary.apiary-mock.com/notes?foo.bar=foo.bar')
which is correct. However, the following
## Notes Collection [/notes{?foo%2Ebar,baz%2Ebla}]
yields this Code Example:
request = Request('http://private-d1ee7-testingnewapiary.apiary-mock.com/notes?foo%252Ebar=foo%252Ebar&baz%252Ebla=baz%252Ebla')
Notice how in the first the Code Example you see it has "foo.bar" but in the second example it has "foo%252Ebar", which is incorrect.
The downstream effect here is that the incorrect URI is sent to the API server so the response is malformatted creating an error.
How do I encode many "."-containing parameters on the URI template and still get the proper code examples?
Will adding explicit example values for those parameters help?
For example:
## Notes Collection [/notes{?foo%2Ebar,baz%2Ebla}]
+ Parameters
+ foo%2Ebar (`42`)
+ baz%2Ebla (`24`)
Update
This seems to be a bug in the way the documentation / code samples are rendered. I have created the tracking issue here https://github.com/apiaryio/language-templates/issues/36.

Mojo Routes: Handle asorted tags in url

I am building a Mojo app to replace a vanilla mod_perl application.
The app currently handles url structures like:
/
/type/bold/
/keyword/hello/
/audience/all/
/type/bold/keyword/hello/
/keyword/hello/audience/all/
/keyword/hello/type/bold/audience/all/
/audience/all/type/bold/keyword/hello/
key/value pairs in the URL, that can exist in any order.
I am looking for a way to handle that without simply making a route for every permutation of tag, as that gets repetitive even after 3 different types of tags
In that case you should probably just make a route that matches everything and parse the url yourself.

How to delete facebook parameters that puts the url's shared on your wall in codeigniter links

When I share a link http://www.totalrunning.com/results/misFotos/TTRCAR1346364033/283 (Codeigniter Url's) on my Facebook wall appears fine but when clicking the resulting URL is: http://www.totalrunning.com/results/misFotos/TTRCAR1346364033/283?fb_action_ids=441641579216005&fb_action_types=og.likes&fb_source=aggregation&fb_aggregation_id=288381481237582
fb_action_ids added among other parameters this causes the url not resolving correctly
That I can do to make facebook not put those parameters in my url or like handling with Codeigniter ???
Thanks
Enabling Query Strings
In some cases you might prefer to use query strings URLs:
index.php?c=products&m=view&id=345
CodeIgniter optionally supports this capability, which can be enabled in your application/config.php file. If you open your config file you'll see these items:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
If you change enable_query_strings to TRUE this feature will become active. Your controllers and functions will then be accessible using the "trigger" words you've set to invoke your controllers and methods:
index.php?c=controller&m=method
You can read more at the Code Ignitor user-guide here: http://codeigniter.com/user_guide/general/urls.html
The solution I found was through the same file using Codeigniter .htaccess to hide the index.php
Above this htaccess put the following:
# -----------------
RewriteCond% {QUERY_STRING} ^ fb_action_ids = (. *) $ [NC]
RewriteRule ^ (. *) $ / $ 1? [R = 301, L]
# -----------------
with this code you tell the server that elime the query string of the url but only when he comes fb_action_ids or any parameter you choose not prevent the proper functioning of query strings in CodeIgniter
With this you can preserves the beautiful codeigniter urls and facebook links resolved correctly!
Important: Put it up to avoid file overwrite functionality to hide the index.php
I wouldn't recommend this method. Just add a slash after your final parameter and it will work fine. It will ignore all those facebook extras