Re: Web upload of a Java class

2000-11-13 Thread Sven van 't Veer



Storm Linux User wrote:
 
 It's not form commercial use. It's for my research project for getting my
 master's degree in Electrical Engineering ... I'm not concered about securety
 right now.
 
Hmm as long as you're not pursueing a masters in computer security..

Take a look at http://www.servlets.com and get the /com/oreilly/servlet
package. It contains a class called MultiPartRequest, which should help
you upload the file to your server. Then all you should do is have your
servlet copy the file from te location from where it was uploaded to the
location from where you can run the classfile..


It's quite dangerous thou ;-)

sven

-- 
==
Sven E. van 't Veer  
http://www.cachoeiro.net
Java Developer  [EMAIL PROTECTED]
==




RE: Web upload of a Java class

2000-11-12 Thread Russ White

This sounds dangerous. Why would you want to do it?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Storm Linux
User
Sent: Saturday, November 11, 2000 6:55 AM
To: Orion-Interest
Subject: Re: Web upload of a Java class


I mean it's showed to the user a HTML form that the user of the application 
can select I file to upload. It can be any file, to store in the application 
database, or even a java class. In the last case, instead of putting it into 
the database, the application will execute some methods of the class. I wish 
I'm more clear now

Thanks.
Guilherme Ceschiatti

On Friday 10 November 2000 19:24, you wrote:
 Sorry..not sure I understand? Do you mean "deploy" it into an application
 server, so that it immediately takes affect and then you can use it right
 away? If so, look at the .WAR format, or .EAR format. Its a J2EE standard
 format and most app servers should provide some sort of hot-swap
 application deployment capability. You simply upload the .war or .ear, and
 the app server serializes all HttpSession objects to disk (or some place),
 then reloads the app with the new class(es), then reads the serialized
 objects back into the HttpSession. This makes it appear to clients that
 nothing is different, but your new class(es) will be available.

  -Original Message-
  From: Storm Linux User [mailto:[EMAIL PROTECTED]]
  Sent: Friday, November 10, 2000 10:46 AM
  To: Orion-Interest
  Subject: Web upload of a Java class
 
 
  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?
 
  []s
  Guilherme Ceschiatti
  [EMAIL PROTECTED]






Re: Web upload of a Java class

2000-11-12 Thread Storm Linux User

It's not form commercial use. It's for my research project for getting my 
master's degree in Electrical Engineering ... I'm not concered about securety 
right now.

[]s
Guilherme Ceschiatti
[EMAIL PROTECTED]

On Sunday 12 November 2000 12:41, you wrote:
 This sounds dangerous. Why would you want to do it?

 I mean it's showed to the user a HTML form that the user of the application
 can select I file to upload. It can be any file, to store in the
 application database, or even a java class. In the last case, instead of
 putting it into the database, the application will execute some methods of
 the class. I wish I'm more clear now

 Thanks.
 Guilherme Ceschiatti

 On Friday 10 November 2000 19:24, you wrote:
  Sorry..not sure I understand? Do you mean "deploy" it into an application
  server, so that it immediately takes affect and then you can use it right
  away? If so, look at the .WAR format, or .EAR format. Its a J2EE standard
  format and most app servers should provide some sort of hot-swap
  application deployment capability. You simply upload the .war or .ear,
  and the app server serializes all HttpSession objects to disk (or some
  place), then reloads the app with the new class(es), then reads the
  serialized objects back into the HttpSession. This makes it appear to
  clients that nothing is different, but your new class(es) will be
  available.
 
   -Original Message-
   From: Storm Linux User [mailto:[EMAIL PROTECTED]]
   Sent: Friday, November 10, 2000 10:46 AM
   To: Orion-Interest
   Subject: Web upload of a Java class
  
  
   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?
  
   []s
   Guilherme Ceschiatti
   [EMAIL PROTECTED]




Re: Web upload of a Java class

2000-11-12 Thread Robert Krueger

At 15:00 12.11.00 , you wrote:
It's not form commercial use. It's for my research project for getting my
master's degree in Electrical Engineering ... I'm not concered about securety
right now.

then hack right on. will be fun. the security aspects of this could easily 
fill a chapter of your thesis if it fits your topic ;-).

robert




(-) 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





Re: Web upload of a Java class

2000-11-12 Thread Storm Linux User

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




Re: Web upload of a Java class

2000-11-12 Thread Robert Krueger


oh, I see. that's something the servlet api doesn't do for you. to parse a 
multipart request (that's what you use for file-upload) all you get is an 
input stream that you can parse which you have to decode. however there are 
plenty of utilities that do this for you. one is even shipped with orion.

check the api docs for FilePostParser. there is a source example of how to 
use it.

just get the request input stream, apply the parser to it (again gives you 
input stream on the decoded data items) and store copy the data from the 
input stream to a file.

remember to set the form enctype to multipart/form-data.

that should be all you need to get going.

robert

At 17:33 12.11.00 , you wrote:
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]

(-) 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





Re: Web upload of a Java class

2000-11-11 Thread Robert Krueger

At 16:45 10.11.00 , you wrote:
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





Web upload of a Java class

2000-11-10 Thread Storm Linux User

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?

[]s
Guilherme Ceschiatti
[EMAIL PROTECTED]





RE: Web upload of a Java class

2000-11-10 Thread Duffey, Kevin

Sorry..not sure I understand? Do you mean "deploy" it into an application
server, so that it immediately takes affect and then you can use it right
away? If so, look at the .WAR format, or .EAR format. Its a J2EE standard
format and most app servers should provide some sort of hot-swap application
deployment capability. You simply upload the .war or .ear, and the app
server serializes all HttpSession objects to disk (or some place), then
reloads the app with the new class(es), then reads the serialized objects
back into the HttpSession. This makes it appear to clients that nothing is
different, but your new class(es) will be available.


 -Original Message-
 From: Storm Linux User [mailto:[EMAIL PROTECTED]]
 Sent: Friday, November 10, 2000 10:46 AM
 To: Orion-Interest
 Subject: Web upload of a Java class
 
 
 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?
 
 []s
 Guilherme Ceschiatti
 [EMAIL PROTECTED]