HowTo use https / ssl with Maven/Mortbay Jetty Plugin?

后端 未结 3 1478
终归单人心
终归单人心 2020-12-13 03:06

I would like to use ssl / https as described in

http://docs.codehaus.org/display/JETTY/How+to+configure+SSL

using jetty-maven-plugin, but I don\'t know how t

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 03:22

    In case you want to do it using Jetty 9, note that since jetty-9.0 it is no longer possible to configure a https connector directly in the pom.xml: you need to use jetty xml config files to do it.[1].

    Here is an example:

    pom.xml

    
    9.1.2.v20140210
    
    ...
    
      org.eclipse.jetty
      jetty-server
      ${jetty-version}
    
    ...
          
                org.codehaus.mojo
                keytool-maven-plugin
                1.3
                
                    
                        generate-resources
                        clean
                        
                            clean
                        
                    
                    
                        generate-resources
                        genkey
                        
                            generateKeyPair
                        
                    
                
                
                    ${project.build.directory}/jetty-ssl.keystore
                    cn=127.0.0.1
                    dypBdX1NB3gXA0DXCy9nfyJ4jqUDlaydgbo9OU12g
                    dypBdX1NB3gXA0DXCy9nfyJ4jqUDlaydgbo9OU12g
                    jetty
                    RSA
                
            
            
                org.eclipse.jetty
                jetty-maven-plugin
                ${jetty-version}
                
                    src/main/resources/jetty.xml,src/main/resources/jetty-ssl.xml,src/main/resources/jetty-https.xml
                
                
    

    jetty-https.xml

    
    
    
      
        
          
            
            
              
                
                  
                    http/1.1
                    
                  
                
                
                  
                    
                  
                
              
            
            
            
            30000
          
        
      
    
    

    jetty-ssl.xml

    
    
    
    
    
    
    
    
    
      /
      
      
      /
      
      
      
        
          SSL_RSA_WITH_DES_CBC_SHA
          SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA
        
      
    
      
      
      
      
      
      
      
        
        
          
        
      
    
    
    

    jetty.xml

    
    
    
     
     https
     
      
     
     
    
    

提交回复
热议问题