我需要在并发线程中启动一堆任务并检索其结果.
这是我的代码:
List<Callable<? extends Object>> tasks = new ArrayList<>();
// Adding some tasks whith return different types of results:
// Callable<Double>, Callable<String>, Callable<SomeOtherType>, and so on...
List<Future<? extends Object>> results = executor.invokeAll( tasks );
Run Code Online (Sandbox Code Playgroud)
但IDE显示下一个错误:
no suitable method found for invokeAll(List<Callable<? extends Object>>)
method ExecutorService.<T#1>invokeAll(Collection<? extends Callable<T#1>>)
is not applicable
(cannot infer type-variable(s) T#1
(argument mismatch; List<Callable<? extends Object>> cannot be converted
to Collection<? extends Callable<T#1>>
method ExecutorService.<T#2>invokeAll(Collection<? extends Callable<T#2>>,long,TimeUnit)
is not applicable
(cannot infer type-variable(s) T#2
(actual and formal …Run Code Online (Sandbox Code Playgroud) 我在使用Facebook登录我的网站时遇到问题.
我已经通过开发人员在developer.facebook.com上使用Facebook SDK创建了登录,但它对我不起作用.
我写了一个简单的测试页来找出问题所在.这是代码:
<!DOCTYPE html>
<html>
<head></head>
<body>
<pre>
<?php
$app_id = '446458238729594';
$app_secret = '********';
$redirect_uri = 'http://mysite.localhost/';
try {
echo( 'Including "facebook.php"...' );
require './src/facebook.php';
echo( "done.\n\n" );
echo( 'Starting session...' );
$result = session_start();
if( $result ) {
echo( "done.\n\n" );
echo( "\n=====>>>>> Session array:\n" . var_export( $_SESSION, true )
. "\n\n" );
} else {
echo( "fail.\n\n" );
echo( "\n=====>>>>> Session array:\n" . var_export( $_SESSION, true )
. "\n\n" );
}
echo( "Trying to get …Run Code Online (Sandbox Code Playgroud) php facebook-graph-api facebook-php-sdk facebook-login facebook-access-token
我需要在用户注销时删除cookie JSESSIONID.为此,我将以下配置添加到我的安全配置中:
<http>
<form-login login-page="/login*" authentication-failure-url="/login?try_again" />
<http-basic />
<logout logout-url="/logout" delete-cookies="JSESSIONID" />
<session-management invalid-session-url="/timeout" />
<intercept-url pattern="/login*" access="IS_AUTHENTICATED_ANONYMOUSLY" />
...
</http>
Run Code Online (Sandbox Code Playgroud)
但是,cookie不会被删除,而是变得重复:


所以它一直将浏览器重定向到"/ timeout"URL.
我尝试使用Chrome网络浏览器中的开发人员工具跟踪正在发生的事情,我发现此Cookie设置了此响应标头:
Set-Cookie:JSESSIONID=CFF85EA743724F23FDA0317A75CFAD44; Path=/website/; HttpOnly
Run Code Online (Sandbox Code Playgroud)
并使用此响应标头删除:
Set-Cookie:JSESSIONID=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/website
Run Code Online (Sandbox Code Playgroud)
我不确定,但似乎原因在于这些标题的"路径"字段:在第一个中它指向"/ website /",在第二个中它指向"/ website".
这是所描述的麻烦的原因吗?如果不是原因(或不是唯一原因),那么其他原因是什么?我该如何解决这个问题呢?