Package de.uplanet.lucy.server.composer
Class UrlBuilder
- java.lang.Object
-
- de.uplanet.lucy.server.composer.UrlBuilder
-
@Scriptable public final class UrlBuilder extends Object
-
-
Method Summary
-
-
-
Method Detail
-
createBaseUrl
public static URL createBaseUrl(IServerBridgeRequest p_request)
Create a base URL, i.e. a relative URL containing solely the root path/
.- Parameters:
p_request
- The request.- Returns:
- The
/
base URL.
-
createBaseUrl
public static URL createBaseUrl(IRequestProcessingContext p_ctx)
Create a base URL, i.e. a relative URL containing solely the root path/
.- Parameters:
p_ctx
- The processing context.- Returns:
- The
/
base URL. - See Also:
createBaseUrl(IServerBridgeRequest)
-
createAbsoluteBaseUrl
public static URL createAbsoluteBaseUrl(IRequestProcessingContext p_ctx) throws MalformedURLException
- Parameters:
p_ctx
- The processing context.- Throws:
MalformedURLException
- See Also:
createAbsoluteBaseUrl(IServerBridgeRequest)
-
createAbsoluteBaseUrl
public static URL createAbsoluteBaseUrl(IServerBridgeRequest p_request) throws MalformedURLException
Create an absolute base URL from the given request.The returned absolute URL will always contain a terminating slash
/
.This method tries to create an absolute base URL as follows
- First, if the
doc("internal/cfg/portal.cfg")/portal/uris/uri[@name='web.url.base.default']
configuration parameter exists, return it. This is the preferred way. The following is a fallback in case the portal's default URL is not configured. - Second, try to create an absolute URL from
SERVERVAR.SCHEME
,SERVERVAR.SERVER_NAME
,SERVERVAR.SERVER_PORT
, and return it.
- Parameters:
p_request
- The request.- Returns:
- The base URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
- First, if the
-
createWebSocketBaseUrl
public static URL createWebSocketBaseUrl(IRequestProcessingContext p_ctx) throws MalformedURLException
- Parameters:
p_ctx
- The processing context.- Throws:
MalformedURLException
- See Also:
createWebSocketBaseUrl(IServerBridgeRequest)
-
createWebSocketBaseUrl
public static URL createWebSocketBaseUrl(IServerBridgeRequest p_request) throws MalformedURLException
Create a WebSocket URL from the given request.This method uses the same algorithm as
createAbsoluteBaseUrl(IServerBridgeRequest)
except that the scheme isws
orwss
instead ofhttp
orhttps
.- Parameters:
p_request
- The request.- Returns:
- The WebSocket URL.
- Throws:
MalformedURLException
- If a parsing error occurred.- See Also:
createAbsoluteBaseUrl(IServerBridgeRequest)
-
createAbsoluteRequestBaseDirectoryUrl
public static URL createAbsoluteRequestBaseDirectoryUrl(IRequestProcessingContext p_ctx) throws MalformedURLException
Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, (optional) port number, and server path without the document part.The document part is the rightmost path component that is not followed by a slash.
- Parameters:
p_ctx
- The processing context.- Returns:
- The request base directory URL.
- Throws:
MalformedURLException
- If a parsing error occurred.- See Also:
createRequestBaseDirectoryUrl(IServerBridgeRequest)
-
createAbsoluteRequestBaseDirectoryUrl
public static URL createAbsoluteRequestBaseDirectoryUrl(IServerBridgeRequest p_request) throws MalformedURLException
Reconstructs the URL the client used to make the request. The returned URL contains a protocol, server name, (optional) port number, and server path without the document part.The document part is the rightmost path component that is not followed by a slash.
- Parameters:
p_request
- The request.- Returns:
- The request base directory URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
parseUrl
public static URL parseUrl(String p_strUrl) throws MalformedURLException
Create an URL from the given string.- Parameters:
p_strUrl
- The string to be parsed.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
createDefaultUrl
@Deprecated public static URL createDefaultUrl(IServerBridgeRequest p_request)
Deprecated.UsecreateBaseUrl(IServerBridgeRequest)
instead.The same ascreateBaseUrl(IServerBridgeRequest)
.- Parameters:
p_request
- The request.- Returns:
- The URL.
-
createDefaultUrl
@Deprecated public static URL createDefaultUrl(IRequestProcessingContext p_ctx)
Deprecated.UsecreateBaseUrl(IRequestProcessingContext)
instead.The same ascreateBaseUrl(IRequestProcessingContext)
.- Parameters:
p_ctx
- The processing context.- Returns:
- The URL.
-
createAbsoluteBaseDirectoryUrl
@Deprecated public static URL createAbsoluteBaseDirectoryUrl(IServerBridgeRequest p_request) throws MalformedURLException
Deprecated.UsecreateAbsoluteBaseUrl(IServerBridgeRequest)
instead.The same URL ascreateAbsoluteBaseUrl(IServerBridgeRequest)
.- Parameters:
p_request
- The request.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
createAbsoluteBaseDirectoryUrl
@Deprecated public static URL createAbsoluteBaseDirectoryUrl(IRequestProcessingContext p_ctx) throws MalformedURLException
Deprecated.UsecreateAbsoluteBaseUrl(IRequestProcessingContext)
instead.The same URL ascreateAbsoluteBaseUrl(IRequestProcessingContext)
.- Parameters:
p_ctx
- The processing context.- Returns:
- The URL.
- Throws:
MalformedURLException
- If a parsing error occurred.
-
createRequestBaseDirectoryUrl
@Deprecated public static URL createRequestBaseDirectoryUrl(IServerBridgeRequest p_request) throws MalformedURLException
Deprecated.- Parameters:
p_request
- The request.- Returns:
- The URL.
- Throws:
MalformedURLException
-
createRequestBaseDirectoryUrl
@Deprecated public static URL createRequestBaseDirectoryUrl(IRequestProcessingContext p_ctx) throws MalformedURLException
Deprecated.- Parameters:
p_ctx
- The processing context.- Returns:
- The URL.
- Throws:
MalformedURLException
-
-