com.sas.servlet.util
Class OpenURL

com.sas.servlet.util.OpenURL

public class OpenURL

Application for opening the given URL and redirecting the contents to some output device (such as the console or file).

Usage:

java com.sas.servlet.util.OpenURL <url> [-o<filename>] [-r<search>=<replace>]

url = The URL to open

filename = The optional output file name

search=replace = An optional search and replace parameter. Multiple search and replace parameters can be specified. If an '=' sign must be used in the search and/or replace string it must be escaped with '\='. Searches are case- sensitive. A quote (") can be represented by double single quotes ('')


Constructor Summary
OpenURL()
           
 
Method Summary
protected  int findString(java.lang.String s, java.lang.String p, java.lang.String escPrefix)
          Finds the given pattern in the given string.
protected  java.lang.String getArg(java.lang.String[] args, java.lang.String sw)
          Returns the argument with the given leading switch.
static void main(java.lang.String[] args)
          Main entry point
 void open(java.lang.String[] args)
          Open the URL and send to the output device
protected  java.lang.String searchAndReplace(java.lang.String s, java.lang.String search, java.lang.String replace)
          Searches and replaces.
 

Constructor Detail

OpenURL

public OpenURL()
Method Detail

main

public static void main(java.lang.String[] args)
Main entry point

Parameters:
args - The program arguments

open

public void open(java.lang.String[] args)
          throws java.lang.Exception
Open the URL and send to the output device

Parameters:
args - The program arguments
Throws:
java.lang.Exception - If some exception occurs

getArg

protected java.lang.String getArg(java.lang.String[] args,
                                  java.lang.String sw)
Returns the argument with the given leading switch. If the switch is null this indicates to return the first non-switched argument. Note that the argument will be removed from the array once the value has been retrieved.

Parameters:
args - The program arguments
switch - The switch to search for
Returns:
The argument, or null for not found

findString

protected int findString(java.lang.String s,
                         java.lang.String p,
                         java.lang.String escPrefix)
Finds the given pattern in the given string. An escape prefix can also be specified to indicate a pattern that should not be considered a match


searchAndReplace

protected java.lang.String searchAndReplace(java.lang.String s,
                                            java.lang.String search,
                                            java.lang.String replace)
Searches and replaces. The search string must match exactly - it is case sensitive




Copyright © 2009 SAS Institute Inc. All Rights Reserved.