How to determine the hostname in Oracle APEX?

让人想犯罪 __ 提交于 2019-12-07 06:24:27

The necessary method is in the APEX_UTIL-package and called HOST_URL. With the parameter, you can extend the output:

Given your hostname is example.com and your port is 5883.

function call                    |  result
---------------------------------|-----------------------------------
APEX_UTIL.HOST_URL()             |  http://example.com:5883
APEX_UTIL.HOST_URL('SCRIPT')     |  http://example.com:5883/pls/apex/
APEX_UTIL.HOST_URL('IMGPRE')     |  http://example.com:5883/i/

The result with the value IMGPRE depends on your configuration at Application Properties > User Interface > General Properties > Image prefix.

I would try to avoid generating absolute URLs like http://domain/apex/f?p=123 to the same application or other applications on the same system. Use relative URLs instead to avoid changing domain names. For example just use

f?p=&APP_ID.:5:&SESSION.

if you want to reference a specific page within your application. But where possible you should use declarative links which automatically generate what's necessary. If you want to reference another app use

f?p=123
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!