Package org.apache.ofbiz.webapp
Class OfbizUrlBuilder
java.lang.Object
org.apache.ofbiz.webapp.OfbizUrlBuilder
OFBiz URL builder.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
buildFullUrl
(Appendable buffer, String url, boolean useSSL) Builds a full URL - including scheme, host, servlet path and resource.boolean
buildHostPart
(Appendable buffer, String url, boolean useSSL) Builds a partial URL - including the scheme and host, but not the servlet path or resource.void
buildPathPart
(Appendable buffer, String url) Builds a partial URL - including the servlet path and resource, but not the scheme or host.static OfbizUrlBuilder
from
(HttpServletRequest request) Returns anOfbizUrlBuilder
instance.static OfbizUrlBuilder
from
(ComponentConfig.WebappInfo webAppInfo, Delegator delegator) Returns anOfbizUrlBuilder
instance.
-
Method Details
-
from
public static OfbizUrlBuilder from(HttpServletRequest request) throws GenericEntityException, WebAppConfigurationException Returns anOfbizUrlBuilder
instance.- Parameters:
request
-- Throws:
GenericEntityException
WebAppConfigurationException
-
from
public static OfbizUrlBuilder from(ComponentConfig.WebappInfo webAppInfo, Delegator delegator) throws WebAppConfigurationException, IOException, SAXException, GenericEntityException Returns anOfbizUrlBuilder
instance. Use this method when you don't have aHttpServletRequest
object - like in scheduled jobs.- Parameters:
webAppInfo
- Optional - ifnull
, the builder can only build the host part, and that will be based only on the settings inurl.properties
(the WebSite entity will be ignored).delegator
-- Throws:
WebAppConfigurationException
IOException
SAXException
GenericEntityException
-
buildFullUrl
public boolean buildFullUrl(Appendable buffer, String url, boolean useSSL) throws WebAppConfigurationException, IOException Builds a full URL - including scheme, host, servlet path and resource.- Parameters:
buffer
-url
-useSSL
- Default value to use - will be replaced by request-map setting if one is found.- Returns:
true
if the URL uses https- Throws:
WebAppConfigurationException
IOException
-
buildHostPart
public boolean buildHostPart(Appendable buffer, String url, boolean useSSL) throws WebAppConfigurationException, IOException Builds a partial URL - including the scheme and host, but not the servlet path or resource.- Parameters:
buffer
-url
-useSSL
- Default value to use - will be replaced by request-map setting if one is found with security=true set.- Returns:
true
if the URL uses https- Throws:
WebAppConfigurationException
IOException
-
buildPathPart
public void buildPathPart(Appendable buffer, String url) throws WebAppConfigurationException, IOException Builds a partial URL - including the servlet path and resource, but not the scheme or host.- Parameters:
buffer
-url
-- Throws:
WebAppConfigurationException
IOException
-