Codebase attribute in manifest mismatch when testing local

我的未来我决定 提交于 2019-12-12 09:59:25

问题


As per Java 1.7u25 you should add the Codebase attribute to your manifest and I have done that.

But now I can't test it locally as the the attribute value does not match my local JNLP, generated by Netbeans, wich have no codebase value.

What value should the manifest have for its Codebase and/or what do I have as codebase in my jnlp for it to work locally?


回答1:


There's a few ways to approach this:

  1. Use multiple codebase attributes:

    You can supply multiple values to the Codebase attributes, thus allowing you to add local addresses as well.

    e.g: Codebase: myproductiondomain.com localhost 127.0.0.1

  2. Use Wildcards:

    You can also use a wildcard attribute in the Codebase attribute, which can have multiple forms:

    • e.g. Codebase: 127.0.0.1 (beware, that doesn't allow you to use localhost!!)
    • e.g. a much more lenient Codebase: *
  3. Build Changes:

    But more likely, you should modify your build system to produce a test and a production version using different Codebase attributes to prevent abuse.

Everything you need is in Preventing RIAs from being Repurposed:

Pay extra attention to that fun tidbit in the table of accepted wildcard saying, for the 127.0.0.1 entry:

Does not Match [...] http://localhost




回答2:


I've added an answer on how to automatically add those missing attributes as part of Netbeans build process.

It's a method that works with JavaFX, but it could give you some ideas: https://stackoverflow.com/a/19014303/2382937



来源:https://stackoverflow.com/questions/18534312/codebase-attribute-in-manifest-mismatch-when-testing-local

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!