B4J Question How do you pass a value through the address URL?

bbonilla

Member
Licensed User
Longtime User
Hello I'm trying to pass commands to my APP via the URL, like this

http://localhost:8080/command1/value1/value2

I don't see how I can use the server handler to handle any of the value1 and value2

srvr.AddHandler("/command1/value1/value2", "Command1", False)

How can I trap the "command1" and it's values

Thank you for any help
BB
 

billzhan

Active Member
Licensed User
Longtime User
You can try
B4X:
srvr.AddHandler("/command1/*", "Command1", False)

and in the handle,you can get the RequestURI and parse the value1&value2
B4X:
dim reqstring=req.RequestURI ' ->/command1/value1/value2

Be careful when value1 and value2 contains special chars( "/", tab,space etc")

page?val1=value1&val2=value2 is a more common and flexible way.
 
Upvote 0
Top