MCPcopy Index your code
hub / github.com/apache/tomcat / isEncodeable

Method isEncodeable

java/org/apache/catalina/connector/Response.java:1366–1393  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {

Callers 2

encodeRedirectURLMethod · 0.95
encodeURLMethod · 0.95

Calls 8

getSessionInternalMethod · 0.95
getServletContextMethod · 0.95
doIsEncodeableMethod · 0.95
getContextMethod · 0.95
containsMethod · 0.65
startsWithMethod · 0.45

Tested by

no test coverage detected