2016-03-22 13:33 GMT+03:00  <violet...@apache.org>:
> Author: violetagg
> Date: Tue Mar 22 10:33:36 2016
> New Revision: 1736178
>
> URL: http://svn.apache.org/viewvc?rev=1736178&view=rev
> Log:
> Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59210
> Fixed ClassCastException in server push example. Patch provided by Huxing 
> Zhang.
>
> Modified:
>     tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
>     
> tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
>
> Modified: tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1736178&r1=1736177&r2=1736178&view=diff
> ==============================================================================
> --- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
> +++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Tue Mar 22 10:33:36 2016
> @@ -65,6 +65,16 @@
>        </add>
>      </changelog>
>    </subsection>
> +  <subsection name="Web applications">
> +    <changelog>
> +      <fix>
> +        <bug>59210</bug>: Server push example has to use
> +        <code>o.a.catalina.connector.RequestFacade</code> when obtaining
> +        <code>o.a.catalina.core.ApplicationPushBuilder</code>. Patch is
> +        provided by Huxing Zhang. (violetagg)
> +      </fix>
> +    </changelog>
> +  </subsection>
>    <subsection name="Other">
>      <changelog>
>        <fix>
>
> Modified: 
> tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java?rev=1736178&r1=1736177&r2=1736178&view=diff
> ==============================================================================
> --- 
> tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
>  (original)
> +++ 
> tomcat/tc8.5.x/trunk/webapps/examples/WEB-INF/classes/http2/SimpleImagePush.java
>  Tue Mar 22 10:33:36 2016
> @@ -24,7 +24,7 @@ import javax.servlet.http.HttpServlet;
>  import javax.servlet.http.HttpServletRequest;
>  import javax.servlet.http.HttpServletResponse;
>
> -import org.apache.catalina.connector.Request;
> +import org.apache.catalina.connector.RequestFacade;
>  import org.apache.catalina.core.ApplicationPushBuilder;
>
>  public class SimpleImagePush extends HttpServlet {
> @@ -35,7 +35,7 @@ public class SimpleImagePush extends Htt
>      protected void doGet(HttpServletRequest req, HttpServletResponse resp)
>              throws ServletException, IOException {
>
> -        ApplicationPushBuilder pb = ((Request) 
> req).getPushBuilder().path("servlets/images/code.gif");
> +        ApplicationPushBuilder pb = ((RequestFacade) 
> req).getPushBuilder().path("servlets/images/code.gif");
>          pb.push();
>
>          resp.setCharacterEncoding("UTF-8");


This API is unusable when running with a SecurityManager.

I mean, classes in "org.apache.catalina.connector.",
"org.apache.catalina.core." normally aren't accessible to web
applications.

It can be solved by introducing a separate package and granting
permission to access it, like it was done for comet

http://svn.apache.org/viewvc?view=revision&revision=833510

    // Applications using Comet need to be able to access this package
    permission java.lang.RuntimePermission
"accessClassInPackage.org.apache.catalina.comet";

It can be o.a.c.push package, in analogy to Comet one. Alternatively,
there were some thoughts of moving facades to a separate package.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to