Return true if the specified URL should be encoded with a session identifier. This will be true if all of the following conditions are met: The request we are responding to asked for a valid session The requested session ID was not received via a cookie The specified UR
(final String location)
| 1364 | * @return <code>true</code> if the URL should be encoded |
| 1365 | */ |
| 1366 | protected boolean isEncodeable(final String location) { |
| 1367 | |
| 1368 | if (location == null) { |
| 1369 | return false; |
| 1370 | } |
| 1371 | |
| 1372 | // Is this an intra-document reference? |
| 1373 | if (location.startsWith("#")) { |
| 1374 | return false; |
| 1375 | } |
| 1376 | |
| 1377 | // Are we in a valid session that is not using cookies? |
| 1378 | final Request hreq = request; |
| 1379 | final Session session = hreq.getSessionInternal(false); |
| 1380 | if (session == null) { |
| 1381 | return false; |
| 1382 | } |
| 1383 | if (hreq.isRequestedSessionIdFromCookie()) { |
| 1384 | return false; |
| 1385 | } |
| 1386 | |
| 1387 | // Is URL encoding permitted |
| 1388 | if (!hreq.getServletContext().getEffectiveSessionTrackingModes().contains(SessionTrackingMode.URL)) { |
| 1389 | return false; |
| 1390 | } |
| 1391 | |
| 1392 | return doIsEncodeable(getContext(), hreq, session, location); |
| 1393 | } |
| 1394 | |
| 1395 | |
| 1396 | private static boolean doIsEncodeable(Context context, Request hreq, Session session, String location) { |
no test coverage detected