comparison src/org/eclipse/jetty/server/Request.java @ 811:1bedcd0ec275

remove more session code
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 08 Sep 2016 18:37:55 -0600
parents 09d518d313b7
children f8f7cb485c25
comparison
equal deleted inserted replaced
810:022ff91bde60 811:1bedcd0ec275
105 * <ul> 105 * <ul>
106 * 106 *
107 * <li>The {@link Request#getContextPath()} method will return null, until the request has been passed to a {@link ContextHandler} which matches the 107 * <li>The {@link Request#getContextPath()} method will return null, until the request has been passed to a {@link ContextHandler} which matches the
108 * {@link Request#getPathInfo()} with a context path and calls {@link Request#setContextPath(String)} as a result.</li> 108 * {@link Request#getPathInfo()} with a context path and calls {@link Request#setContextPath(String)} as a result.</li>
109 * 109 *
110 * <li>the HTTP session methods will all return null sessions until such time as a request has been passed to a
111 * {@link org.eclipse.jetty.server.session.SessionHandler} which checks for session cookies and enables the ability to create new sessions.</li>
112 *
113 * <li>The {@link Request#getServletPath()} method will return null until the request has been passed to a <code>org.eclipse.jetty.servlet.ServletHandler</code> 110 * <li>The {@link Request#getServletPath()} method will return null until the request has been passed to a <code>org.eclipse.jetty.servlet.ServletHandler</code>
114 * and the pathInfo matched against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.</li> 111 * and the pathInfo matched against the servlet URL patterns and {@link Request#setServletPath(String)} called as a result.</li>
115 * </ul> 112 * </ul>
116 * 113 *
117 * A request instance is created for each {@link AbstractHttpConnection} accepted by the server and recycled for each HTTP request received via that connection. 114 * A request instance is created for each {@link AbstractHttpConnection} accepted by the server and recycled for each HTTP request received via that connection.
208 private BufferedReader _reader; 205 private BufferedReader _reader;
209 private String _readerEncoding; 206 private String _readerEncoding;
210 private String _remoteAddr; 207 private String _remoteAddr;
211 private String _remoteHost; 208 private String _remoteHost;
212 private Object _requestAttributeListeners; 209 private Object _requestAttributeListeners;
213 private String _requestedSessionId;
214 private boolean _requestedSessionIdFromCookie = false;
215 private String _requestURI; 210 private String _requestURI;
216 private Map<Object, HttpSession> _savedNewSessions;
217 private String _scheme = URIUtil.HTTP; 211 private String _scheme = URIUtil.HTTP;
218 private UserIdentity.Scope _scope; 212 private UserIdentity.Scope _scope;
219 private String _serverName; 213 private String _serverName;
220 private String _servletPath; 214 private String _servletPath;
221 private HttpSession _session;
222 private long _timeStamp; 215 private long _timeStamp;
223 private long _dispatchTime; 216 private long _dispatchTime;
224 217
225 private Buffer _timeStampBuffer; 218 private Buffer _timeStampBuffer;
226 private HttpURI _uri; 219 private HttpURI _uri;
1008 /* 1001 /*
1009 * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId() 1002 * @see javax.servlet.http.HttpServletRequest#getRequestedSessionId()
1010 */ 1003 */
1011 public String getRequestedSessionId() 1004 public String getRequestedSessionId()
1012 { 1005 {
1013 return _requestedSessionId; 1006 throw new UnsupportedOperationException();
1014 } 1007 }
1015 1008
1016 /* ------------------------------------------------------------ */ 1009 /* ------------------------------------------------------------ */
1017 /* 1010 /*
1018 * @see javax.servlet.http.HttpServletRequest#getRequestURI() 1011 * @see javax.servlet.http.HttpServletRequest#getRequestURI()
1369 /* 1362 /*
1370 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie() 1363 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie()
1371 */ 1364 */
1372 public boolean isRequestedSessionIdFromCookie() 1365 public boolean isRequestedSessionIdFromCookie()
1373 { 1366 {
1374 return _requestedSessionId != null && _requestedSessionIdFromCookie; 1367 throw new UnsupportedOperationException();
1375 } 1368 }
1376 1369
1377 /* ------------------------------------------------------------ */ 1370 /* ------------------------------------------------------------ */
1378 /* 1371 /*
1379 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromUrl() 1372 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromUrl()
1380 */ 1373 */
1381 public boolean isRequestedSessionIdFromUrl() 1374 public boolean isRequestedSessionIdFromUrl()
1382 { 1375 {
1383 return _requestedSessionId != null && !_requestedSessionIdFromCookie; 1376 throw new UnsupportedOperationException();
1384 } 1377 }
1385 1378
1386 /* ------------------------------------------------------------ */ 1379 /* ------------------------------------------------------------ */
1387 /* 1380 /*
1388 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL() 1381 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL()
1389 */ 1382 */
1390 public boolean isRequestedSessionIdFromURL() 1383 public boolean isRequestedSessionIdFromURL()
1391 { 1384 {
1392 return _requestedSessionId != null && !_requestedSessionIdFromCookie; 1385 throw new UnsupportedOperationException();
1393 } 1386 }
1394 1387
1395 /* ------------------------------------------------------------ */ 1388 /* ------------------------------------------------------------ */
1396 /* 1389 /*
1397 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid() 1390 * @see javax.servlet.http.HttpServletRequest#isRequestedSessionIdValid()
1425 } 1418 }
1426 1419
1427 /* ------------------------------------------------------------ */ 1420 /* ------------------------------------------------------------ */
1428 public HttpSession recoverNewSession(Object key) 1421 public HttpSession recoverNewSession(Object key)
1429 { 1422 {
1430 if (_savedNewSessions == null) 1423 throw new UnsupportedOperationException();
1431 return null;
1432 return _savedNewSessions.get(key);
1433 } 1424 }
1434 1425
1435 /* ------------------------------------------------------------ */ 1426 /* ------------------------------------------------------------ */
1436 protected void recycle() 1427 protected void recycle()
1437 { 1428 {
1469 _pathInfo = null; 1460 _pathInfo = null;
1470 _port = 0; 1461 _port = 0;
1471 _protocol = HttpVersions.HTTP_1_1; 1462 _protocol = HttpVersions.HTTP_1_1;
1472 _queryEncoding = null; 1463 _queryEncoding = null;
1473 _queryString = null; 1464 _queryString = null;
1474 _requestedSessionId = null;
1475 _requestedSessionIdFromCookie = false;
1476 _session = null;
1477 _requestURI = null; 1465 _requestURI = null;
1478 _scope = null; 1466 _scope = null;
1479 _scheme = URIUtil.HTTP; 1467 _scheme = URIUtil.HTTP;
1480 _servletPath = null; 1468 _servletPath = null;
1481 _timeStamp = 0; 1469 _timeStamp = 0;
1485 _baseParameters.clear(); 1473 _baseParameters.clear();
1486 _parameters = null; 1474 _parameters = null;
1487 _paramsExtracted = false; 1475 _paramsExtracted = false;
1488 _inputState = __NONE; 1476 _inputState = __NONE;
1489 1477
1490 if (_savedNewSessions != null)
1491 _savedNewSessions.clear();
1492 _savedNewSessions=null;
1493 _multiPartInputStream = null; 1478 _multiPartInputStream = null;
1494 } 1479 }
1495 1480
1496 /* ------------------------------------------------------------ */ 1481 /* ------------------------------------------------------------ */
1497 /* 1482 /*
1525 1510
1526 /* ------------------------------------------------------------ */ 1511 /* ------------------------------------------------------------ */
1527 public void removeEventListener(final EventListener listener) 1512 public void removeEventListener(final EventListener listener)
1528 { 1513 {
1529 _requestAttributeListeners = LazyList.remove(_requestAttributeListeners,listener); 1514 _requestAttributeListeners = LazyList.remove(_requestAttributeListeners,listener);
1530 }
1531
1532 /* ------------------------------------------------------------ */
1533 public void saveNewSession(Object key, HttpSession session)
1534 {
1535 if (_savedNewSessions == null)
1536 _savedNewSessions = new HashMap<Object, HttpSession>();
1537 _savedNewSessions.put(key,session);
1538 } 1515 }
1539 1516
1540 /* ------------------------------------------------------------ */ 1517 /* ------------------------------------------------------------ */
1541 public void setAsyncSupported(boolean supported) 1518 public void setAsyncSupported(boolean supported)
1542 { 1519 {
1842 _remoteHost = host; 1819 _remoteHost = host;
1843 } 1820 }
1844 1821
1845 /* ------------------------------------------------------------ */ 1822 /* ------------------------------------------------------------ */
1846 /** 1823 /**
1847 * @param requestedSessionId
1848 * The requestedSessionId to set.
1849 */
1850 public void setRequestedSessionId(String requestedSessionId)
1851 {
1852 _requestedSessionId = requestedSessionId;
1853 }
1854
1855 /* ------------------------------------------------------------ */
1856 /**
1857 * @param requestedSessionIdCookie
1858 * The requestedSessionIdCookie to set.
1859 */
1860 public void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie)
1861 {
1862 _requestedSessionIdFromCookie = requestedSessionIdCookie;
1863 }
1864
1865 /* ------------------------------------------------------------ */
1866 /**
1867 * @param requestURI 1824 * @param requestURI
1868 * The requestURI to set. 1825 * The requestURI to set.
1869 */ 1826 */
1870 public void setRequestURI(String requestURI) 1827 public void setRequestURI(String requestURI)
1871 { 1828 {
1908 * The servletPath to set. 1865 * The servletPath to set.
1909 */ 1866 */
1910 public void setServletPath(String servletPath) 1867 public void setServletPath(String servletPath)
1911 { 1868 {
1912 _servletPath = servletPath; 1869 _servletPath = servletPath;
1913 }
1914
1915 /* ------------------------------------------------------------ */
1916 /**
1917 * @param session
1918 * The session to set.
1919 */
1920 public void setSession(HttpSession session)
1921 {
1922 _session = session;
1923 } 1870 }
1924 1871
1925 /* ------------------------------------------------------------ */ 1872 /* ------------------------------------------------------------ */
1926 public void setTimeStamp(long ts) 1873 public void setTimeStamp(long ts)
1927 { 1874 {