code: private boolean isEncodeable(final String location) {
  
          if (location == null)
              return (false);
  
          // Is this an intra-document reference?
          if (location.startsWith("#"))
              return (false);
  
          // Are we in a valid session that is not using cookies?
          final HttpServletRequestImpl hreq = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getOriginalRequest();
  
          // Is URL encoding permitted
          if (!originalServletContext.getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL)) {
              return false;
          }
  
          final HttpSession session = hreq.getSession(false);
          if (session == null) {
              return false;
          } else if(hreq.isRequestedSessionIdFromCookie()) {
              return false;
          } else if (!hreq.isRequestedSessionIdFromURL() && !session.isNew()) {
              return false;
          }
  
          return doIsEncodeable(hreq, session, location);
      }
docs: Return <code>true</code> if the specified URL should be encoded with
  a session identifier.  This will be true if all of the following
  conditions are met:
  <ul>
  <li>The request we are responding to asked for a valid session
  <li>The requested session ID was not received via a cookie
  <li>The specified URL points back to somewhere within the web
  application that is responding to this request
  </ul>
  
  @param location Absolute URL to be validated