Current URL

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Current URL

Hugo <Nabble>
This prints "nil". Why?
import "web/Http"

Current URL = <%= Http.current_url %>
Reply | Threaded
Open this post in threaded view
|

Re: Current URL

fschmidt
Administrator
Because the page is run once to generate the "module" for that page which includes the service() method which is then called for each request.  This means there is no request when the module is being generated, so no current_url.  There should be a current_url inside the service() method.
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: Current URL

Hugo <Nabble>
The code below still prints "nil", why?
function service()
	Io.stdout = Http.response.text_writer()
%>
<html>
	<body>
		Current URL = <%= Http.current_url %>
	</body>
</html>
<%
end
Reply | Threaded
Open this post in threaded view
|

Re: Current URL

fschmidt
Administrator
Http.request.current_url
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: Current URL

Hugo <Nabble>
This works fine, thanks. Closing thread.
Reply | Threaded
Open this post in threaded view
|

Re: Current URL

fschmidt
Administrator
In reply to this post by fschmidt
I renamed this to Http.request.url and added Http.request.path in rev 314.
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: Current URL

Hugo <Nabble>
Okay, sounds good.
Reply | Threaded
Open this post in threaded view
|

Re: Current URL

fschmidt
Administrator
closing
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture