Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Jboss中的HTTPS配置_Java_Tomcat_Ssl_Jboss_Https - Fatal编程技术网

Java Jboss中的HTTPS配置

Java Jboss中的HTTPS配置,java,tomcat,ssl,jboss,https,Java,Tomcat,Ssl,Jboss,Https,我正在使用JBoss4.2。我希望通过HTTPS访问特定的URL模式。 我使用了自认证密钥库文件,问题是:一旦访问HTTPS url, 站点中的所有其他URL都通过HTTPS,有什么问题吗 更新:我发现了问题。我使用相对路径来引用资源,所以一旦url更改为HTTPS,所有后续链接都以HTTPS开始,那么我必须在HTTPS网页中使用绝对路径吗 我的配置如下: 在web.xml中: <security-constraint> <web-resource-collection

我正在使用JBoss4.2。我希望通过HTTPS访问特定的URL模式。 我使用了自认证密钥库文件,问题是:一旦访问HTTPS url, 站点中的所有其他URL都通过HTTPS,有什么问题吗

更新:我发现了问题。我使用相对路径来引用资源,所以一旦url更改为HTTPS,所有后续链接都以HTTPS开始,那么我必须在HTTPS网页中使用绝对路径吗

我的配置如下: 在web.xml中:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>artists.jsp</web-resource-name>
        <url-pattern>/artists.*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

artists.jsp
/艺术家*
得到
邮递
保密的
在server.xml中:

<Connector port="8443" 
   scheme="https"     
   secure="true"    
   clientAuth="false"  
   keystoreFile="${jboss.server.home.dir}/conf/server.keystore"  
   keystorePass="changeit"  
   sslProtocol = "TLS" /> 

不幸的是,是的,因为URL以协议(http、https)开头,所以您需要绝对路径在它们之间切换

我的建议是:编写一个静态方法,对URL进行充分的格式化,并引入一些命名约定,比如所有以i.g.\u sec开头的页面都要与https一起使用

伪代码(不只是为了说明基本思想而进行测试):

public static String fmtURL(String relpath) {
    String url = relparth.startsWith( "_sec" ) ? "https://":"http://";
    url += hostname;                        // from a configfile
    if ( relparth.startsWith( "_sec" ) {
        url += ":443";
    }
    url += relpath;
    return url;
}