ASF Bugzilla – Attachment 16110 Details for
Bug 36270
[PATCH] code to support browse task
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[PATCH]Browse Task
BrowseTask.java (text/plain), 1.60 KB, created by
Dave Brosius
on 2005-08-19 06:23:15 UTC
(
hide
)
Description:
[PATCH]Browse Task
Filename:
MIME Type:
Creator:
Dave Brosius
Created:
2005-08-19 06:23:15 UTC
Size:
1.60 KB
patch
obsolete
>package org.apache.tools.ant.taskdefs.optional.browse; > >import java.io.IOException; >import java.net.MalformedURLException; >import java.net.URL; > >import org.apache.tools.ant.BuildException; >import org.apache.tools.ant.Task; > >/** shows a url in a browser > * > * @author Dave Brosius > * > */ >public class BrowseTask extends Task >{ > URL url = null; > > public void seturl(String url) { > try { > this.url = new URL(url); > } catch (MalformedURLException mue) { > this.url = null; > } > } > > public void execute() throws BuildException { > if (url == null) > throw new BuildException("Invalid url, or none specified."); > > String os = System.getProperty("os.name").toLowerCase(); > Runtime rt = Runtime.getRuntime(); > try{ > if (os.indexOf( "win" ) >= 0) { > rt.exec( "rundll32 url.dll,FileProtocolHandler " + url); > } else if (os.indexOf( "mac" ) >= 0) { > rt.exec( "open " + url); > } else if (os.indexOf( "nix") >=0 || os.indexOf( "nux") >=0) { > String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", > "netscape","opera","links","lynx"}; > > StringBuffer cmd = new StringBuffer(); > for (int i=0; i<browsers.length; i++) > cmd.append( (i==0 ? "" : " || " ) + browsers[i] +" \"" + url + "\" "); > > rt.exec(new String[] { "sh", "-c", cmd.toString() }); > } else { > throw new BuildException("Unsupported platform"); > } > }catch (IOException e){ > throw new BuildException(e.getMessage(), e); > } > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 36270
: 16110 |
16111