Class WebLink

All Implemented Interfaces:
Serializable

public class WebLink extends SimpleValueObject<String>
Value object which provides methods to handle a web link (aka URI or URL).

You should use get() or SimpleValueObject.toString() to get the link as String. Normally a root relative URL (without protocol, hostname) will be returned. Except if the host part is needed because it points to another host than the current engine host.

Example:

import ch.ivyteam.ivy.model.value.WebLink;

WebLink relative = WebLink.of("/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi", () -> URI.create(http://localhost));
relative.get(); -> /Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
relative.toString(); -> /Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
relative.getRelative(); -> /Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
relative.getAbsolute(); -> http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
WebLink absolute = WebLink.of("http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi");
absolute.get(); -> http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
absolute.toString(); -> http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
absolute.getRelative(); -> /Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
absolute.getAbsolute(); -> http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi

Since:
6.6.2
See Also:
API:
This is a public API.
  • Method Details

    • get

      public String get()
      Returns normally a root relative uri, except if the host part is needed because it points to another host than the current engine host.

      Example:

      import ch.ivyteam.ivy.model.value.WebLink;

      WebLink relative = WebLink.of("/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi", () -> URI.create(http://localhost));
      relative.get(); -> /Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi
      WebLink absolute = WebLink.of("http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi");
      absolute.get(); -> http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi

      Returns:
      the root relative uri without protocol, hostname etc.
      API:
      This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • getRelative

      public String getRelative()
      Example:

      import ch.ivyteam.ivy.model.value.WebLink;

      WebLink link = WebLink.of("http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi");
      link.getRelative(); -> /Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi

      Returns:
      the root relative uri without protocol, hostname etc.
      API:
      This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • getRelativeEncoded

      public String getRelativeEncoded()
      Example:

      import ch.ivyteam.ivy.model.value.WebLink;

      WebLink link = WebLink.of("http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi");
      link.getRelativeEncoded(); -> /Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=gr%C3%BCezi

      Returns:
      the ASCII encoded relative uri without protocol, hostname etc.
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • getAbsolute

      public String getAbsolute()
      Example:

      import ch.ivyteam.ivy.model.value.WebLink;

      WebLink link = WebLink.of("http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi");
      link.getAbsolute(); -> http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi

      Note: Normally you should prefer get() if not explicitly an absolute uri is needed

      Returns:
      the absolute uri including protocol, host name etc.
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • getAbsoluteEncoded

      public String getAbsoluteEncoded()
      Example:

      import ch.ivyteam.ivy.model.value.WebLink;

      WebLink link = WebLink.of("http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=grüezi");
      link.getAbsoluteEncoded(); -> http://localhost/Portal/pro/SelfServiceBpm/14232C3D829C4D71/start.ivp?search=gr%C3%BCezi

      Returns:
      the ASCII encoded absolute uri including protocol, host name etc.
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • toUri

      public URI toUri()
      Returns the URI. Normally a root relative URI, except if the host part is needed because it points to another host than the current engine host.
      Returns:
      the URI
      API:
      This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • toRelativeUri

      public URI toRelativeUri()
      Returns the root relative URI.
      Returns:
      the root relative URI
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • toAbsoluteUri

      public URI toAbsoluteUri()
      Returns the absolute uri.

      Note: Normally you should prefer the toUri() if not explicitly an absolute URI is needed

      Returns:
      the absolute uri
      See Also:
      API:
      This public API is available in IvyScript and Java. It has the visibility EXPERT.
    • queryParam

      public WebLink queryParam(String name, String value)
      Adds a new query parameter to the uri.
      Parameters:
      name - of the query parameter
      value - of the query parameter.
      Returns:
      returns a new WebLink with the added query parameter.
      API:
      This public API is available in IvyScript and Java. It has the visibility NOVICE.
    • queryParams

      public WebLink queryParams(Map<String,String> params)
      Adds the query parameters to the uri.
      Parameters:
      params - name value map of the query parameters to add.
      Returns:
      returns a new WebLink with the added query parameters.
      API:
      This public API is available in IvyScript and Java. It has the visibility NOVICE.