@DefaultKey(value="urlTool") @ValidScope(value="request") public class UrlTool extends RequestAwareTool
Constructor and Description |
---|
UrlTool()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
String |
blog(String alias)
Renders a permanent link to the named blog
|
String |
blogFromId(String blogId)
Renders a permanent link to the named blog
|
String |
clientImage(ImageSizeType size)
Creates a URL pointing to the logo of the current client.
|
String |
createBuildTimestampParam()
Creates a request parameter holding the build timestamp.
|
String |
currentUser()
Renders a permanent link to the current user
|
String |
getExternalObjectLink(String externalSystemId,
String externalObjectId)
Returns a link to the given external object within the external system.
|
String |
getFaviconUrl() |
String |
image(String entityId,
CoreImageType imageType,
ImageSizeType size)
Creates a URL pointing to an imag for the given entity.
|
String |
imageForBanner(String entityId) |
String |
imageForProfile(String entityId) |
String |
insertSessionId(String url)
This method inserts the session id into the url.
|
String |
note(String blogAlias,
Long noteId)
Renders a permanent link to the note
|
String |
render(String urlPath)
Renders the URL for the specified urlPath.
|
String |
render(String urlPath,
boolean absolute,
boolean secure,
boolean staticResource)
Renders the URL for the specified urlPath.
|
String |
render(String urlPath,
boolean absolute,
String channelTypeAsString,
boolean staticResource)
Renders the URL for the specified urlPath.
|
String |
render(String urlPath,
String baseUrl,
boolean absolute,
boolean secure,
Boolean renderSessionId,
String clientId,
boolean staticResource)
Renders the URL for the specified urlPath.
|
String |
renderAttachmentUrl(Attachment attachment)
Determine the relative attachment URL path for a resource
|
String |
renderAttachmentUrl(Attachment attachment,
boolean useAbsoluteUrl,
boolean staticResource)
Determine the resource URL for download/access for the given item
|
String |
renderAttachmentUrl(AttachmentData attachment)
Determine the relative attachment URL path for a resource
|
String |
renderAttachmentUrl(AttachmentData attachment,
boolean useAbsoluteUrl,
boolean staticResource)
Determine the resource URL for download/access for the given item
|
String |
renderConcatenatedCssUrl(String categoryName,
boolean minimized)
Render the URL to the concatenated CSS of a given category.
|
String |
renderConcatenatedJsUrl(String categoryName,
boolean minimized)
Render the URL to the concatenated JavaScript of a given category.
|
List<String> |
renderCssUrls(String categoryName,
boolean minimized)
Render the URLs to the CSS resources of the given category.
|
String |
renderIfRelative(String urlPath)
Uses
render(String) to render the URL if it is relative, otherwise the URL is
returned unchanged. |
List<String> |
renderJsUrls(String categoryName,
boolean minimized)
Render the URLs to the JavaScript resources of the given category.
|
String |
renderStartpage()
Renders the startpage url.
|
String |
renderStatic(String urlPath)
Renders the URL of a static resource which is not delivered by the dispatcher servlet.
|
String |
renderStaticBase(boolean absolute,
boolean secure,
String clientId)
Renders the base URL of all static resources.
|
String |
tag(long tagId)
Renders a permanent link to the given tag.
|
String |
tag(String tag)
Deprecated.
Use
tag(long) instead. |
String |
topicDefaultProfileImage()
Set the image url to the default topic image.
|
String |
user(String alias)
Renders a permanent link to the named user
|
String |
userImage(Long userId,
ImageSizeType size)
Creates a URL pointing to a user image.
|
String |
userImage(UserData user,
ImageSizeType size)
Creates a URL pointing to a user image.
|
getRequest, getResponse, getServletContext, setRequest, setResponse, setServletContext
public String blog(String alias)
alias
- the alias of the blogpublic String blogFromId(String blogId)
blogId
- The blogs id as String.public String clientImage(ImageSizeType size)
size
- the size of the logopublic String createBuildTimestampParam()
public String currentUser()
public String getExternalObjectLink(String externalSystemId, String externalObjectId)
externalSystemId
- The external system id.externalObjectId
- The external object id.public String getFaviconUrl()
public String image(String entityId, CoreImageType imageType, ImageSizeType size)
entityId
- Id of the entity to get the link for.imageType
- Type of the image.size
- Size of the requested image.public String imageForBanner(String entityId)
entityId
- Id of the entity to get the link for.public String imageForProfile(String entityId)
entityId
- Id of the entity to get the link for.public String insertSessionId(String url)
url
- The url.public String note(String blogAlias, Long noteId)
blogAlias
- the alias of the blognoteId
- the id of the notepublic String render(String urlPath)
#render(String, boolean, boolean)
with parameters absolute and secure set to false.urlPath
- the URL pathpublic String render(String urlPath, boolean absolute, boolean secure, boolean staticResource)
#render(String, String, boolean, boolean, Boolean, String)
with parameters baseUrl,
renderSessionId and clientId set to null.urlPath
- the URL pathabsolute
- whether the URL should be rendered as an absolute URLsecure
- whether the URL should be rendered with the HTTPS protocol. Will be ignored if
absolute is false.staticResource
- true
if the URL should be rendered as a resource not to be delivered by
the dispatcher servletpublic String render(String urlPath, boolean absolute, String channelTypeAsString, boolean staticResource) throws IllegalArgumentException
#render(String, String, boolean, boolean, Boolean, String)
with parameters baseUrl,
renderSessionId and clientId set to null.urlPath
- the URL pathabsolute
- whether the URL should be rendered as an absolute URLchannelTypeAsString
- The channel type as string to check against.staticResource
- true
if the URL should be rendered as a resource not to be delivered by
the dispatcher servletIllegalArgumentException
- Thrown, when there is no such channel type.public String render(String urlPath, String baseUrl, boolean absolute, boolean secure, Boolean renderSessionId, String clientId, boolean staticResource)
urlPath
- the URL pathbaseUrl
- optional string with a URL that should be prefixed to the urlPath. If set, the
parameters absolute, secure and clientId will be ignored.absolute
- whether the URL should be rendered as an absolute URL. Will be ignored if baseUrl
is not null.secure
- whether the URL should be rendered with the HTTPS protocol. Will be ignored if
absolute is false or baseUrl is not null.renderSessionId
- optional parameter to force inclusion of the current session ID. If null the
session ID will be included if the request asked for an existing session and the
session ID was not received via a cookie. If not null and true the ID of the
current session will be included. In case there is no session the session will be
created. If baseUrl is not null the session ID won't be included.clientId
- the ID of the client to be included in the URL. If null the ID of the current
client will be used. Will be ignored if baseUrl is not null
.staticResource
- true
if the URL should be rendered as a resource which will not be handled
by the dispatcher servletpublic String renderAttachmentUrl(Attachment attachment)
attachment
- The attachment.public String renderAttachmentUrl(Attachment attachment, boolean useAbsoluteUrl, boolean staticResource)
attachment
- the attachment.useAbsoluteUrl
- true
to render absolute URLstaticResource
- true if the URL should be rendered as a resource which will not be handled by the
dispatcher servletpublic String renderAttachmentUrl(AttachmentData attachment)
attachment
- the attachment list item.public String renderAttachmentUrl(AttachmentData attachment, boolean useAbsoluteUrl, boolean staticResource)
attachment
- the attachment list item.useAbsoluteUrl
- true
to render absolute URLstaticResource
- true if the URL should be rendered as a resource which will not be handled by the
dispatcher servletpublic String renderConcatenatedCssUrl(String categoryName, boolean minimized)
categoryName
- the name of the categoryminimized
- whether to return the minimized version of the concatenated CSSpublic String renderConcatenatedJsUrl(String categoryName, boolean minimized)
categoryName
- the name of the categoryminimized
- whether to return the minimized version of the concatenated JavaScriptpublic List<String> renderCssUrls(String categoryName, boolean minimized)
categoryName
- the name of the categoryminimized
- whether to render the URLs to the minimized versionspublic String renderIfRelative(String urlPath)
render(String)
to render the URL if it is relative, otherwise the URL is
returned unchanged.
Example:
urlPath
- the url to renderpublic List<String> renderJsUrls(String categoryName, boolean minimized)
categoryName
- the name of the categoryminimized
- whether to render the URLs to the minimized versionspublic String renderStartpage()
public String renderStatic(String urlPath)
urlPath
- The URL path.public String renderStaticBase(boolean absolute, boolean secure, String clientId)
absolute
- whether the URL should be rendered as an absolute URL.secure
- whether the URL should be rendered with the HTTPS protocolclientId
- the ID of the client to be included in the URL. If null the ID of the current
client will be used.public String tag(long tagId)
tagId
- The tag.@Deprecated public String tag(String tag)
tag(long)
instead.tag
- The tag.public String topicDefaultProfileImage()
public String user(String alias)
alias
- the alias of the userpublic String userImage(Long userId, ImageSizeType size)
userId
- the ID of the user whose image should be renderedsize
- the size of the imagepublic String userImage(UserData user, ImageSizeType size)
user
- the user whose image should be renderedsize
- the size of the imageCopyright © 2019 Communote team. All rights reserved.