我正在使用spring security和java config
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/api/*").hasRole("ADMIN")
.and()
.addFilterAfter(new CsrfTokenResponseHeaderBindingFilter(), CsrfFilter.class)
.exceptionHandling()
.authenticationEntryPoint(restAuthenticationEntryPoint)
.and()
.formLogin()
.successHandler(authenticationSuccessHandler)
.failureHandler(new SimpleUrlAuthenticationFailureHandler());
Run Code Online (Sandbox Code Playgroud)
我正在使用PostMan来测试我的REST服务.我成功获得'csrf token',我可以使用X-CSRF-TOKEN请求标头登录.但登录后我点击发布请求(我在请求标题中包含相同的令牌,我用于登录发布请求)我收到以下错误消息:
HTTP状态403 - 无法验证提供的CSRF令牌,因为找不到您的会话.
任何人都可以指导我做错了什么.
我可以轻松调试我的Angular 2(来自Angular-CLI生成的项目)Chrome和Firefox中的Typescript文件,但是我无法在IE 11中调试任何我的打字稿文件.我在列表中看到的所有文件都是类型.js可以任何人指导我做错了什么或如何在IE中调试应用程序?
我的桌面应用程序客户端通过webSockets. 我javaWebSocket在客户端使用 api,并且使用 Apache tomcat 7 的webSocketServlet. 我不知道我做错了什么,但客户端与网络服务器完美连接并发送聊天消息,但闲置一段时间后,服务器会自动断开客户端连接。我希望客户端保持连接,直到客户端故意不想断开连接为止。这是我的 Web Socketservlet 和客户端的示例代码。首先是客户端代码
Draft[] drafts = { new Draft_10(), new Draft_17(), new Draft_76(), new Draft_75() };
cc = new WebSocketClient( new URI( uriField.getText() ), (Draft) draft.getSelectedItem() ) {
@Override
public void onMessage( String message ) {
ta.append( "got: " + message + "\n" );
ta.setCaretPosition( ta.getDocument().getLength() );
}
@Override
public void onOpen( ServerHandshake handshake ) {
ta.append( "You are connected to ChatServer: " + getURI() …Run Code Online (Sandbox Code Playgroud) 我正在使用 AGM(角度谷歌地图)来制作地图。我已经放了一个 getCurrentLocation 按钮,它返回我当前位置的纬度和经度。我能够将标记更新到那个地方,但我的地图没有导航到那个特定位置。这是我的示例代码。
getCurrentLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition((response) => {
this.setPosition(response);
}, function () {
alert("Unable to get the GPS location");
}, { maximumAge: 60000, timeout: 5000, enableHighAccuracy: true });
};
}
Run Code Online (Sandbox Code Playgroud)
这是我的 setPosition 方法
setPosition(position: Position) {
this.marker.lat = position.coords.latitude;
this.marker.lng = position.coords.longitude;
//What to do here to move screen to this marker position
}
Run Code Online (Sandbox Code Playgroud)
这是我的示例代码...我面临的问题是我的swingWorker扩展类只向我显示doInBackground()作为重叠方法.我也想使用done()和process()方法,但我的类没有显示它@overided,也没有调用done/process方法,需要调用离开while循环的东西等因为我知道它是无限循环但是为什么不是在publish()上调用process方法?
public class getChatSwingWorkerThread extends SwingWorker<String , String> {
private final JTextArea chat_text_area;
private PostDataConnection post = null;
private BasicUserInterface chatWindow = null;
public getChatSwingWorkerThread(JTextArea text_area){
chatWindow = new BasicUserInterface();
this.chat_text_area = text_area;
post = new PostDataConnection();
}
@Override
protected String doInBackground() throws Exception {
String returnData = "";
while(true){
returnData = post.getAvailableChat();
if(!returnData.equals("")){
publish(returnData);
}
}
}
protected void process(String returnData) {
chat_text_area.append(returnData);
}
public void done(String returnData) throws InterruptedException, ExecutionException{
chat_text_area.append(get());
}
Run Code Online (Sandbox Code Playgroud) 我有一个gif动画图像,在jDialog中显示无限循环加载进度...但问题是当我加载这个jDialog时父框架代码停止.怎么做...这是我的代码..
ProgressDialouge pbDialog = new ProgressDialouge(this);
pbDialog.setVisible(true);
pbDialog.toFront();
postPairs.add(new BasicNameValuePair("PATH","authenticateUser.idoc"));
postPairs.add(new BasicNameValuePair("user_email",email));
postPairs.add(new BasicNameValuePair("user_password",password));
JSONArray jArray = asyncService.sendRequest(postPairs);
if(jArray != null){
new NewJFrame().setVisible(true);
this.setVisible(false);
}
Run Code Online (Sandbox Code Playgroud)
如果我改变我的JDiaog的ModalityType.MODELESS,它不会停止执行代码,但它也没有显示进度条..
java ×4
angular ×2
swing ×2
angular-cli ×1
animated-gif ×1
csrf ×1
google-maps ×1
jdialog ×1
jsp ×1
servlets ×1
swingworker ×1
tomcat ×1
websocket ×1