小编Dan*_*nny的帖子

使用tomcat设置SSL(自签名证书)

我主要关注此页面:

http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

我用这个命令来创建密钥库

keytool -genkey -alias tomcat -keyalg RSA -keystore/etc/tomcat6/keystore

并回答了提示

然后我编辑了我的server.xml文件并取消注释/编辑了这一行

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" 
           keystoreFile="/etc/tomcat6/keystore" 
           keystorePass="tomcat" />
Run Code Online (Sandbox Code Playgroud)

然后我转到我的项目的web.xml文件并将其添加到文件中

     <security-constraint>
            <web-resource-collection>
                    <web-resource-name>Security</web-resource-name>
                    <url-pattern>/*</url-pattern>
            </web-resource-collection>
            <user-data-constraint>
                    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
            </user-data-constraint>
    </security-constraint>
Run Code Online (Sandbox Code Playgroud)

当我尝试运行我的webapp时,我遇到了这个:

Unable to connect

Firefox can't establish a connection to the server at localhost:8443.

*   The site could be temporarily unavailable or too busy. Try again in a few
      moments.

*   If you are unable to load any pages, check your computer's network
      connection.
Run Code Online (Sandbox Code Playgroud)

如果我注释掉我添加到web.xml文件中的行,webapp工作正常.我在/ var/lib/tomcat6/logs中的日志文件什么也没说.我无法弄清楚这是我的密钥库文件,我的server.xml文件还是我的web.xml文件的问题....任何帮助表示赞赏 …

ubuntu ssl ssl-certificate tomcat6

8
推荐指数
1
解决办法
1万
查看次数

Executors.newSingleThreadExecutor() 是否总是按照提交的顺序执行任务?

Javadoc中说,该任务会按顺序执行。但是这里的顺序是否意味着顺序就是任务提交的顺序?还是说一次只能完成一项任务,但可能不会按照提交的顺序完成?

java multithreading

7
推荐指数
1
解决办法
349
查看次数

如何在netbeans中创建项目依赖项(c/c ++插件)

当我在c ++应用程序上工作时,我意识到我正在创建许多可以在其他项目中使用的类和函数.所以我想将所有这些代码放在一个可以"包含"到其他项目中的单独的net beans项目中.(代码完成等)

我已经尝试创建一个新的"静态库"项目,然后我将项目添加到我的主项目(通过首选项 - >链接 - >库并添加我的"库项目"),但代码完成功能找不到当我尝试#include它时,我的库项目的.h文件,该项目也将无法构建.

这样做的正确方法是什么?

c c++ dependencies netbeans

4
推荐指数
1
解决办法
5509
查看次数

在椭圆路径中动画pygame精灵

这是python 2.6上的pygame 1.9 ..

以下是我的"游戏"中当前正在绘制的内容的屏幕截图.是代码.

它应该是围绕地球轨道运行的月球(我不是想做一个真正的模拟或任何东西,我只是用它来玩游戏并学习pygame).这是2个圆圈,卫星椭圆绕地球运行.我的最终游戏是让月亮跟随它围绕地球运行的轨道,但我想稍后使用键盘控制来调整卫星轨道的形状.

我真的需要帮助弄清楚如何使月亮沿着路径行进,我可能会想到其余部分.

python animation pygame

4
推荐指数
1
解决办法
1824
查看次数

JTable上只能编辑一行

我想制作一种特殊的jtable.我希望默认情况下整个表不可编辑.但是当用户单击一行时,然后单击"编辑"j按钮,该特定行是可编辑的.一旦他们选择了行,它就不再可编辑了.

我该怎么做呢?

java customization jtable

3
推荐指数
1
解决办法
5168
查看次数

Scanf和循环

这里是一段代码,应该循环遍历,直到用户输入0到15之间的数字

        int input;

        do
        {

                printf("Enter a number => ");
                scanf("%d",&input);
                printf("\n %d \n",input);

        }
        while (!(input>0 && input <15));
Run Code Online (Sandbox Code Playgroud)

但是,如果用户输入类似"gfggdf"的内容,则会导致循环重复一遍又一遍,并且从不提示用户再次输入...控制台看起来像这样

Enter a number =>
0
Enter a number =>
0
Enter a number =>
0
Enter a number =>
0
Enter a number =>
0
Enter a number =>
0
(looping indefinitely)
Run Code Online (Sandbox Code Playgroud)

看完这本书之后,似乎我需要做这样的事情来防止这种情况发生.

int input, error, status;
char skip_ch;

do
{
        error = 0;

        printf("Enter a number => ");
        status = scanf("%d",&input);
        printf("\n %d \n",input);

        if(status!=1)
        {
                error=1;
        } …
Run Code Online (Sandbox Code Playgroud)

c scanf

2
推荐指数
1
解决办法
2万
查看次数