Hi,
zunächst mal zum Problem WAS hinter DMZ. Das heisst, der WAS ist von aussen nicht erreichbar (Internet). Bin zwar kein Sicherheitsexperte, würde aber auch auf jeden Fall genau dazu raten. Für 'aussen' erreichbar sollte ein Webserver stehen mit Reverse-Proxy, der entsprechend requests auf den WAS 'umleitet' und zurück.
Zum Problem mit Dateiupload und Download. Das kann man mit in HTML mit einem entsprechenden input tag lösen (zum Dateiupload). Encoding der Page muss dabei multipart-formdata sein.
Ein gutes Beispiel, wie ein upload und download in einer BSP erfolt ist die Beispielapplikation 'IT00'.
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
<h2
> Form with Method POST
and enctype
"multipart/form-data"</h2> <form method="POST" enctype="multipart/form-data"> <table border=1 width="100%">
- GeSHi ©
Die Datei kann dann im OnInputProcessing entgegengenommen werden und zwar wie folgt:
- Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
* file upload and echo
data: entity
type ref to if_http_entity
, file type xstring,
content_type type string,
content_length type string,
num_multiparts type i,
i type i value 1,
doEcho type string.
* find multipart containing file
num_multiparts = request->num_multiparts( ).
while i
<= num_multiparts
. entity = request->get_multipart( i ).
value = entity->get_header_field( '~content_filename' ).
* found a file!
navigation->set_parameter( name = 'content_filename'
value = value ).
content_type = entity->get_header_field( 'Content-Type' ).
navigation->set_parameter( name = 'content_type'
value = content_type ).
* get file content
file = entity->get_data( ).
* get file size
content_length = xstrlen( file ).
navigation->set_parameter( name = 'content_length'
value = content_length ).
* echo/download the same file again?
doEcho = request->get_form_field( 'doEcho' ).
if doEcho
is not initial. * set response data to be the file content
runtime->server->response->set_data( file ).
* set the mime-type and file size in the response
runtime->server->response->set_header_field(
name = 'Content-Type'
value = content_type ).
runtime->server->response->set_header_field(
name = 'Content-Length'
value = content_length ).
runtime->server->response->delete_header_field(
name = 'Cache-Control' ).
runtime->server->response->delete_header_field(
name = 'Expires' ).
i = i + 1.
if doEcho
is not initial. * signal to the BSP runtime that the response data is
* complete and no onLayout method should be called to
* create the response
navigation->response_complete( ).
navigation->goto_page( 'transition_parameter_upload.htm' ).
- GeSHi ©
Gruß,
Steff