Kibana 4 : Url not formatted properly - url

I have a field in my index like
path: /abc/nvb/jklk.txt
I autoindex it as string and it is displayed as above. Now, i want to convert it to a url. So in the index settings in Kibana, i apply set this field as a Url and apply
Url Template
hostname:portNumber#{{value}}
Label template
{{value}}
now this field appears as a link in my discover view. But when i click on it, it navigates to
hostName:portNumber#%2Fabc%2Fnvb%2Fjklk.txt
why did all of my /s get replaced by %2F ? Note that, i was expecting the link to navigate to
hostName:portNumber#/abc/nvb/jklk.txt
which is indeed a valid url
I have tried putting the value as
path: //abc//nvb//jklk.txt
and even
path: \/abc\/nvb\/jklk.txt
but the result is the same. The slashes always get encoded. Is there a way to solve this? Will I have to modify my mapping?

it should be
Url Template
hostname:portNumber#{{rawValue}}

Related

How do I pass url parameters within url parameters

I want to show a pdf using google viewer like this:
https://drive.google.com/viewerng/viewer?embedded=true&url=http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf
But my page should be opened with parameters like this:
https://mywebsite.com/pdfgenerator.xhtml?parameter1=true&parameter2=false
(On this page a pdf is generated, and that is not a valid website)
That means that I should pass parameters within the url parameter of the first page, but then they get interpreted as the parameters for the first page.
https://drive.google.com/viewerng/viewer?embedded=true&url=https://mywebsite.com/pdfgenerator.xhtml?parameter1=true&parameter2=false
How do I solve this problem? How do I pass a parameter within a parameter? I can't find any information about it.
Thank you for your help.
It's solved: If you encode it using encodeURIComponent and then pass it as the parameter it works. If you need to do it quickly you can use this TryIt from W3Schools. Adjust the address, click run and click the button, then copy the link.

Alter the browser URL in Rails

Is there any way to change the browser URL of the request?
Lets say I've a '/articles/foo-bar' and I need to change this to '/articles/foo_bar'.
I've tried Routing Constraints and changed the request.path_info with no luck. I successfully changed the parameters but is not reflected in Browser URL.
PS: I want to replace '-' to '_' in browser URL in overall App.
EDITED:
Routes: get 'brands/:name-:id/articles', to: 'brands#articles'
Here name can be changed dynamically. And if a dash in name should be replaced by underscore.
You can use to_params method on your model
Please check this
http://blog.teamtreehouse.com/creating-vanity-urls-in-rails

hash tags in urls and hyperlinks

I created a hyperlink to a file. the file name contains hashtags as a means to separate information.
<div style="height:100%;width:100%">.</div>
translated to...
http://localhost/dir/upload/1427853638#0#file#A101.pdf
Is this a "legal" name in a URL? Im getting a "file not found" error
The requested URL /dir/upload/1427853638 was not found on this server.
So, clearly the # has another meaning in the URL (I understand now, its a location hash property). Is there a way to get this to work, or do i need to use another character besides the # in the file names?
Since # is a special character in the URL semantic (it's used to provide an internal anchor in a HTML page), it should be URL-encoded into %23.
Your URL should be: http://localhost/dir/upload/1427853638%230%23file%23A101.pdf.
NB: you can find an online URL encoder here: http://meyerweb.com/eric/tools/dencoder/

How does one escape the # sign in a Url pattern in UrlMappings.groovy?

In order to maintain the current set of Urls in a project, I have to be able to use the # (pound sign) in the Url. For some reason the pound sign does not appear to work normally in this project for UrlMappings.groovy.
Is there a special escape-sequence that must be used when placing # signs in UrlMappings.groovy?
Am I missing some reason why one cannot use pound signs at all?
In the following URL Mapping example, the browser goes to the correct page, but the pageName variable is null:
"/test/${urlName}#/overview"(controller:'test', action:'overview') {
pageName = "overview"
}
I thought everything after # in the url would be treated on the client side of the browsers where it tries to find a and scroll to that location.
If you dump the request containing the pound char, do you even see the data behind #?
I used a Named URL mapping and it works fine, no need to escape the "#" sign:
name test: "/#abc" (controller: 'test', action:'homepage')
EDIT: My above answer is wrong. In fact, it falls to a special case when homepage is the default action of the view.
Netbrain is right, the path after "#" will never be sent to server. In stead, I found that it's possible using "%23" instead of "#". Please take a look at here.
For example, instead of /test#/abc we should use /test%23/abc as URL mapping (both at client side & server side).

Problem with encode slash in url

I have problem with encode slash in url.
Problem:
from request in GSP page:
Gallery
I got:
http://foo.cz/myapp/page/show?url=home%2Fgallery
in address row in Internet browser.
Problem is with encode character from "/" to "%2F".
Explanation:
this is link in my gsp file:
Gallery
after click request goes to controller:
def show ={
def page = Page.findByUrl( params.url ) //it works
}
then I got gsp page in my Internet browser. All work fine, I got required page, but in adress row in Internet browser I saw:
http://foo.cz/myapp/page/show?url=home%2Fgallery
There is not character "/", but encode "%2F"
Motivation
I want to set the url in UrlMapping.groovy to:
"/${url}" (controller:"page", action:"show")
and get:
http://foo.cz/myapp/home/gallery/
but there are problem with encode character "/".
Finish
Can you help me please?
Thanks a lot Tom
you need to decode the Url in grails
http://www.grails.org/Dynamic+Encoding+Methods
it is not difficult replace "%2F" to "/", but then, there are problem with url mapping.
Transformation is in Grails tag CreateLink.
See source. There are involve String method encodeAsURL() as Aaron Saunders told my above.
For example, You can only write your own tag and use String method replaceAll("%F2", "/") and it work.
I got desired url in address row in Internet browser:
http://foo.cz/myapp/page/show?url=home/gallery
and I replaced to in MappingURL.groovy to:
http://foo.cz/myapp/home/gallery
Hmm, I have to use wildcart and other dirty code in controller.
It is not nice code.
Now I know, that is not good idea use slash(/) in params as Olexandr told my above.
It is work fine when You use for example "-" or other save URL character as param delimiter.
Thanks a lot all gurus.
Tom

Resources