home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
win95
/
sieciowe
/
hotja32.lzh
/
hotjava
/
classsrc
/
net
/
www
/
httpd
/
plugins
/
executeshell.java
Wrap
Text File
|
1995-08-11
|
2KB
|
44 lines
/*
* @(#)executeShell.java 1.2 95/05/10
*
* Copyright (c) 1995 Sun Microsystems, Inc. All Rights reserved Permission to
* use, copy, modify, and distribute this software and its documentation for
* NON-COMMERCIAL purposes and without fee is hereby granted provided that
* this copyright notice appears in all copies. Please refer to the file
* copyright.html for further important copyright and licensing information.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
* OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY
* LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR
* ITS DERIVATIVES.
*/
package net.www.httpd.plugins;
import net.www.httpd.ServerPlugin;
import net.www.httpd.Server;
import net.www.html.URL;
/**
* A class to define a server plugin that will execute a shell command
* and return its output as an html document.
* @author James Gosling
*/
class executeShell extends ServerPlugin {
String validate() {
if (args.length < 1)
return "No shell command specified";
return null;
}
void getRequest(Server s, URL u) {
String command = args[0].toString();
for (int i = 1; i < args.length; i++)
command = command + " " + args[i].toString();
System.out.print("Trying to exec <" + command + ">\n");
s.generateProcessOutput(command, command);
}
}