如何防止Web资源文件在JSF中下载

时间:2018-09-18 10:30:41

标签: jsf

我已经在xhtml标记中嵌入了一个applet,该标签可以正常工作,但是问题是,当用户使用完整的应用程序路径加上applet名称时,用户可以轻松下载该applet(用户不应下载)。 我尝试在web.xml中使用此代码

<security-constraint>
    <display-name>Prevent Applet from download</display-name>
    <web-resource-collection>
        <web-resource-name>Applet.jar</web-resource-name>
        <url-pattern>/applet.jar</url-pattern>
        <http-method>GET</http-method>
    </web-resource-collection>
    <auth-constraint />
</security-constraint>

上面阻止了applet的下载,但是它阻止了applet的xhtml标记被访问。如何使用filter或web.xml配置实现此目标。

1 个答案:

答案 0 :(得分:1)

客户端需要一个applet,以便它可以在客户端上运行 。阻止其下载会使整个应用程序无法运行。如果您在Web应用程序中实施常规身份验证,则该小程序将受到保护。