Skip to content

Commit

Permalink
Merge branch 'async-support' into bugs/231-julroot
Browse files Browse the repository at this point in the history
  • Loading branch information
gregw committed Aug 10, 2016
2 parents dd4bc90 + 9172a68 commit cf4ce6a
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jetty9-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<arguments>
<argument>-jar</argument>
<argument>../jetty-distribution-${jetty.version}/start.jar</argument>
<argument>--add-to-startd=gae,http,deploy,jsp,jstl</argument>
<argument>--add-to-startd=gae,http,jsp,jstl</argument>
</arguments>
</configuration>
</plugin>
Expand Down
16 changes: 16 additions & 0 deletions jetty9-base/src/main/jetty-base/etc/gae-web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">

<!-- Protect app.yaml -->
<Get id="protected" name="ProtectedTargets"/>
<Set name="ProtectedTargets">
<Call class="org.eclipse.jetty.util.ArrayUtil" name="addToArray">
<Arg><Ref refid="protected"/></Arg>
<Arg>/app.yaml</Arg>
<Arg></Arg>
</Call>
</Set>

</Configure>

10 changes: 10 additions & 0 deletions jetty9-base/src/main/jetty-base/etc/gae.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
</Call>
</Ref>

<Ref refid="DeploymentManager">
<Call name="addLifeCycleBinding">
<Arg>
<New class="org.eclipse.jetty.deploy.bindings.GlobalWebappConfigBinding">
<Set name="jettyXml"><Property name="jetty.base"/>/etc/gae-web.xml</Set>
</New>
</Arg>
</Call>
</Ref>

<!-- TODO remove when this has been added to jetty.xml -->
<Set name="stopTimeout"><Property name="jetty.server.stopTimeout" default="30000"/></Set>

Expand Down
1 change: 1 addition & 0 deletions jetty9-base/src/main/jetty-base/modules/gae.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[depend]
resources
server
deploy

[optional]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.eclipse.jetty.server.HttpOutput;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.ArrayUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.JavaUtilLog;
import org.eclipse.jetty.util.resource.Resource;
Expand Down Expand Up @@ -343,6 +344,8 @@ public void init(String appengineWebXmlFile) throws AppEngineConfigException, IO
getSessionHandler().setSessionManager(sessionManager);

VmRuntimeInterceptor.init(appEngineWebXml);

setProtectedTargets(ArrayUtil.addToArray(getProtectedTargets(), "/app.yaml", String.class));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ public void testWelcomeServlet() throws Exception {
assertTrue(Arrays.asList(lines).contains("Hello, World!"));
}

/**
* Tests that app.yaml is protected
*/
public void testAppYamlHidden() throws Exception {
HttpURLConnection connection = (HttpURLConnection) createUrl("/app.yaml").openConnection();
connection.connect();
assertEquals(404, connection.getResponseCode());
}

/**
* Test that the API Proxy was configured by the VmRuntimeFilter.
*/
Expand Down
2 changes: 1 addition & 1 deletion jetty9-compat/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ADD jetty-base jetty_run.sh $JETTY_BASE/
WORKDIR $JETTY_BASE
RUN sed -i 's/^\([a-zA-Z\.]*=\).*/#\1(see gae.ini)/' start.d/server.ini \
&& java -jar $JETTY_HOME/start.jar --dry-run \
| sed 's/^.*java /& ${JAVA_OPTS} /' > jetty_cmd.sh \
| sed 's/^.*java /exec & ${JAVA_OPTS} /' > jetty_cmd.sh \
&& chown -R jetty:jetty $JETTY_BASE \
&& chmod +x $JETTY_BASE/jetty_run.sh

Expand Down
1 change: 1 addition & 0 deletions testwebapp/src/main/webapp/app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dummy app.yaml

0 comments on commit cf4ce6a

Please sign in to comment.