1 5 package com.opensymphony.oscache.web; 6 7 import java.io.FileNotFoundException ; 8 import java.io.IOException ; 9 10 import java.net.ConnectException ; 11 import java.net.URL ; 12 import java.net.URLConnection ; 13 14 19 public class CheckDeployment { 20 public static void main(String [] args) { 21 if (args.length == 0) { 22 throw new IllegalArgumentException ("No url specified to check"); 23 } 24 25 try { 26 if (!args[0].endsWith("/")) { 27 args[0] = args[0] + "/"; 28 } 29 30 URL url = new URL (args[0] + "oscache.txt"); 31 URLConnection c = url.openConnection(); 32 c.getInputStream(); 33 System.exit(0); 34 } catch (java.net.MalformedURLException e) { 35 System.out.println("Invalid url for oscache webapp:" + args[0]); 36 } catch (ConnectException ex) { 37 System.out.println("Error connecting to server at '" + args[0] + "', ensure that the webserver for the oscache example application is running"); 38 } catch (FileNotFoundException e) { 39 System.out.println("Error connecting to webapp at '" + args[0] + "', ensure that the example-war app is deployed correctly at the specified url"); 40 } catch (IOException e) { 41 System.out.println("Error connecting to webapp at '" + args[0] + "', ensure that the example-war app is deployed correctly at the specified url"); 42 } 43 44 System.exit(1); 45 } 46 } 47 | Popular Tags |