I have a gwt url like this
http://127.0.0.1:8888/BiddingSystem.html?gwt.codesvr=127.0.0.1:9997#ForumMessage=918
when I am doing this
Window.Location.getParameter("ForumMessage")
I am getting null??
By the way, I not getting the point why this ?gwt.codesvr=127.0.0.1:9997 in the url!!
To get the value of the URL fragment (the part after the #) call Window.Location.getHash(). This will return all of "ForumMessage=918".
getParameter() returns query parameters, not the URL fragment.
See here for more information about the parts of a URL.
The ?gwt.codesvr= part is needed to run in Development Mode.
Look at this topic GWT URL Parameters
Here is answer
url should be http://localhost:8080/?testing=abc#pg5 instead of http://localhost:8080/#pg5?testing=abc
and delete that part (?gwt.codesvr=127.0.0.1:9997 ) and run it in web mode. I think it will solve your problem
Related
I'm working on a test plan with Jmeter.
The issue is that I can't retrieve the URL link as he is managed dynamically.
The URL has the following format:
localhost\blablabla?PATHPARAM=qzflh%2FGJHBGDCV%GROPJHVFFFDDFGGCFD%JJYTGVFRTVFGGFF%JUYGBG
I already try to search the value of PATHPARAM in the previous requests to retrieve it using regular expression extractor but I didn't find it.
It seems that this url is generated inside a javascript code but the way to extract it is unknown for me, inside the js code I find the value : var url = actionName + "?" + params ;
Is that any way to catch the content or the var url in Jmeter, else have you any other solution to solve this issue with this dynamic URL.
Many thanks in advance for your help.
I can see 2 possible options:
If you are being redirected to this URL automatically (you might need to play with Redirect Automatically and Follow Redirects boxes in the HTTP Request sampler
If this is the case - you should be able to get it using the following Regular Expression Extractor configuration
If you need to replicate the logic of this param variable calculation - you can attempt to do it using JSR223 PreProcessor which can execute arbitrary JavaScript code
I have an issue on where i cannot get the parameters to pass through via url.
Below is the url to the report i want to pass a single ID parameter (#ID).
I have tried a few ways, first time in passing via URL.
Any help grateful.
http://rpt.Server.local/Reports/Pages/Report.aspx?ItemPath=%2f%5bQuality+Sales+Report%5d%2fCP+Quailty+Sales+Details+Report+Preview&ViewMode=Detail
http://rpt.Server.local/Reports/Pages/Report.aspx?ItemPath=%2f%5bQuality+Sales+Report%5d%2fCP+Quailty+Sales+Details+Report+Preview&ViewMode=Detail
instead of above link try below
Go to http://rpt.Server.local/Reportserver
find your report in above link and pass "&ID=(value) at the end of the url
or
http://rpt.Server.local/Reportserver/Pages/Report.aspx?ItemPath=%2f%5bQuality+Sales+Report%5d%2fCP+Quailty+Sales+Details+Report+Preview&ID=(value)
Ok, let me rephrase my question.
I have a website set up with URL in "path" format, and the api function works well.
Now I need to change only the URL of the api part in "get" format.
For example,
http://localhost/api/query/data?data=100294832
http://localhost/api/data/100294832
works.
api is a controller, data is a model. I have this in my main.conf,
array('api/view', 'pattern'=>'api/<model:\w+>/<id:\d+>', 'verb'=>'GET'),
How could I do this? Should I create an action in api called query, and moved view function code there?
Thanks a lot!
The URL http://localhost/api/data/100294832 is the same as http://localhost/api/data/?id=100294832 by your route rule. It will work by default.
May be a dumb question, but it's been bugging me recently. I see "URL=" inside alot of URL's, such as this one:
http://www.tierraantigua.com/search-2?url=http%3A%2F%2Flink.flexmls.com%2Fwws30ham
What exactly is this used to do? Is it part of the iFrame functionality? I know the last part of the URL (after the URL=) is the part being displayed in the iFrame, but I'm unsure of why it is included in the primary URL as well.
Thanks!
The url you see here is just a standard query parameter wit the name url and the encoded value http%3A%2F%2Flink.flexmls.com%2Fwws30ham which decodes to http://link.flexmls.com/Fwws30ham. Most of the times it is used for determining redirection or source information by the application you are using. It is entirely domain-specific and can have any meaning the website developer would like to use.
PHP GET
Description ΒΆ
An associative array of variables passed to the current script via the URL parameters.
$url = $_GET['url'];
echo $url; // http%3A%2F%2Flink.flexmls.com%2Fwws30ham
Is there away to get the current fragment from a route that was issued via action link. This is how I am getting the action from the route.
string currentAction = requestContext.RouteData.Values["action"] as string ?? "index";
Can I do something similar to this?
string currentFragment = requestContext.RouteData.Values["Fragment"] as string ?? "";
No, you can't do anything like this. The fragment (everything that follows the # sign in an url) is never sent to the server by the browser, so the sole fact of talking about getting the url fragment server side simply doesn't make sense.
So if you have the following url: http://example.com/foo/bar?key1=value1#abc the server will never be able to fetch abc simply because the client will never send it.
As it has already been pointed out that is not possible. Document fragments (the string after the hash as you call it) are intended for the browsers only to correctly position the viewport. They have no meaning for the server and therefore are not transmitted there.
There is however a workaround you can use. Repeat the fragment as part of your url to make it accessible for the server.
Look at the permalink to the answers in this question. For instance, the link to my answer looks like this:
http://stackoverflow.com/questions
/6285833/get-current-fragment-in-route-asp-net-mvc/6286097#6286097
See how the value 6286097 is duplicated as the last route parameter. It's intentional. You can use this technique as well.
P.S. The fragment must point to an identifier in the document (id of some HTML element). At least in XHTML only identifiers work as fragments. Valid ids may not begin with a digit therefore instead of #6286097 use something like #answer-6286097.
P.S.#2. Do not use any JavaScript trickery to get around this limitation. Basic site functionality and design must work without JavaScript - don't listen to anyone who tells you otherwise. Fragments obviously belong to the basic tool box. Use JavaScript only for advanced interactivity.
I have a workaround for you, but first of all lets get more into the problem.
The strings after the hash symbol which are called Fragment values are not query parameters but they are strings to be read by the client-side (living in the browser) and the server cannot read them because they are not sent to the server by the browser.
Some authentication providers like Google and Azure send the access token as Fragment value for security reasons so that they are not transferred over the internet after they get sent as direct response from the authentication provider.
The only way you can come around that is to use javascript to convert the fragment values to query parameters by replacing the '#' with '?' and redirecting to the endpoint in your server controller.
I suppose the easiest way is to handle all that from server, meaning you get get the request in server, send a javascript code to the browser on the fly, that replaces the '#' into '?' and redirects to your second endpoint which reads the token as strong parameter.
Here how you can do it in ASP.NET Core 3.1:
[AllowAnonymous]
[HttpGet("authredirect")]
[Produces("text/html")]
public virtual ContentResult ConvertUrlFragmentToQueryParamThenRedirect()
{
return Content("<html><script>window.location.href=window.location.href.replace('#', '?').replace('authredirect', 'authparams')</script></html>", "text/html");
}
[AllowAnonymous]
[HttpGet("authparams")]
public virtual void GetAccessToken([FromQuery] string access_token)
{
// now you have your access token server side here
}
Please remember to set your redirectUrl to the correct one, in this case 'YOUR REDIRECT URL/authredirect'.