簡體   English   中英

如何在GWT的Jetty中啟用HTTPS?

[英]How to enable HTTPS in GWT's Jetty?

如何在GWT附帶的Jetty中啟用HTTPS?

gwt-dev.jar中有一個README-SSL.txt“hidden”。 您可以在Github上找到最新版本。

特別是,將-server :ssl添加到Jetty的啟動參數中,以便為localhost使用默認的自簽名證書。

嗨,我認為這可以幫助那些人,我也使用GWT,我們被要求使用HTTPS。

基本上我們使用maven運行gwt,所以命令是這樣的,以啟用https。

gwt:debug -Dgwt.style=PRETTY -Dgwt.server=:ssl

這就是我使用jetty運行時插件的pom.xml部分的樣子:run-war或jetty:run。

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.19</version>
    <dependencies>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
        </dependency>
        <dependency>
            <groupId>oracle-jdbc</groupId>
            <artifactId>ojdbc</artifactId>
            <version>14</version>
        </dependency>
    </dependencies>
    <configuration>
        <webApp>${project.build.directory}/${warName}.war</webApp>
        <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                <port>8080</port>
                <maxIdleTime>60000</maxIdleTime>
            </connector>
            <connector implementation="org.mortbay.jetty.security.SslSocketConnector">
                <port>8443</port>
                <maxIdleTime>60000</maxIdleTime>
                <keystore>${project.build.directory}/jetty-ssl.keystore</keystore>
                <password>jetty6</password>
                <keyPassword>jetty6</keyPassword>
            </connector>
        </connectors>
    </configuration>
</plugin>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>keytool-maven-plugin</artifactId>
    <executions>
        <execution>
            <phase>generate-resources</phase>
            <id>clean</id>
            <goals>
                <goal>clean</goal>
            </goals>
        </execution>
        <execution>
            <phase>generate-resources</phase>
            <id>genkey</id>
            <goals>
                <goal>genkey</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <keystore>${project.build.directory}/jetty-ssl.keystore</keystore>
        <dname>cn=localhost</dname>
        <keypass>jetty6</keypass>
        <storepass>jetty6</storepass>
        <alias>jetty6</alias>
        <keyalg>RSA</keyalg>
    </configuration>
</plugin>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM