<?vsp 
--  
--  $Id$
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2024 OpenLink Software
--  
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--  
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--  
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--  
--  


  declare err varchar;
  declare op varchar;
  declare res integer;

  op := atoi ({?'op'});
  res := 0;
  err := '';

  if (op = 1)
   res := Restricted::ret_1 ();

  declare exit handler for sqlstate '*' { err := __SQL_MESSAGE; };
    {
      if (op = 2)
	res := Restricted::write_file ();

      if (op = 3)
	res := Restricted::get_prop ();

      if (op = 4)
	res := Restricted::listen ();
    }

?>
<html>
 <HEAD>
 <link rel="stylesheet" type="text/css" href="../demo.css" />
  <STYLE>
  .filelist {
    font-family: Tahoma, sans-serif;
    background-color: #eeeeee;
    color: Black;
    border: 1px #dddddd solid;
  }
  </STYLE>
  </HEAD>
 <body>
  <H4>JAVA HOSTING SECURITY SAMPLE.</H4>
  This samples shows importing classes with restrictions. <BR />
  The created types can't access file system, sytem variables and Web access. <BR />
  See Restricted.java for more details. <BR />
  <form method=post action="<?=http_path()?>">
  <table class="tableentry">
  <tr>
    <td>Choose Method to invoke</td>
    <td>
      <select name="op">
        <option value="1"  <?= case {?'op'} when '1' then 'selected' else '' end ?>>IntegerTest</option>
        <option value="2"  <?= case {?'op'} when '2' then 'selected' else '' end ?>>FileAccessTest</option>
        <option value="3"  <?= case {?'op'} when '3' then 'selected' else '' end ?>>GetEnvTest</option>
        <option value="4"  <?= case {?'op'} when '4' then 'selected' else '' end ?>>Listen</option>
      </select>
    </td>
  </tr>
  <tr>
    <td>Start Call</td>
    <td><input type="submit" name="exec" value="Execute"></td>
  </tr>
  </table>
  </form>
<?vsp if (res <> 0)
  	{
?>
  <table>
       <tr>
	 <td>
	<table class="tableresult">
	  <tr>
	  	<td>Result:</td>
		<td><?=res?></td> </tr>
	</table>
	</td>
	</tr>
  </table>
<?vsp
  	}
 if (err <> '')
  	{
?>
  <table>
       <tr>
	 <td>
	<table class="tableresult">
	  <tr>
	  	<td>Excecution error:</td>
		<td><?=err?></td> </tr>
	</table>
	</td>
	</tr>
  </table>
<?vsp
  	}
?>
 </body>
</html>
