Closed newbro closed 7 years ago
Hi @newbro,
Remember dbax always uses the "Flexible Parameter Passing" method so URLs should always be invoked with a "!" In front of appID:
This is a simple example:
CREATE OR REPLACE PROCEDURE hello (name_array IN owa_util.vc_arr DEFAULT dbx.empty_vc_arr
, value_array IN owa_util.vc_arr DEFAULT dbx.empty_vc_arr )
AS
BEGIN
-- dbax framework kernel
dbx.dispatcher (p_appid => 'HELLO'
, name_array => name_array
, value_array => value_array
, router => 'PK_APP_HELLO.ROUTER');
END hello;
/
CREATE OR REPLACE PACKAGE pk_app_hello
AS
FUNCTION router
RETURN CLOB;
END;
/
CREATE OR REPLACE PACKAGE BODY pk_app_hello
AS
FUNCTION router
RETURN CLOB
AS
BEGIN
if route_.get ('admin')
then
return 'Hello World from GET' || CHR(10);
end if;
if route_.post('admin')
then
return 'Hello World form POST' || CHR(10);
end if;
END;
END;
/
With curl I escaped the "!"
osalvador$ curl -X GET http://ohs:7777/pls/dbax/\!hello?p=/admin
Hello World from GET
osalvador$ curl -X POST http://ohs:7777/pls/dbax/\!hello?p=/admin
Hello World form POST
Thanks for your quick reply osalvador~
I was aware of the flexible parameter requirement, I revisit the codes and turn out it was the enctype="multipart/form-data"
attribute in the form which caused the problem.
I assume the current implementation of router doesn't support multipart form / file handling?
I am currently working on file handling since not all gateways (ords, ohs, mod_plsq, mod_owa, dbms_epg) act in the same way.
Some of these gateways do not support all HTTP verbs, so I'm developing a new gateway that covers all the needs.
However, enctype =" multipart / form-data "
is supported by dbax:
osalvador$ curl -H "Content-Type: multipart/form-data" -F "userid=1234" -X POST http://ohs:7777/pls/dbax/\!hello?p=/admin
Hello World form POST
I tried your curl command and request was correctly interpreted as POST. However when I submit the actual form via webpage it's not working properly (fall back to root POST handler)
FYI the form element was declared as such:
<form class="form-signin" method="POST" action="/foo/!bar.app?p=/admin" enctype="multipart/form-data">
From the manual it seems the -F
flag alone would be sufficient:
-F/--form <name=content> Specify HTTP multipart POST data (H)
Could you try the below curl on your server for testing?
user$ url -F foo=bar http://ohs:7777/pls/dbax/\!hello?p=/admin
Hi @newbro
I tried the curl and this is the result:
osalvador$ curl -F foo=bar http://dbax.io:7777/dbax/db/\!hello?p=/admin
Hello World form POST
Any suggestions?
I have dbax installed within an environment running mod_plsql. For testing i have the below 2 paths handling both get, post verb:
The routing with ?p=/ mechanism is working probably with 'get' http verb, however when I try to submit a post form to /!mypackage.app?p=/admin, admin_inputs_controller was not executed as expected, instead user_inputs_controller was called. Any idea?