`

flex policy-file-request with jetty

 
阅读更多

let jetty handle flex policy-file-request

 

jetty : org.eclipse.jetty.project-jetty-8.0.4.v20111024

 

1. http

 

a. jetty-http

 

    add class name FlashPolicyException in package org.eclipse.jetty.http

 

    org.eclipse.jetty.http.HttpParser add codes: line 310

    // EventHandler header

        byte ch;
        byte[] array=_buffer.array();
        try
        {
        	if(new String(array).startsWith("<policy-file-request"))
        		throw new FlashPolicyException();
        }
        catch(FlashPolicyException e)
        {
        	throw e;
        }
        catch(Exception e)
        {
        	// no big deal
        }
 

b. jetty-server

    org.eclipse.jetty.server.AsyncHttpConnection add codes: line 69

 catch (FlashPolicyException e)
                {
                    _endp.flush(new ByteArrayBuffer("<cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>\0"));
                    _parser.reset();
                    _endp.close();
                }
 

 

2.https:

 

a. jetty-io

org.eclipse.jetty.io.nio.ChannelEndPoint add codes: line 167 

private String xml = "<?xml version=\"1.0\"?><cross-domain-policy><site-control permitted-cross-domain-policies=\"all\"/><allow-access-from domain=\"*\" to-ports=\"*\"/></cross-domain-policy>\0";
    /* (non-Javadoc)
     * @see org.eclipse.io.EndPoint#fill(org.eclipse.io.Buffer)
     */
    public int fill(Buffer buffer) throws IOException
    {
        Buffer buf = buffer.buffer();
        int len=0;
        if (buf instanceof NIOBuffer)
        {
            final NIOBuffer nbuf = (NIOBuffer)buf;
            final ByteBuffer bbuf=nbuf.getByteBuffer();
            
            //noinspection SynchronizationOnLocalVariableOrMethodParameter
            try
            {
                synchronized(bbuf)
                {
                    try
                    {
                        bbuf.position(buffer.putIndex());
                        len=_channel.read(bbuf);
                    }
                    finally
                    {
        				String s = new String(Arrays.copyOfRange(bbuf.array(),0,bbuf.position()));
        				if (s.startsWith("<policy-file-request")) {
        					_channel.write(ByteBuffer.wrap(xml.getBytes()));
        				}
                        buffer.setPutIndex(bbuf.position());
                        bbuf.position(0);
                    }
                }

                if (len<0 && isOpen())
                {
                    if (!isInputShutdown())
                        shutdownInput();
                    else if (isOutputShutdown())
                        _channel.close();
                }
            }
            catch (IOException x)
            {
                LOG.debug(x);
                try
                {
                    close();
                }
                catch (IOException xx)
                {
                    LOG.ignore(xx);
                }
                
                if (len>0)
                    throw x;
                len=-1;
            }
        }
        else
        {
            throw new IOException("Not Implemented");
        }
        
        return len;
    }
 

 

 

分享到:
评论

相关推荐

    eclipse jetty插件run-jetty-run-1.3.3

    eclipse jetty插件,从...下载run-jetty-run.zip文件,解压后再编写个links文件丢到eclipse的dropins目录下即可,省去了使用eclipse update方式安装的麻烦。 link文件样例如: path=d:\\eclipse_plugins\\run-jetty-run

    maven集成jetty所需jar包maven-jetty-plugin,多版本

    本文将详细讨论如何将Jetty与Maven进行集成,并介绍关键的`maven-jetty-plugin`插件及其不同版本。 1. Maven与Jetty集成的意义: Maven通过其强大的依赖管理功能,使得项目构建变得简单和规范。而Jetty作为轻量级...

    jetty相关的全部jar包

    jetty-security-9.4.8.v20171121.jar,jetty-io-9.4.8.v20171121.jar,jetty-continuation-9.4.8.v20171121.jar,jetty-client-9.4.8.v20171121.jar,jetty-jmx-9.4.8.v20171121.jar,jetty-plus-9.4.8.v20171121....

    run-jetty-run 1.3.5eclipse插件包

    run-jetty-run 1.3.5(Nightly) 在eclipse 4.5.2中安装jetty插件,然后提取plugins和features目录中的相关文件,打包做成可用link方式安装,省去更换eclipse版本时需要重新下载的问题。 安装方法为新加一个run-jetty...

    maven-jetty-plugin

    &lt;artifactId&gt;maven-jetty-plugin 版本号 &lt;!-- 配置项 --&gt; ... ``` 总的来说,Maven Jetty Plugin是Java Web开发者的重要工具,它简化了开发流程,提高了效率,同时也为持续集成和持续部署提供了便利...

    jetty-libs-9.4.zip

    jetty-client-9.4.24.v20191120, jetty-continuation-9.4.24.v20191120 jetty-http-9.4.24.v20191120 jetty-io-9.4.24.v20191120 jetty-security-9.4.24.v20191120 jetty-server-9.4.24.v20191120 jetty-...

    cxf-rt-transports-http-jetty-3.0.2.zip

    标题 "cxf-rt-transports-http-jetty-3.0.2.zip" 指的是Apache CXF项目的一个特定版本的HTTP-Jetty传输模块。Apache CXF是一个流行的开源框架,用于构建和开发服务导向架构(SOA)和RESTful Web服务。这个版本,...

    jetty9分拆的各个包下载

    jetty-alpn-client-9.2.26.v20180806.jar jetty-alpn-server-9.2.26.v20180806.jar jetty-annotations-9.2.26.v20180806.jar jetty-cdi-9.2.26.v20180806.jar jetty-client-9.2.26.v20180806.jar jetty-continuation...

    jetty-all.jar

    Jetty-all.jar是一个集合了众多Jetty组件的综合性JAR文件,它的主要目的是为了方便开发者在项目中快速引入和使用Jetty服务器。Jetty是一个开源的HTTP服务器和Servlet容器,它以其轻量级、高性能和易用性而受到广泛...

    jetty-continuation-8.1.8.v20121106-API文档-中文版.zip

    赠送jar包:jetty-continuation-8.1.8.v20121106.jar; 赠送原API文档:jetty-continuation-8.1.8.v20121106-javadoc.jar; 赠送源代码:jetty-continuation-8.1.8.v20121106-sources.jar; 赠送Maven依赖信息文件:...

    jetty-all-9.4.47.v20220610-uber.jar

    jetty-all-9.4.47.v20220610-uber.jar

    i-jetty libs包

    android i-jetty servlet-api-2.5.jar jetty-servlet-7.6.0.RC4.jar jetty-server-7.6.0.RC4.jar jetty-http-7.6.0.RC4.jar

    jetty-util-6.1.26-API文档-中英对照版.zip

    赠送jar包:jetty-util-6.1.26.jar; 赠送原API文档:jetty-util-6.1.26-javadoc.jar; 赠送源代码:jetty-util-6.1.26-sources.jar; 赠送Maven依赖信息文件:jetty-util-6.1.26.pom; 包含翻译后的API文档:jetty-...

    jetty-util-9.4.43.v20210629-API文档-中文版.zip

    赠送jar包:jetty-util-9.4.43.v20210629.jar; 赠送原API文档:jetty-util-9.4.43.v20210629-javadoc.jar; 赠送源代码:jetty-util-9.4.43.v20210629-sources.jar; 赠送Maven依赖信息文件:jetty-util-9.4.43.v...

    jetty-server-8.1.8.v20121106-API文档-中文版.zip

    赠送jar包:jetty-server-8.1.8.v20121106.jar; 赠送原API文档:jetty-server-8.1.8.v20121106-javadoc.jar; 赠送源代码:jetty-server-8.1.8.v20121106-sources.jar; 赠送Maven依赖信息文件:jetty-server-8.1.8...

    jetty-server-9.4.8.v20171121-API文档-中文版.zip

    赠送jar包:jetty-server-9.4.8.v20171121.jar; 赠送原API文档:jetty-server-9.4.8.v20171121-javadoc.jar; 赠送源代码:jetty-server-9.4.8.v20171121-sources.jar; 赠送Maven依赖信息文件:jetty-server-9.4.8...

    jetty-util-6.1.26-API文档-中文版.zip

    赠送jar包:jetty-util-6.1.26.jar; 赠送原API文档:jetty-util-6.1.26-javadoc.jar; 赠送源代码:jetty-util-6.1.26-sources.jar; 赠送Maven依赖信息文件:jetty-util-6.1.26.pom; 包含翻译后的API文档:jetty-...

    jetty-server-8.1.8-API文档-中英对照版.zip

    赠送jar包:jetty-server-8.1.8.jar; 赠送原API文档:jetty-server-8.1.8-javadoc.jar; 赠送源代码:jetty-server-8.1.8-sources.jar; 赠送Maven依赖信息文件:jetty-server-8.1.8.pom; 包含翻译后的API文档:...

    jetty-all-7.6.0.v20120127-API文档-中文版.zip

    赠送jar包:jetty-all-7.6.0.v20120127.jar; 赠送原API文档:jetty-all-7.6.0.v20120127-javadoc.jar; 赠送源代码:jetty-all-7.6.0.v20120127-sources.jar; 赠送Maven依赖信息文件:jetty-all-7.6.0.v20120127....

    jetty-io-9.4.8.v20171121-API文档-中文版.zip

    赠送jar包:jetty-io-9.4.8.v20171121.jar; 赠送原API文档:jetty-io-9.4.8.v20171121-javadoc.jar; 赠送源代码:jetty-io-9.4.8.v20171121-sources.jar; 赠送Maven依赖信息文件:jetty-io-9.4.8.v20171121.pom;...

Global site tag (gtag.js) - Google Analytics