我试图从webservice打开一个链接可以这样做 或者我可以通过webservice调用webservice
@Path("/testUrl")
public class TestResource {
@GET
@Produces("text/plain")
public void callUrl() throws Exception {
open("http://www.goggle.com");
open("http://www.goggle.com");
Desktop desktop = java.awt.Desktop.getDesktop();
URI url1 = new URI("http://www.google.com");
URI url2 = new URI("http://www.yahoo.com");
desktop.browse(url1);
desktop.browse(url2);
}
private void open(String url) throws Exception {
URL siteURL = new URL(url);
HttpURLConnection connection = (HttpURLConnection) siteURL.openConnection();
connection.setRequestMethod("GET");
connection.connect();
}
}