I have a strange problem with request param value. Silverlight application is opened inside aspx page. Problem appears when my queryString contains equals sign.
I inspected values in silverlight application and found out that value from uri differs from value retrieved as queryString parameter:
HtmlPage.Document.DocumentUri.OriginalString:
"http://localhost:8081/SilverlightContainer.aspx?sys_ObjectId=2&sys_Param1={\"p1\":\"Narud\\u017Ebenica =\"}"
HtmlPage.Document.QueryString["sys_Param1"]:
"{\"p1\":\"Narud\\u017Ebenica "
If sys_Param1 doesn't contain equals sign everything works as expected.
Thanks.
I solved this by removing problematic part of url and reading javascript variable from silverlight instead of passing it in querystring.
Another way is using javascript encodeURIComponent but I decided to use variable approach.
I still don't know what causes this problem since my url look correct.
Related
We have a legacy webapp written in AngularJs and it doesn't uses the HTML5 mode in location provider. When we have the URL in following valid format $location.search() returns empty object
https://my.domain.com/path/index.html?param=value#hashpart
But when the URL is in following non-conventional way it returns the object {'param':'value'}
https://my.domain.com/path/index.html#hashpart?param=value
RFC3986 says the fragment should come at the end of the URI
Can anyone help us to understand why? We need the URL in the first format.
I'm creating a route using the Java DSL in Camel.
I'd like to perform a text substitution without creating a new processor or bean.
I have this:
.setHeader(MY_THING,
constant(my_template.replace("{id1}", simple("${header.subs_val}").getText())))
If I don't add 'constant' I get type mismatch errors. If I don't put getText() on the simple() part, I get text mismatch answers. When I run my route, it replaces {id} with the literal ${header.subs_val} instead of fetching my value from the header. Yet if I take the quotes off, I get compile errors; Java doesn't know the ${...} syntax of course.
Deployment takes a few minutes, so experiments are expensive.
So, how can I just do a simple substitution. Nothing I am finding on the web actually seems to work.
EDIT - what is the template? Specifically, a string (it's a URL)
http://this/that/{id1}/another/thing
I've inherited some code, so I am unable to simply to(...) the URL and apply the special .tof() (??) formatting.
Interesting case!
If you place my_template in a header you could use a nested simple expression(Camel 2.9 onwards) like in the example below. I am also setting a value to subs_val for the example, but I suppose your header has already a value in the route.
.setHeader("my_template", constant("http://this/that/{id1}/another/thing"))
.setHeader("subs_val",constant("22"))
.setHeader("MY_THING",simple("${in.header.my_template.replaceAll(\"\\{id1.?\",${in.header.subs_val.toString()})}"))
After this step header MY_THING has the value http://this/that/22/another/thing.
1)In this example I could skip to_String() but I do not know what's the type of your header "subs_val" .
2) I tried first with replaceAll(\"\{id1\"}\") but it didn't work with } Probably this is a bug...Will look at it again. That's why in my regex I used .?
3) When you debug your application inside a processor, where the exchange is available you can use SimpleBuilder to evaluate a simple expression easily in your IDE, without having to restart your app
SimpleBuilder.simple("${in.header.url.replaceAll(\"\\{id1.?\",${in.header.subs_val.toString()})}").evaluate(exchange, String.class);
Hope it helped :)
in Silverlight 5:
var uri= new Uri("http://www.last.fm/api/auth/?api_key=xyz&cb=http://localhost:19000/callback?bla=blu")
HtmlPage.Window.Navigate(uri);
lands my browser at:
http://www.last.fm/api/auth?api_key=xyz&cb=http://localhost:19000/callback%253Fbla=blu
Note how the "?" of the URL in the callback parameter gets escaped to %253F - even though, if I look at uri.ToString() in the debugger, it's not escaped.
How can I prevent that from happening?
Many thanks,
Max
I got no answer, but if anyone stumbles across the same issue, here's what I tried and what I finally did:
First, I attempted to use HtmlPage.Window.Eval() to execute javascript which would navigate to that URL. Again, the ? was escaped even though URL.ToString() didn't escape it.
So what I finally did - could have thought of it earlier, really ;P - was to change my callback handler to follow a REST like format. Instead of:
http://localhost:19000/callback?bla=blu
it now listens at:
http://localhost:19000/callback/bla=blu
and takes the parameter value out of the path. No question mark involved anymore, problem solved.
I find a problem when i develop application via cakephp.
for example: my url is http://localhost/controller/view/id this is working fine.
BUT, when i append more invalid parameter, it still works,
like http://localhost/controller/view/id/adfasd/adfasdf/asdfasdf/asdfasdf
It should show up 404 page not found.
Shall i need to use $this->passedArgs to check pass parameter manually in controller then throw exception? Or is there any configuration?
How can i deal with this case
Thank you
You should first look here Cakephp, Routing-Named params to find out how to properly use them.
As you should add which one to use, you should also add a regex to your id in the route.
Also when sending the data to an action you should throw the exception there like it is explained here: cakephp deal with passing wrong parameter in url
I have a Silverlight app where I'm trying to load an image from the server via a relative URL that includes a query string. Specifically, I'm accessing a proxy page called proxy.jsp that takes a parameter "url". I've verified that the string I'm passing to the System.Uri constructor has the query string, but it would appear that Silverlight is stripping or ignoring it. Here's some sample code:
string proxyUrl = "../proxy.jsp?url=anything";
Uri uri = new Uri(proxyUrl, UriKind.Relative);
BitmapImage im = new BitmapImage(uri);
someSilverlightImage.Source = im;
I know that I have the base URL correct, because my proxy.jsp is returning the default image it returns if the url parameter is null. For fun, I tried displaying the property uri.Query with a MessageBox and got an exception saying that the Query property is only supported for UriKind.Absolute. But, if I display uri.ToString(), I get the full URL I passed in.
My questions are:
Is my conclusion correct that, by default, Silverlight ignores the query string when making requests for relative URI's?
If so, is there any configuration I can do to override the default?
If I can't override the default, any insight into the design or implementation concerns that would have motivated this seemingly glaring omission?
Thanks!