Hi Mark,

I don't understand why you are trying to do (basically because I have never worked with cgi-bin servlets). But I tried running your code on the console, and this is what I got after typing "this is a test"

----------------------------------------------------------------------------
mymachine> ./test
this is a test
Content-type: text/html

<html><head><title>Upload files using Oz</title></head><body bgcolor="#f0f0e0"><h1>Oz file upload</h1><p>The data received was:this is a test
</p></body></html>
----------------------------------------------------------------------------

So I decided to feed the program with its own code as input, and this is what I got:

----------------------------------------------------------------------------
mymachine> ./test < test.oz
Content-type: text/html

<html><head><title>Upload files using Oz</title></head><body bgcolor="#f0f0e0"><h1>Oz file upload</h1><p>The data received was:%%cgi-bin program to accept file uploads
functor
import
   Open
   Application
   OS
define
   StdIn={New Open.file init(name:stdin flags:[read])}
   Env={StdIn read(list:$)}
   Out={New class $
           from Open.file Open.html
        end
    init(name:stdout)}

   %% Print MIME content header
   {Out header}
   {Out tag(html(head(title('Upload files using Oz'))
         body(bgcolor:'#f0f0e0'
              h1('Oz file upload')
              p('The data received was:'#Env)
             )))}
   {Application.exit 0}
end
</p></body></html>
----------------------------------------------------------------------------

That's the only help I can provide.

cheers
Boriss


Mark richardson wrote:
Hi,

I wonder if anyone has any experience using Oz for cgi-bin servlets?
I've already successfully created one to give a solution for n-queens
for a submitted board size so I know I can use the facility properly.
What I'm now trying to do is create an 'upload-file' servlet in oz.
As far as I understand the operation of cgi (and I'm no expert!), in the
case of file uploads the data for the file itself is passed via the
servlets stdin.
So, I have the following functor definition:

%%cgi-bin program to accept file uploads
functor
import
   Open
   Application
   OS
define
   StdIn={New Open.file init(name:stdin flags:[read])}
   Env={StdIn read(list:$)}
   Out={New class $
           from Open.file Open.html
        end
    init(name:stdout)}

   %% Print MIME content header
   {Out header}
   {Out tag(html(head(title('Upload files using Oz'))
         body(bgcolor:'#f0f0e0'
              h1('Oz file upload')
              p('The data received was:'#Env)
             )))}
   {Application.exit 0}
end

I'm not currently worried about what actually is received, I'd be happy
at the moment to see anything coming into 'Env'. My problem is that I
appear to be receiving nil. The servlet executes but nothing appears
after "The data received was:".

The difficulty is that I can't see any way of debugging this except
executing it through the web server, so I don't know if 'something' has
been received or not.

Any advice would be gratefully received.

Regards

Mark


_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to