我想创建一个XMLGregorianCalendar
具有以下特征的:
所以我希望日期打印为:18:00:00Z ( XML Date )。
该元素是一个 xsd:time,我希望时间在 XML 中像这样显示。
<time>18:00:00Z</time>
Run Code Online (Sandbox Code Playgroud)
但我得到以下信息:21:00:00+0000。我在 -3 偏移处,结果是我的偏移量的计算。
为什么我的代码有问题?
protected XMLGregorianCalendar timeUTC() throws Exception {
Date date = new Date();
DateFormat df = new SimpleDateFormat("HH:mm:ssZZ");
df.setTimeZone(TimeZone.getTimeZone("UTC"));
String dateS = df.format(date);
return DatatypeFactory.newInstance().newXMLGregorianCalendar(dateS);
}
Run Code Online (Sandbox Code Playgroud) 我写了一个非常简单的Spring Boot应用程序。
为了获得身份验证令牌,我使用了以下curl
命令。但是相反,我在服务器日志(Eclipse控制台)中看到以下错误:error="invalid_grant", error_description="Bad credentials"
curl -v -u greetings:123456 -X POST http://localhost:8080/oauth/token -H "Accept: application/json" -d "username=username&password=password&grant_type=password&scope=write&client_secret=12345&client_id=greetings"
Run Code Online (Sandbox Code Playgroud)
我想知道:
我做错了什么不让我得到auth code
?
OAuth2ServerConfiguration.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
@Configuration
@EnableResourceServer
@EnableAuthorizationServer
class OAuth2Configuration extends AuthorizationServerConfigurerAdapter {
String applicationName = "greetings";
// This is required for password grants, which we specify below as one of the
// {@literal authorizedGrantTypes()}.
@Autowired
AuthenticationManagerBuilder …
Run Code Online (Sandbox Code Playgroud) 我试图过滤子文档.
样本记录:
[Document{{_id=597608aba213742554f537a6, upp_id=, content_id=597608aba213742554f537a3, idmapping=Document{{ptype=PDF, clientid=12345, normalizedclientid=12345, systeminstanceid=, sourceschemaname=, platforminternalid=0987654321}}, batchid=null, locale=en_US}}]
Run Code Online (Sandbox Code Playgroud)
我需要使用idmapping.ptype = PDF进行过滤
MongoCursor<Document> cursor = mailboxitemCollection.find(whereClause).iterator();
List<Document> documentList = new ArrayList<Document>();
while (cursor.hasNext()) {
Document object = cursor.next();
documentList.add(object);
}
List<Document> outList = documentList.stream()
.filter(p -> p.getInteger(CommonConstants.VISIBILITY) == 1
&& (!StringUtils.isEmpty(req.ptype())? (p.getString("idmapping.ptype").equalsIgnoreCase(req.ptype())) : true)
).parallel().sequential().collect(Collectors.toCollection(ArrayList::new));
System.out.println(outList);
System.out.println(outList.size());
Run Code Online (Sandbox Code Playgroud)
我得到Null Point异常,无法从List documentList中读取sub/embed文档.
先感谢您!Bharathi