没有任何活动的会话超时

时间:2018-09-28 05:53:46

标签: java

我试图理解这一点,在web.xml文件和api文件夹中编写了用于会话超时的代码,但是我有点困惑哪个代码对会话超时有效。

里面是web.xml:         480

内部api文件夹代码为:

public HttpClient() {
    SchemeRegistry schemeRegistry = new SchemeRegistry();
    schemeRegistry.register(new Scheme("http", HTTP_PORT,
                                      PlainSocketFactory.getSocketFactory()));
    schemeRegistry.register(new Scheme("https", HTTPS_PORT, 
                                        SSLSocketFactory.getSocketFactory()));

    PoolingClientConnectionManager connectionManager = 
                            new PoolingClientConnectionManager(schemeRegistry);
    connectionManager.setMaxTotal(200);
    connectionManager.setDefaultMaxPerRoute(50);
    HttpHost localhost = new HttpHost("locahost", HTTP_PORT);
    connectionManager.setMaxPerRoute(new HttpRoute(localhost), 50);
    this.defaultHttpClient = (DefaultHttpClient) 
                  HttpClientWrapper.wrapClient(new DefaultHttpClient(connectionManager));

    HttpParams httpParameters = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(httpParameters, 1200000);
    HttpConnectionParams.setSoTimeout(httpParameters, 1200000);
    this.defaultHttpClient.setParams(httpParameters);

    this.httpContext = new SyncBasicHttpContext();
}

0 个答案:

没有答案