-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to route in USP code? #30
Comments
just create a directory named "one" in your document root directory, and put two.so inside it |
Thanks for the prototype. This mean routing is non-trivial. I have another question. Consider url to be |
if you construct the url like this... http://localhost/one?dbID=100 then either...
Here's a quick example: |
No I do not intend to do that. That conflicts with SEO based URL design. |
Hi,
in the prototype I exposed a more general routing, you can also simple make
a checking:
if (UClientImage_Base::request_uri->equal(U_CONSTANT_TO_PARAM("/one/two")))
...;
else
....
so you can see that the information about the URL is in this variable...
Bests
Stefano
2017-09-14 17:26 GMT+02:00 Shiv Shankar Dayal <notifications@github.com>:
… Thanks for the prototype. This mean routing is non-trivial. I have another
question. Consider url to be http://localhost/one/100 where 100 is some
id in database on which selection is to be done. How can I extract 100 from
the URL? Which class contains this information? I believe UHTTP will have
that but in doxygen information I could not find a method which is obvious.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGkXorO92lzXYwey1TwbdilvqUBvSJVks5siUWwgaJpZM4PWInF>
.
|
I'm not sure you can achieve what you deserve to though. You're asking for conditional url parsing, with no clear differential between cases of pure resource paths vs resource paths with an identifier tagged on. This is the whole reason ?x=y etc exists. If you point the request at "/one/100", that will be interpreted as a resource path.. and ULib will look for a resource at your-document-root/one/100.so What you're asking for would require parsing that violates general URL standards / specifications. |
No it does not. For example, look at URL of a question on stackoverflow. The post id of question is embedded in URL. For example, this is achievable easily in frameworks like Django. |
Hi,
If you point the request at "/one/100", that will be interpreted as a
resource path.. and ULib will look for a resource at
your-document-root/one/100.so
in case of using the more general routing exposed in the prototype it does
not.
ULib will look for a resource at your-document-root/one.so cause of the
config var:
USP_AUTOMATIC_ALIASING /one
Gived the url:
https://stackoverflow
.com/questions/1657484/can-you-give-an-example-of-stack-overflow-in-c
can you describe which methods you wish to extract information, I can add
them to ULib...
Stefano
2017-09-14 17:56 GMT+02:00 Shiv Shankar Dayal <notifications@github.com>:
… No it does not. For example, look at URL of a question on stackoverflow.
The post id of question is embedded in URL. For example, this is achievable
easily in frameworks like Django.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGkXlihl-V5PLetH7QByVdYOQZtaVpVks5siUy1gaJpZM4PWInF>
.
|
Given the URL https://stackoverflow .com/questions/1657484/can-you-give-an-example-of-stack-overflow-in-c I want it to be served by |
Hi,
ok. I imagine in this way.
config var: USP_AUTOMATIC_ALIASING /questions
questions.usp:
<!--#cpath
id;
-->
it is ok for you? Also can you give an example of what you consider a
trivial routing?
Bests
Stefano
2017-09-15 10:44 GMT+02:00, Shiv Shankar Dayal <notifications@github.com>:
… Given the URL https://stackoverflow
.com/questions/1657484/can-you-give-an-example-of-stack-overflow-in-c I want
it to be served by `questions.so` and 1657484 is what needs to be extracted
from URL.
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#30 (comment)
|
Thanks a lot for helping me out Stefano. Now one more problem remains which I raised in another issue which is persistent connection to DB. |
it is show inside one.usp |
So you mean to say that since it is static connection it will live as long as |
Consider I have an usp file say
one.usp
which gives meone.so
so that my URL served ishttp://localhost/one
. Now if I want to servehttp://localhost/one/two
then how can I achieve that?The text was updated successfully, but these errors were encountered: