01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.oscache.web;
06:
07: import java.io.FileNotFoundException;
08: import java.io.IOException;
09:
10: import java.net.ConnectException;
11: import java.net.URL;
12: import java.net.URLConnection;
13:
14: /**
15: * User: hani
16: * Date: Jun 12, 2003
17: * Time: 3:34:20 PM
18: */
19: public class CheckDeployment {
20: public static void main(String[] args) {
21: if (args.length == 0) {
22: throw new IllegalArgumentException(
23: "No url specified to check");
24: }
25:
26: try {
27: if (!args[0].endsWith("/")) {
28: args[0] = args[0] + "/";
29: }
30:
31: URL url = new URL(args[0] + "oscache.txt");
32: URLConnection c = url.openConnection();
33: c.getInputStream();
34: System.exit(0);
35: } catch (java.net.MalformedURLException e) {
36: System.out.println("Invalid url for oscache webapp:"
37: + args[0]);
38: } catch (ConnectException ex) {
39: System.out
40: .println("Error connecting to server at '"
41: + args[0]
42: + "', ensure that the webserver for the oscache example application is running");
43: } catch (FileNotFoundException e) {
44: System.out
45: .println("Error connecting to webapp at '"
46: + args[0]
47: + "', ensure that the example-war app is deployed correctly at the specified url");
48: } catch (IOException e) {
49: System.out
50: .println("Error connecting to webapp at '"
51: + args[0]
52: + "', ensure that the example-war app is deployed correctly at the specified url");
53: }
54:
55: System.exit(1);
56: }
57: }
|