Hi,
we've got a program which is called mega plus. This software is basically web based but it doesn'T use normal http protocol. Instead, it seperates parameters using the pipe | (%7c).
Sadly, this disturbs confluence. Links to megaplus don't work unless I manually repeace those pipes with %7c.
Is there any way to do this automatically?
Some ugly user macro to the rescue
## @param Url:title=Url|type=string|required=true|desc=Server name (with protocol) ## @param Query:title=Query|type=string|required=true|desc=Query (to encode) #set ($urlEncoderClass=$content.class.forName('java.net.URLEncoder')) #set ($stringClass=$content.class.forName('java.lang.String')) #set ($getInstanceMethod=$urlEncoderClass.getDeclaredMethod('encode', $stringClass)) #set ($encoded=$getInstanceMethod.invoke(null, $paramQuery)) <a href="$paramUrl${encoded}">$paramUrl$paramQuery</a>
Basically, in your case you can hardcode the paramUrl parameter to make it easier to put such links (only the query string to enter, which will be encoded properly in a link, but will look as-is in link's caption)
That is because the pipe character ('|') is not allowed in URLs. That is why it needs to be encoded. You can read more in the standard RFC 1738.
I am afraid there is not an easy way to replace those character automatically. There is already a feature request for this in https://jira.atlassian.com/browse/CONF-12818.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.