How to determine the hostname in Oracle APEX?

China☆狼群 提交于 2019-12-08 05:34:35

问题


I want to create some links in Oracle APEX to the application itself. But it changes in my development envireonment and the production environment. I need a way to determine my current hostname and port. Which function can help me?


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/30118926/how-to-determine-the-hostname-in-oracle-apex

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