Class ExternalLink

All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IMetadataContext<Serializable,Component>, IHeaderContributor, IRequestableComponent, IHierarchical<Component>, IClusterable

public class ExternalLink extends AbstractLink

A simple anchor link (<a href="http://url">) pointing to any URL. Usually this is used for links to destinations outside of Wicket.

Note: in the case when the support for cookies in the browser is disabled the user's jsessionid will leak in the 'Referrer' header after clicking this link. If this is a problem for the application then better use a Link which redirects to a shared resource (see WebApplication.mountResource(String, org.apache.wicket.request.resource.ResourceReference) , e.g. "/myapp/redirecting-resource?url=...") which on its side redirects to the new URL using RedirectToUrlException. Another option is to use rel="noreferrer" attribute in your markup but this will work only in the modern browsers (supporting HTML5 standard).

Author:
Juergen Donnerstag
See Also:
  • Constructor Details

    • ExternalLink

      public ExternalLink(String id, String href, String label)
      Constructor.
      Parameters:
      id - See Component
      href - the href attribute to set
      label - the label (body)
    • ExternalLink

      public ExternalLink(String id, String href)
      Constructor.
      Parameters:
      id - The name of this component
      href - the href attribute to set
    • ExternalLink

      public ExternalLink(String id, IModel<String> href)
      Constructor.
      Parameters:
      id - The name of this component
      href - the href attribute to set
    • ExternalLink

      public ExternalLink(String id, IModel<String> href, IModel<?> label)
      Constructor.
      Parameters:
      id - See Component
      href - the href attribute to set
      label - the label (body)
  • Method Details

    • getPopupSettings

      Gets the popup specification. If not-null, a javascript on-click event handler will be generated that opens a new window using the popup properties.
      Returns:
      the popup specification.
    • setPopupSettings

      public final ExternalLink setPopupSettings(PopupSettings popupSettings)
      Sets the popup specification. If not-null, a javascript on-click event handler will be generated that opens a new window using the popup properties.
      Parameters:
      popupSettings - the popup specification.
      Returns:
      This
    • onComponentTag

      protected void onComponentTag(ComponentTag tag)
      Processes the component tag.
      Overrides:
      onComponentTag in class Component
      Parameters:
      tag - Tag to modify
      See Also:
    • renderHead

      public void renderHead(IHeaderResponse response)
      Description copied from class: Component
      Render to the web response whatever the component wants to contribute to the head section.
      Specified by:
      renderHead in interface IHeaderContributor
      Overrides:
      renderHead in class Component
      Parameters:
      response - Response object
    • isContextRelative

      public boolean isContextRelative()
      Returns:
      True if this link is automatically prepended with ../ to make it relative to the context root.
    • setContextRelative

      public ExternalLink setContextRelative(boolean contextRelative)
      Set to true if this link should be automatically prepended with ../ to make it relative to the context root.
      Parameters:
      contextRelative -
      Returns:
      This for chaining