I'm using the HTML form <input type="file" name="my_file"> to upload
my compiled class file. When I try to get the file in the servlet, using:
File f = (File)request.getParameter("my_file");
It does not work. I need to get the class file, generate an object of it and
then execute some methods.
How can I do this?
[]s
Guilherme Ceschiatti
[EMAIL PROTECTED]
> >Hi...
> >
> >I need to upload a compiled class to my Orion application and then execute
> >some methods of it. Anybody knows how can I do it?
>
> upload the class file, instantiate a URLClassloader that points to the
> file's url, load the class using that classloader, do whatever you need
> using reflection (e.g. instantiate objects, call methods on them, whatever)
> and after that dump the classloader.
>
> however as simple as that may be, are you aware of the security
> implications of this? if this is not just for playing around, you should
> read up on java security and classloading and then subclass URLClassLoader
> and implement a very restrictive getPermissions() method for the uploaded
> code.
>
> before you do that be REALLY, REALLY sure you know what you are doing if
> this is for real world use!!!
>
> other than that I don't see any difficulties in achieving what you
> described.
>
> HTH,
>
> robert
>
> >[]s
> >Guilherme Ceschiatti
> >[EMAIL PROTECTED]
>
> (-) Robert Kr�ger
> (-) SIGNAL 7 Gesellschaft f�r Informationstechnologie mbH
> (-) Br�der-Knau�-Str. 79 - 64285 Darmstadt,
> (-) Tel: 06151 665401, Fax: 06151 665373
> (-) [EMAIL PROTECTED], www.signal7.de