Added HttpScheme.asString().
This commit is contained in:
parent
817b9ee5fa
commit
2b0cbac192
|
@ -33,7 +33,7 @@ public enum HttpScheme
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
for (HttpScheme version : HttpScheme.values())
|
for (HttpScheme version : HttpScheme.values())
|
||||||
CACHE.put(version.toString(),version);
|
CACHE.put(version.asString(),version);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String _string;
|
private final String _string;
|
||||||
|
@ -47,7 +47,7 @@ public enum HttpScheme
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public ByteBuffer toBuffer()
|
public ByteBuffer asByteBuffer()
|
||||||
{
|
{
|
||||||
return _buffer.asReadOnlyBuffer();
|
return _buffer.asReadOnlyBuffer();
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,11 @@ public enum HttpScheme
|
||||||
return _string.equalsIgnoreCase(s);
|
return _string.equalsIgnoreCase(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String asString()
|
||||||
|
{
|
||||||
|
return _string;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
|
|
|
@ -510,14 +510,14 @@ public class HttpURI
|
||||||
_raw[_scheme+1]=='t' &&
|
_raw[_scheme+1]=='t' &&
|
||||||
_raw[_scheme+2]=='t' &&
|
_raw[_scheme+2]=='t' &&
|
||||||
_raw[_scheme+3]=='p' )
|
_raw[_scheme+3]=='p' )
|
||||||
return HttpScheme.HTTP.toString();
|
return HttpScheme.HTTP.asString();
|
||||||
if (l==6 &&
|
if (l==6 &&
|
||||||
_raw[_scheme]=='h' &&
|
_raw[_scheme]=='h' &&
|
||||||
_raw[_scheme+1]=='t' &&
|
_raw[_scheme+1]=='t' &&
|
||||||
_raw[_scheme+2]=='t' &&
|
_raw[_scheme+2]=='t' &&
|
||||||
_raw[_scheme+3]=='p' &&
|
_raw[_scheme+3]=='p' &&
|
||||||
_raw[_scheme+4]=='s' )
|
_raw[_scheme+4]=='s' )
|
||||||
return HttpScheme.HTTPS.toString();
|
return HttpScheme.HTTPS.asString();
|
||||||
|
|
||||||
return new String(_raw,_scheme,_authority-_scheme-1,_charset);
|
return new String(_raw,_scheme,_authority-_scheme-1,_charset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.eclipse.jetty.server;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
|
|
||||||
import org.eclipse.jetty.http.HttpFields;
|
import org.eclipse.jetty.http.HttpFields;
|
||||||
|
@ -13,9 +12,9 @@ import org.eclipse.jetty.io.ByteBufferPool;
|
||||||
|
|
||||||
public abstract class AbstractHttpConnector extends AbstractConnector implements HttpConnector
|
public abstract class AbstractHttpConnector extends AbstractConnector implements HttpConnector
|
||||||
{
|
{
|
||||||
private String _integralScheme = HttpScheme.HTTPS.toString();
|
private String _integralScheme = HttpScheme.HTTPS.asString();
|
||||||
private int _integralPort = 0;
|
private int _integralPort = 0;
|
||||||
private String _confidentialScheme = HttpScheme.HTTPS.toString();
|
private String _confidentialScheme = HttpScheme.HTTPS.asString();
|
||||||
private int _confidentialPort = 0;
|
private int _confidentialPort = 0;
|
||||||
private boolean _forwarded;
|
private boolean _forwarded;
|
||||||
private String _hostHeader;
|
private String _hostHeader;
|
||||||
|
@ -115,7 +114,7 @@ public abstract class AbstractHttpConnector extends AbstractConnector implements
|
||||||
if(ssl_session_id!=null)
|
if(ssl_session_id!=null)
|
||||||
{
|
{
|
||||||
request.setAttribute("javax.servlet.request.ssl_session_id", ssl_session_id);
|
request.setAttribute("javax.servlet.request.ssl_session_id", ssl_session_id);
|
||||||
request.setScheme(HttpScheme.HTTPS.toString());
|
request.setScheme(HttpScheme.HTTPS.asString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import java.io.PrintWriter;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
import javax.servlet.ServletOutputStream;
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.Cookie;
|
import javax.servlet.http.Cookie;
|
||||||
|
@ -179,7 +178,7 @@ public class Response implements HttpServletResponse
|
||||||
path = (path == null?"":path);
|
path = (path == null?"":path);
|
||||||
int port=uri.getPort();
|
int port=uri.getPort();
|
||||||
if (port<0)
|
if (port<0)
|
||||||
port = HttpScheme.HTTPS.toString().equalsIgnoreCase(uri.getScheme())?443:80;
|
port = HttpScheme.HTTPS.asString().equalsIgnoreCase(uri.getScheme())?443:80;
|
||||||
if (!request.getServerName().equalsIgnoreCase(uri.getHost()) ||
|
if (!request.getServerName().equalsIgnoreCase(uri.getHost()) ||
|
||||||
request.getServerPort()!=port ||
|
request.getServerPort()!=port ||
|
||||||
!path.startsWith(request.getContextPath())) //TODO the root context path is "", with which every non null string starts
|
!path.startsWith(request.getContextPath())) //TODO the root context path is "", with which every non null string starts
|
||||||
|
|
Loading…
Reference in New Issue