Mercurial Hosting > luan
diff src/org/eclipse/jetty/server/Response.java @ 809:09d518d313b7
remove SessionManager
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 08 Sep 2016 16:38:30 -0600 |
parents | 3428c60d7cfc |
children | f8f7cb485c25 |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/Response.java Thu Sep 08 16:13:27 2016 -0600 +++ b/src/org/eclipse/jetty/server/Response.java Thu Sep 08 16:38:30 2016 -0600 @@ -187,96 +187,7 @@ */ public String encodeURL(String url) { - final Request request=_connection.getRequest(); - SessionManager sessionManager = request.getSessionManager(); - if (sessionManager==null) - return url; - - HttpURI uri = null; - if (sessionManager.isCheckingRemoteSessionIdEncoding() && URIUtil.hasScheme(url)) - { - uri = new HttpURI(url); - String path = uri.getPath(); - path = (path == null?"":path); - int port=uri.getPort(); - if (port<0) - port = HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme())?443:80; - if (!request.getServerName().equalsIgnoreCase(uri.getHost()) || - request.getServerPort()!=port || - !path.startsWith(request.getContextPath())) //TODO the root context path is "", with which every non null string starts - return url; - } - - String sessionURLPrefix = sessionManager.getSessionIdPathParameterNamePrefix(); - if (sessionURLPrefix==null) - return url; - - if (url==null) - return null; - - // should not encode if cookies in evidence - if ((sessionManager.isUsingCookies() && request.isRequestedSessionIdFromCookie()) || !sessionManager.isUsingURLs()) - { - int prefix=url.indexOf(sessionURLPrefix); - if (prefix!=-1) - { - int suffix=url.indexOf("?",prefix); - if (suffix<0) - suffix=url.indexOf("#",prefix); - - if (suffix<=prefix) - return url.substring(0,prefix); - return url.substring(0,prefix)+url.substring(suffix); - } - return url; - } - - // get session; - HttpSession session=request.getSession(false); - - // no session - if (session == null) - return url; - - // invalid session - if (!sessionManager.isValid(session)) - return url; - - String id=sessionManager.getNodeId(session); - - if (uri == null) - uri = new HttpURI(url); - - - // Already encoded - int prefix=url.indexOf(sessionURLPrefix); - if (prefix!=-1) - { - int suffix=url.indexOf("?",prefix); - if (suffix<0) - suffix=url.indexOf("#",prefix); - - if (suffix<=prefix) - return url.substring(0,prefix+sessionURLPrefix.length())+id; - return url.substring(0,prefix+sessionURLPrefix.length())+id+ - url.substring(suffix); - } - - // edit the session - int suffix=url.indexOf('?'); - if (suffix<0) - suffix=url.indexOf('#'); - if (suffix<0) - { - return url+ - ((HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme()) || HttpSchemes.HTTP.equalsIgnoreCase(uri.getScheme())) && uri.getPath()==null?"/":"") + //if no path, insert the root path - sessionURLPrefix+id; - } - - - return url.substring(0,suffix)+ - ((HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme()) || HttpSchemes.HTTP.equalsIgnoreCase(uri.getScheme())) && uri.getPath()==null?"/":"")+ //if no path so insert the root path - sessionURLPrefix+id+url.substring(suffix); + throw new UnsupportedOperationException(); } /* ------------------------------------------------------------ */