Merged branch 'jetty-9.3.x' into 'master'.

This commit is contained in:
Simone Bordet 2015-11-02 12:17:00 +01:00
commit 5062756135
3 changed files with 37 additions and 32 deletions

View File

@ -695,6 +695,10 @@ public class PushCacheFilterTest extends AbstractTest
@Override @Override
public Stream.Listener onPush(Stream stream, PushPromiseFrame frame) public Stream.Listener onPush(Stream stream, PushPromiseFrame frame)
{ {
MetaData metaData = frame.getMetaData();
Assert.assertTrue(metaData instanceof MetaData.Request);
MetaData.Request pushedRequest = (MetaData.Request)metaData;
Assert.assertEquals(servletPath + secondaryResource, pushedRequest.getURI().getPathQuery());
return new Adapter() return new Adapter()
{ {
@Override @Override

View File

@ -222,8 +222,8 @@ public class PushBuilderImpl implements PushBuilder
int q=path.indexOf('?'); int q=path.indexOf('?');
if (q>=0) if (q>=0)
{ {
query=(query!=null && query.length()>0)?(_path.substring(q+1)+'&'+query):_path.substring(q+1); query=(query!=null && query.length()>0)?(path.substring(q+1)+'&'+query):path.substring(q+1);
path=_path.substring(0,q); path=path.substring(0,q);
} }
if (!path.startsWith("/")) if (!path.startsWith("/"))
@ -246,7 +246,7 @@ public class PushBuilderImpl implements PushBuilder
_fields.add(HttpHeader.IF_MODIFIED_SINCE,_lastModified); _fields.add(HttpHeader.IF_MODIFIED_SINCE,_lastModified);
} }
HttpURI uri = HttpURI.createHttpURI(_request.getScheme(),_request.getServerName(),_request.getServerPort(),_path,param,query,null); HttpURI uri = HttpURI.createHttpURI(_request.getScheme(),_request.getServerName(),_request.getServerPort(),path,param,query,null);
MetaData.Request push = new MetaData.Request(_method,uri,_request.getHttpVersion(),_fields); MetaData.Request push = new MetaData.Request(_method,uri,_request.getHttpVersion(),_fields);
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())

View File

@ -34,7 +34,6 @@ import java.util.concurrent.atomic.AtomicLong;
import javax.servlet.Filter; import javax.servlet.Filter;
import javax.servlet.FilterChain; import javax.servlet.FilterChain;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
@ -45,7 +44,6 @@ import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpURI; import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.http.HttpVersion; import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.server.Dispatcher;
import org.eclipse.jetty.server.PushBuilder; import org.eclipse.jetty.server.PushBuilder;
import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.StringUtil;
@ -158,6 +156,9 @@ public class PushCacheFilter implements Filter
LOG.debug("{} {} referrer={} conditional={}", request.getMethod(), request.getRequestURI(), referrer, conditional); LOG.debug("{} {} referrer={} conditional={}", request.getMethod(), request.getRequestURI(), referrer, conditional);
String path = URIUtil.addPaths(request.getServletPath(), request.getPathInfo()); String path = URIUtil.addPaths(request.getServletPath(), request.getPathInfo());
String query = request.getQueryString();
if (query != null)
path += "?" + query;
if (referrer != null) if (referrer != null)
{ {
HttpURI referrerURI = new HttpURI(referrer); HttpURI referrerURI = new HttpURI(referrer);