Merged branch 'jetty-9.2.x' into 'master'.
This commit is contained in:
parent
701ca1aa26
commit
db61fc2a47
|
@ -87,19 +87,15 @@ public abstract class AbstractConnection implements Connection
|
||||||
// TODO always dispatch failure ?
|
// TODO always dispatch failure ?
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
getExecutor().execute(new Runnable()
|
getExecutor().execute(() ->
|
||||||
{
|
{
|
||||||
@Override
|
try
|
||||||
public void run()
|
|
||||||
{
|
{
|
||||||
try
|
callback.failed(x);
|
||||||
{
|
}
|
||||||
callback.failed(x);
|
catch(Exception e)
|
||||||
}
|
{
|
||||||
catch(Exception e)
|
LOG.warn(e);
|
||||||
{
|
|
||||||
LOG.warn(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -234,10 +230,9 @@ public abstract class AbstractConnection implements Connection
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return String.format("%s@%x[%s,%s]",
|
return String.format("%s@%x[%s]",
|
||||||
getClass().getSimpleName(),
|
getClass().getSimpleName(),
|
||||||
hashCode(),
|
hashCode(),
|
||||||
_state.get(),
|
|
||||||
_endPoint);
|
_endPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,5 +255,5 @@ public abstract class AbstractConnection implements Connection
|
||||||
{
|
{
|
||||||
return String.format("AC.ReadCB@%x{%s}", AbstractConnection.this.hashCode(),AbstractConnection.this);
|
return String.format("AC.ReadCB@%x{%s}", AbstractConnection.this.hashCode(),AbstractConnection.this);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,7 +554,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
|
||||||
_requests,
|
_requests,
|
||||||
_committed.get(),
|
_committed.get(),
|
||||||
_state.getState(),
|
_state.getState(),
|
||||||
_uri);
|
_request.getHttpURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRequest(MetaData.Request request)
|
public void onRequest(MetaData.Request request)
|
||||||
|
|
|
@ -558,12 +558,12 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return String.format("%s[p=%s,g=%s,c=%s]",
|
return String.format("%s[p=%s,g=%s,c=%s][b=%s]",
|
||||||
super.toString(),
|
super.toString(),
|
||||||
_parser,
|
_parser,
|
||||||
_generator,
|
_generator,
|
||||||
_channel);
|
_channel,
|
||||||
return super.toString()+"<--"+BufferUtil.toDetailString(_requestBuffer);
|
BufferUtil.toDetailString(_requestBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Content extends HttpInput.Content
|
private class Content extends HttpInput.Content
|
||||||
|
|
|
@ -637,13 +637,11 @@ public class HttpInput extends ServletInputStream implements Runnable
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return String.format("%s@%x[r=%d,s=%s,e=%s,f=%s]",
|
return String.format("%s@%x[c=%d,s=%s]",
|
||||||
getClass().getSimpleName(),
|
getClass().getSimpleName(),
|
||||||
hashCode(),
|
hashCode(),
|
||||||
_contentRead,
|
_contentConsumed,
|
||||||
_contentState,
|
_state);
|
||||||
_eofState,
|
|
||||||
_onError);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PoisonPillContent extends Content
|
public static class PoisonPillContent extends Content
|
||||||
|
|
|
@ -126,12 +126,12 @@ public class Request implements HttpServletRequest
|
||||||
private static final Logger LOG = Log.getLogger(Request.class);
|
private static final Logger LOG = Log.getLogger(Request.class);
|
||||||
private static final Collection<Locale> __defaultLocale = Collections.singleton(Locale.getDefault());
|
private static final Collection<Locale> __defaultLocale = Collections.singleton(Locale.getDefault());
|
||||||
private static final int __NONE = 0, _STREAM = 1, __READER = 2;
|
private static final int __NONE = 0, _STREAM = 1, __READER = 2;
|
||||||
|
|
||||||
private static final MultiMap<String> NO_PARAMS = new MultiMap<>();
|
private static final MultiMap<String> NO_PARAMS = new MultiMap<>();
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* Obtain the base {@link Request} instance of a {@link ServletRequest}, by
|
* Obtain the base {@link Request} instance of a {@link ServletRequest}, by
|
||||||
* coercion, unwrapping or special attribute.
|
* coercion, unwrapping or special attribute.
|
||||||
* @param request The request
|
* @param request The request
|
||||||
|
@ -141,21 +141,21 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
if (request instanceof Request)
|
if (request instanceof Request)
|
||||||
return (Request)request;
|
return (Request)request;
|
||||||
|
|
||||||
Object channel = request.getAttribute(HttpChannel.class.getName());
|
Object channel = request.getAttribute(HttpChannel.class.getName());
|
||||||
if (channel instanceof HttpChannel)
|
if (channel instanceof HttpChannel)
|
||||||
return ((HttpChannel)channel).getRequest();
|
return ((HttpChannel)channel).getRequest();
|
||||||
|
|
||||||
while (request instanceof ServletRequestWrapper)
|
while (request instanceof ServletRequestWrapper)
|
||||||
request=((ServletRequestWrapper)request).getRequest();
|
request=((ServletRequestWrapper)request).getRequest();
|
||||||
|
|
||||||
if (request instanceof Request)
|
if (request instanceof Request)
|
||||||
return (Request)request;
|
return (Request)request;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private final HttpChannel _channel;
|
private final HttpChannel _channel;
|
||||||
private final List<ServletRequestAttributeListener> _requestAttributeListeners=new ArrayList<>();
|
private final List<ServletRequestAttributeListener> _requestAttributeListeners=new ArrayList<>();
|
||||||
private final HttpInput _input;
|
private final HttpInput _input;
|
||||||
|
@ -165,7 +165,7 @@ public class Request implements HttpServletRequest
|
||||||
private String _contextPath;
|
private String _contextPath;
|
||||||
private String _servletPath;
|
private String _servletPath;
|
||||||
private String _pathInfo;
|
private String _pathInfo;
|
||||||
|
|
||||||
private boolean _secure;
|
private boolean _secure;
|
||||||
private boolean _asyncSupported = true;
|
private boolean _asyncSupported = true;
|
||||||
private boolean _newContext;
|
private boolean _newContext;
|
||||||
|
@ -195,7 +195,7 @@ public class Request implements HttpServletRequest
|
||||||
private long _timeStamp;
|
private long _timeStamp;
|
||||||
private MultiPartInputStreamParser _multiPartInputStream; //if the request is a multi-part mime
|
private MultiPartInputStreamParser _multiPartInputStream; //if the request is a multi-part mime
|
||||||
private AsyncContextState _async;
|
private AsyncContextState _async;
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public Request(HttpChannel channel, HttpInput input)
|
public Request(HttpChannel channel, HttpInput input)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
return getHttpChannel().getHttpTransport().isPushSupported();
|
return getHttpChannel().getHttpTransport().isPushSupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/** Get a PushBuilder associated with this request initialized as follows:<ul>
|
/** Get a PushBuilder associated with this request initialized as follows:<ul>
|
||||||
* <li>The method is initialized to "GET"</li>
|
* <li>The method is initialized to "GET"</li>
|
||||||
|
@ -237,18 +237,18 @@ public class Request implements HttpServletRequest
|
||||||
* <li>Authorization headers
|
* <li>Authorization headers
|
||||||
* <li>Referrer headers
|
* <li>Referrer headers
|
||||||
* </ul></li>
|
* </ul></li>
|
||||||
* <li>If the request was Authenticated, an Authorization header will
|
* <li>If the request was Authenticated, an Authorization header will
|
||||||
* be set with a container generated token that will result in equivalent
|
* be set with a container generated token that will result in equivalent
|
||||||
* Authorization</li>
|
* Authorization</li>
|
||||||
* <li>The query string from {@link #getQueryString()}
|
* <li>The query string from {@link #getQueryString()}
|
||||||
* <li>The {@link #getRequestedSessionId()} value, unless at the time
|
* <li>The {@link #getRequestedSessionId()} value, unless at the time
|
||||||
* of the call {@link #getSession(boolean)}
|
* of the call {@link #getSession(boolean)}
|
||||||
* has previously been called to create a new {@link HttpSession}, in
|
* has previously been called to create a new {@link HttpSession}, in
|
||||||
* which case the new session ID will be used as the PushBuilders
|
* which case the new session ID will be used as the PushBuilders
|
||||||
* requested session ID.</li>
|
* requested session ID.</li>
|
||||||
* <li>The source of the requested session id will be the same as for
|
* <li>The source of the requested session id will be the same as for
|
||||||
* this request</li>
|
* this request</li>
|
||||||
* <li>The builders Referer header will be set to {@link #getRequestURL()}
|
* <li>The builders Referer header will be set to {@link #getRequestURL()}
|
||||||
* plus any {@link #getQueryString()} </li>
|
* plus any {@link #getQueryString()} </li>
|
||||||
* <li>If {@link HttpServletResponse#addCookie(Cookie)} has been called
|
* <li>If {@link HttpServletResponse#addCookie(Cookie)} has been called
|
||||||
* on the associated response, then a corresponding Cookie header will be added
|
* on the associated response, then a corresponding Cookie header will be added
|
||||||
|
@ -256,9 +256,9 @@ public class Request implements HttpServletRequest
|
||||||
* case the Cookie will be removed from the builder.</li>
|
* case the Cookie will be removed from the builder.</li>
|
||||||
* <li>If this request has has the conditional headers If-Modified-Since or
|
* <li>If this request has has the conditional headers If-Modified-Since or
|
||||||
* If-None-Match then the {@link PushBuilderImpl#isConditional()} header is set
|
* If-None-Match then the {@link PushBuilderImpl#isConditional()} header is set
|
||||||
* to true.
|
* to true.
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p>Each call to getPushBuilder() will return a new instance
|
* <p>Each call to getPushBuilder() will return a new instance
|
||||||
* of a PushBuilder based off this Request. Any mutations to the
|
* of a PushBuilder based off this Request. Any mutations to the
|
||||||
* returned PushBuilder are not reflected on future returns.
|
* returned PushBuilder are not reflected on future returns.
|
||||||
|
@ -268,12 +268,12 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
if (!isPushSupported())
|
if (!isPushSupported())
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
|
||||||
HttpFields fields = new HttpFields(getHttpFields().size()+5);
|
HttpFields fields = new HttpFields(getHttpFields().size()+5);
|
||||||
boolean conditional=false;
|
boolean conditional=false;
|
||||||
UserIdentity user_identity=null;
|
UserIdentity user_identity=null;
|
||||||
Authentication authentication=null;
|
Authentication authentication=null;
|
||||||
|
|
||||||
for (HttpField field : getHttpFields())
|
for (HttpField field : getHttpFields())
|
||||||
{
|
{
|
||||||
HttpHeader header = field.getHeader();
|
HttpHeader header = field.getHeader();
|
||||||
|
@ -291,7 +291,7 @@ public class Request implements HttpServletRequest
|
||||||
case REFERER:
|
case REFERER:
|
||||||
case COOKIE:
|
case COOKIE:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case AUTHORIZATION:
|
case AUTHORIZATION:
|
||||||
user_identity=getUserIdentity();
|
user_identity=getUserIdentity();
|
||||||
authentication=_authentication;
|
authentication=_authentication;
|
||||||
|
@ -301,13 +301,13 @@ public class Request implements HttpServletRequest
|
||||||
case IF_MODIFIED_SINCE:
|
case IF_MODIFIED_SINCE:
|
||||||
conditional=true;
|
conditional=true;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fields.add(field);
|
fields.add(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String id=null;
|
String id=null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -324,13 +324,13 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
id=getRequestedSessionId();
|
id=getRequestedSessionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
PushBuilder builder = new PushBuilderImpl(this,fields,getMethod(),getQueryString(),id,conditional);
|
PushBuilder builder = new PushBuilderImpl(this,fields,getMethod(),getQueryString(),id,conditional);
|
||||||
builder.addHeader("referer",getRequestURL().toString());
|
builder.addHeader("referer",getRequestURL().toString());
|
||||||
|
|
||||||
// TODO process any set cookies
|
// TODO process any set cookies
|
||||||
// TODO process any user_identity
|
// TODO process any user_identity
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ public class Request implements HttpServletRequest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -508,7 +508,7 @@ public class Request implements HttpServletRequest
|
||||||
HttpChannelState state = getHttpChannelState();
|
HttpChannelState state = getHttpChannelState();
|
||||||
if (_async==null || !state.isAsyncStarted())
|
if (_async==null || !state.isAsyncStarted())
|
||||||
throw new IllegalStateException(state.getStatusString());
|
throw new IllegalStateException(state.getStatusString());
|
||||||
|
|
||||||
return _async;
|
return _async;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -647,7 +647,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
return _input.getContentConsumed();
|
return _input.getContentConsumed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/*
|
/*
|
||||||
* @see javax.servlet.ServletRequest#getContentType()
|
* @see javax.servlet.ServletRequest#getContentType()
|
||||||
|
@ -696,7 +696,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
if (_cookies == null || _cookies.getCookies().length == 0)
|
if (_cookies == null || _cookies.getCookies().length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return _cookies.getCookies();
|
return _cookies.getCookies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,7 +720,7 @@ public class Request implements HttpServletRequest
|
||||||
//Javadoc for Request.getCookies() stipulates null for no cookies
|
//Javadoc for Request.getCookies() stipulates null for no cookies
|
||||||
if (_cookies == null || _cookies.getCookies().length == 0)
|
if (_cookies == null || _cookies.getCookies().length == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return _cookies.getCookies();
|
return _cookies.getCookies();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
if (_metadata==null)
|
if (_metadata==null)
|
||||||
return Locale.getDefault();
|
return Locale.getDefault();
|
||||||
|
|
||||||
Enumeration<String> enm = _metadata.getFields().getValues(HttpHeader.ACCEPT_LANGUAGE.toString(),HttpFields.__separators);
|
Enumeration<String> enm = _metadata.getFields().getValues(HttpHeader.ACCEPT_LANGUAGE.toString(),HttpFields.__separators);
|
||||||
|
|
||||||
// handle no locale
|
// handle no locale
|
||||||
|
@ -864,7 +864,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
if (_metadata==null)
|
if (_metadata==null)
|
||||||
return Collections.enumeration(__defaultLocale);
|
return Collections.enumeration(__defaultLocale);
|
||||||
|
|
||||||
Enumeration<String> enm = _metadata.getFields().getValues(HttpHeader.ACCEPT_LANGUAGE.toString(),HttpFields.__separators);
|
Enumeration<String> enm = _metadata.getFields().getValues(HttpHeader.ACCEPT_LANGUAGE.toString(),HttpFields.__separators);
|
||||||
|
|
||||||
// handle no locale
|
// handle no locale
|
||||||
|
@ -920,7 +920,7 @@ public class Request implements HttpServletRequest
|
||||||
LOG.ignore(e);
|
LOG.ignore(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InetSocketAddress local=_channel.getLocalAddress();
|
InetSocketAddress local=_channel.getLocalAddress();
|
||||||
if (local==null)
|
if (local==null)
|
||||||
return "";
|
return "";
|
||||||
|
@ -1042,7 +1042,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
if (_queryParameters == null)
|
if (_queryParameters == null)
|
||||||
extractQueryParameters();
|
extractQueryParameters();
|
||||||
|
|
||||||
if (_queryParameters==NO_PARAMS || _queryParameters.size()==0)
|
if (_queryParameters==NO_PARAMS || _queryParameters.size()==0)
|
||||||
_parameters=_contentParameters;
|
_parameters=_contentParameters;
|
||||||
else if (_contentParameters==NO_PARAMS || _contentParameters.size()==0)
|
else if (_contentParameters==NO_PARAMS || _contentParameters.size()==0)
|
||||||
|
@ -1190,7 +1190,7 @@ public class Request implements HttpServletRequest
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* Access the underlying Remote {@link InetSocketAddress} for this request.
|
* Access the underlying Remote {@link InetSocketAddress} for this request.
|
||||||
*
|
*
|
||||||
* @return the remote {@link InetSocketAddress} for this request, or null if the request has no remote (see {@link ServletRequest#getRemoteAddr()} for
|
* @return the remote {@link InetSocketAddress} for this request, or null if the request has no remote (see {@link ServletRequest#getRemoteAddr()} for
|
||||||
* conditions that result in no remote address)
|
* conditions that result in no remote address)
|
||||||
*/
|
*/
|
||||||
|
@ -1213,14 +1213,14 @@ public class Request implements HttpServletRequest
|
||||||
InetSocketAddress remote=_remote;
|
InetSocketAddress remote=_remote;
|
||||||
if (remote==null)
|
if (remote==null)
|
||||||
remote=_channel.getRemoteAddress();
|
remote=_channel.getRemoteAddress();
|
||||||
|
|
||||||
if (remote==null)
|
if (remote==null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
InetAddress address = remote.getAddress();
|
InetAddress address = remote.getAddress();
|
||||||
if (address==null)
|
if (address==null)
|
||||||
return remote.getHostString();
|
return remote.getHostString();
|
||||||
|
|
||||||
return address.getHostAddress();
|
return address.getHostAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1365,7 +1365,7 @@ public class Request implements HttpServletRequest
|
||||||
public String getServerName()
|
public String getServerName()
|
||||||
{
|
{
|
||||||
String name = _metadata.getURI().getHost();
|
String name = _metadata.getURI().getHost();
|
||||||
|
|
||||||
// Return already determined host
|
// Return already determined host
|
||||||
if (name != null)
|
if (name != null)
|
||||||
return name;
|
return name;
|
||||||
|
@ -1414,7 +1414,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
HttpURI uri = _metadata.getURI();
|
HttpURI uri = _metadata.getURI();
|
||||||
int port = (uri.getHost()==null)?findServerPort():uri.getPort();
|
int port = (uri.getHost()==null)?findServerPort():uri.getPort();
|
||||||
|
|
||||||
// If no port specified, return the default port for the scheme
|
// If no port specified, return the default port for the scheme
|
||||||
if (port <= 0)
|
if (port <= 0)
|
||||||
{
|
{
|
||||||
|
@ -1422,7 +1422,7 @@ public class Request implements HttpServletRequest
|
||||||
return 443;
|
return 443;
|
||||||
return 80;
|
return 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return a specific port
|
// return a specific port
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
@ -1445,10 +1445,10 @@ public class Request implements HttpServletRequest
|
||||||
// Return host from connection
|
// Return host from connection
|
||||||
if (_channel != null)
|
if (_channel != null)
|
||||||
return getLocalPort();
|
return getLocalPort();
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
@Override
|
@Override
|
||||||
public ServletContext getServletContext()
|
public ServletContext getServletContext()
|
||||||
|
@ -1534,7 +1534,7 @@ public class Request implements HttpServletRequest
|
||||||
|
|
||||||
if (!create)
|
if (!create)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (getResponse().isCommitted())
|
if (getResponse().isCommitted())
|
||||||
throw new IllegalStateException("Response is committed");
|
throw new IllegalStateException("Response is committed");
|
||||||
|
|
||||||
|
@ -1631,7 +1631,7 @@ public class Request implements HttpServletRequest
|
||||||
UserIdentity user = ((Authentication.User)_authentication).getUserIdentity();
|
UserIdentity user = ((Authentication.User)_authentication).getUserIdentity();
|
||||||
return user.getUserPrincipal();
|
return user.getUserPrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1749,7 +1749,7 @@ public class Request implements HttpServletRequest
|
||||||
_metadata=request;
|
_metadata=request;
|
||||||
setMethod(request.getMethod());
|
setMethod(request.getMethod());
|
||||||
HttpURI uri = request.getURI();
|
HttpURI uri = request.getURI();
|
||||||
|
|
||||||
String path = uri.getDecodedPath();
|
String path = uri.getDecodedPath();
|
||||||
String info;
|
String info;
|
||||||
if (path==null || path.length()==0)
|
if (path==null || path.length()==0)
|
||||||
|
@ -1777,13 +1777,13 @@ public class Request implements HttpServletRequest
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
info = URIUtil.canonicalPath(path);// TODO should this be done prior to decoding???
|
info = URIUtil.canonicalPath(path);// TODO should this be done prior to decoding???
|
||||||
|
|
||||||
if (info == null)
|
if (info == null)
|
||||||
{
|
{
|
||||||
setPathInfo(path);
|
setPathInfo(path);
|
||||||
throw new BadMessageException(400,"Bad URI");
|
throw new BadMessageException(400,"Bad URI");
|
||||||
}
|
}
|
||||||
|
|
||||||
setPathInfo(info);
|
setPathInfo(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1792,21 +1792,21 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
return _metadata;
|
return _metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public boolean hasMetaData()
|
public boolean hasMetaData()
|
||||||
{
|
{
|
||||||
return _metadata!=null;
|
return _metadata!=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
protected void recycle()
|
protected void recycle()
|
||||||
{
|
{
|
||||||
_metadata=null;
|
_metadata=null;
|
||||||
|
|
||||||
if (_context != null)
|
if (_context != null)
|
||||||
throw new IllegalStateException("Request in context!");
|
throw new IllegalStateException("Request in context!");
|
||||||
|
|
||||||
if (_inputState == __READER)
|
if (_inputState == __READER)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1919,7 +1919,7 @@ public class Request implements HttpServletRequest
|
||||||
setQueryEncoding(value == null?null:value.toString());
|
setQueryEncoding(value == null?null:value.toString());
|
||||||
else if ("org.eclipse.jetty.server.sendContent".equals(name))
|
else if ("org.eclipse.jetty.server.sendContent".equals(name))
|
||||||
LOG.warn("Deprecated: org.eclipse.jetty.server.sendContent");
|
LOG.warn("Deprecated: org.eclipse.jetty.server.sendContent");
|
||||||
|
|
||||||
if (_attributes == null)
|
if (_attributes == null)
|
||||||
_attributes = new AttributesMap();
|
_attributes = new AttributesMap();
|
||||||
_attributes.setAttribute(name,value);
|
_attributes.setAttribute(name,value);
|
||||||
|
@ -2098,7 +2098,7 @@ public class Request implements HttpServletRequest
|
||||||
*
|
*
|
||||||
* The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding.
|
* The request attribute "org.eclipse.jetty.server.server.Request.queryEncoding" may be set as an alternate method of calling setQueryEncoding.
|
||||||
*
|
*
|
||||||
* @param queryEncoding the URI query character encoding
|
* @param queryEncoding the URI query character encoding
|
||||||
*/
|
*/
|
||||||
public void setQueryEncoding(String queryEncoding)
|
public void setQueryEncoding(String queryEncoding)
|
||||||
{
|
{
|
||||||
|
@ -2125,7 +2125,7 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
_remote = addr;
|
_remote = addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
/**
|
/**
|
||||||
* @param requestedSessionId
|
* @param requestedSessionId
|
||||||
|
@ -2171,7 +2171,7 @@ public class Request implements HttpServletRequest
|
||||||
*/
|
*/
|
||||||
public void setAuthority(String host,int port)
|
public void setAuthority(String host,int port)
|
||||||
{
|
{
|
||||||
_metadata.getURI().setAuthority(host,port);;
|
_metadata.getURI().setAuthority(host,port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
@ -2254,7 +2254,7 @@ public class Request implements HttpServletRequest
|
||||||
getClass().getSimpleName(),
|
getClass().getSimpleName(),
|
||||||
_handled ? "[" : "(",
|
_handled ? "[" : "(",
|
||||||
getMethod(),
|
getMethod(),
|
||||||
_uri,
|
getHttpURI(),
|
||||||
_handled ? "]" : ")",
|
_handled ? "]" : ")",
|
||||||
hashCode());
|
hashCode());
|
||||||
}
|
}
|
||||||
|
@ -2298,14 +2298,14 @@ public class Request implements HttpServletRequest
|
||||||
if (_multiPartInputStream == null)
|
if (_multiPartInputStream == null)
|
||||||
{
|
{
|
||||||
MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT);
|
MultipartConfigElement config = (MultipartConfigElement)getAttribute(__MULTIPART_CONFIG_ELEMENT);
|
||||||
|
|
||||||
if (config == null)
|
if (config == null)
|
||||||
throw new IllegalStateException("No multipart config for servlet");
|
throw new IllegalStateException("No multipart config for servlet");
|
||||||
|
|
||||||
_multiPartInputStream = new MultiPartInputStreamParser(getInputStream(),
|
_multiPartInputStream = new MultiPartInputStreamParser(getInputStream(),
|
||||||
getContentType(), config,
|
getContentType(), config,
|
||||||
(_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null));
|
(_context != null?(File)_context.getAttribute("javax.servlet.context.tempdir"):null));
|
||||||
|
|
||||||
setAttribute(__MULTIPART_INPUT_STREAM, _multiPartInputStream);
|
setAttribute(__MULTIPART_INPUT_STREAM, _multiPartInputStream);
|
||||||
setAttribute(__MULTIPART_CONTEXT, _context);
|
setAttribute(__MULTIPART_CONTEXT, _context);
|
||||||
Collection<Part> parts = _multiPartInputStream.getParts(); //causes parsing
|
Collection<Part> parts = _multiPartInputStream.getParts(); //causes parsing
|
||||||
|
@ -2327,7 +2327,7 @@ public class Request implements HttpServletRequest
|
||||||
IO.copy(is, os);
|
IO.copy(is, os);
|
||||||
String content=new String(os.toByteArray(),charset==null?StandardCharsets.UTF_8:Charset.forName(charset));
|
String content=new String(os.toByteArray(),charset==null?StandardCharsets.UTF_8:Charset.forName(charset));
|
||||||
if (_contentParameters == null)
|
if (_contentParameters == null)
|
||||||
_contentParameters = params == null ? new MultiMap<String>() : params;
|
_contentParameters = params == null ? new MultiMap<>() : params;
|
||||||
_contentParameters.add(mp.getName(), content);
|
_contentParameters.add(mp.getName(), content);
|
||||||
}
|
}
|
||||||
os.reset();
|
os.reset();
|
||||||
|
@ -2367,7 +2367,7 @@ public class Request implements HttpServletRequest
|
||||||
public void mergeQueryParameters(String oldQuery,String newQuery, boolean updateQueryString)
|
public void mergeQueryParameters(String oldQuery,String newQuery, boolean updateQueryString)
|
||||||
{
|
{
|
||||||
// TODO This is seriously ugly
|
// TODO This is seriously ugly
|
||||||
|
|
||||||
MultiMap<String> newQueryParams = null;
|
MultiMap<String> newQueryParams = null;
|
||||||
// Have to assume ENCODING because we can't know otherwise.
|
// Have to assume ENCODING because we can't know otherwise.
|
||||||
if (newQuery!=null)
|
if (newQuery!=null)
|
||||||
|
@ -2442,9 +2442,9 @@ public class Request implements HttpServletRequest
|
||||||
{
|
{
|
||||||
//Instantiate an instance and inject it
|
//Instantiate an instance and inject it
|
||||||
T h = getContext().createInstance(handlerClass);
|
T h = getContext().createInstance(handlerClass);
|
||||||
|
|
||||||
//TODO handle the rest of the upgrade process
|
//TODO handle the rest of the upgrade process
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -2455,5 +2455,5 @@ public class Request implements HttpServletRequest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue