basic push cache filter

This commit is contained in:
Greg Wilkins 2014-08-08 17:00:47 +10:00
parent 6b9a069d9d
commit 4d7ead76ce
4 changed files with 17 additions and 1 deletions

View File

@ -76,7 +76,7 @@ public class HttpFields implements Iterable<HttpField>
*/ */
public HttpFields(HttpFields fields) public HttpFields(HttpFields fields)
{ {
_fields=Arrays.copyOf(fields._fields,_fields.length+10); _fields=Arrays.copyOf(fields._fields,fields._fields.length+10);
_size=fields._size; _size=fields._size;
} }

View File

@ -237,6 +237,12 @@ public class Dispatcher implements RequestDispatcher
baseRequest.getHttpChannel().getHttpTransport().push(push); baseRequest.getHttpChannel().getHttpTransport().push(push);
} }
@Override
public String toString()
{
return String.format("Dispatcher@0x%x{%s,%s}",hashCode(),_named,_uri);
}
private void commitResponse(ServletResponse response, Request baseRequest) throws IOException private void commitResponse(ServletResponse response, Request baseRequest) throws IOException
{ {
if (baseRequest.getResponse().isWriting()) if (baseRequest.getResponse().isWriting())

View File

@ -18,6 +18,15 @@
<listener-class>com.acme.TestListener</listener-class> <listener-class>com.acme.TestListener</listener-class>
</listener> </listener>
<filter>
<filter-name>PushFilter</filter-name>
<filter-class>org.eclipse.jetty.servlets.PushCacheFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>PushFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter> <filter>
<filter-name>QoSFilter</filter-name> <filter-name>QoSFilter</filter-name>

View File

@ -158,6 +158,7 @@ public class TestServer
server.setStopAtShutdown(true); server.setStopAtShutdown(true);
WebAppContext webapp = new WebAppContext(); WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/test");
webapp.setParentLoaderPriority(true); webapp.setParentLoaderPriority(true);
webapp.setResourceBase("./src/main/webapp"); webapp.setResourceBase("./src/main/webapp");
webapp.setAttribute("testAttribute","testValue"); webapp.setAttribute("testAttribute","testValue");