code: @Override
      public int doEndTag() throws JspException {
  
          ServletRequest req = pageContext.getRequest();
  
          // This will always be true if the page is called through OpenCms
          if (CmsFlexController.isCmsRequest(req)) {
              try {
                  // Get link-string from the body and reset body
                  String link = getBodyContent().getString();
                  getBodyContent().clear();
                  // Calculate the link substitution
                  String newlink = linkTagAction(link, req, getBaseUri(), getDetailPage(), m_locale);
                  // Write the result back to the page
                  getBodyContent().print(newlink);
                  getBodyContent().writeOut(pageContext.getOut());
  
              } catch (Exception ex) {
                  if (LOG.isErrorEnabled()) {
                      LOG.error(Messages.get().getBundle().key(Messages.ERR_PROCESS_TAG_1, "link"), ex);
                  }
                  throw new JspException(ex);
              }
          }
          return EVAL_PAGE;
      }
docs: @see javax.servlet.jsp.tagext.Tag#doEndTag()
  
  @return EVAL_PAGE
  
  @throws JspException in case something goes wrong