java - decode URL in ANT -
i developing ant build script should invoked via application (the oxygen xml editor). application passes properties, 1 of path, encoded url (note: don't have command on input; is url). example, property ${project.url}
assigned file:/f:/projectpath/
. in ant script, i'm stripping file:/
part path can utilize in ant tasks <mkdir dir="${project.path}/_temp/>
.
yet, appears simplistic more complex urls. suppose project path contains space. ${project.url}
property assigned file:/f:/project%20path/
. stripping out 'file:/
part results in path still problematic ant tasks. in case, url encoded space character (%20
) should decoded 1 time again space <mkdir/>
task above work.
of course, problem isn't limited spaces, applies characters end escaped in encoded url. therefore, url should decoded in order of utilize in ant tasks.
is there easy way in ant (preferably without ant-contrib) to:
decode url assign decoded url property...so that, given property ${project.url}
value file:/f:/project%20path/
, can derive property ${project.path}
value f:/project path/
?
you can run <script>
task set variable, utilize variable later in build.xml.
for example:
https://ant.apache.org/manual/tasks/script.html
<script language="groovy"> xmlfiles = new java.io.file(".").listfiles().findall{ =~ "\.xml$"} xmlfiles.sort().each { self.log(it.tostring())} </script>
java url ant urldecode
No comments:
Post a Comment