Spring WebSockets中的PathVariables @SubscribeMapping不起作用

[英]PathVariables in Spring WebSockets @SubscribeMapping not working

I am trying to something similar to this "Path variables in Spring WebSockets @SendTo mapping" But I want to send a table name as additional information to @SubscribeMapping("/topic/data"). "tablename" can be anything based on my need(what I want to set), it should concatenate @SubscribeMapping("/topic/data/{tablename}") and on the server side, I would like to access the tablename to get the data from the database. I have tried the solution mentioned in the above post lien @DestinationVariable but I think I am missing something.

我正在尝试类似于“Spring WebSockets @SendTo映射中的路径变量”但我想将表名作为附加信息发送到@SubscribeMapping(“/ topic / data”)。 “tablename”可以是基于我的需要(我想要设置的),它应该连接@SubscribeMapping(“/ topic / data / {tablename}”)并且在服务器端,我想访问tablename以获取来自数据库的数据。我已经尝试过上面帖子lien @DestinationVariable中提到的解决方案,但我想我错过了一些东西。

1 个解决方案


on the server side :


 public JSONObject getViewSchema(@DestinationVariable String tablename) throws Exception
     DataManager manager = new DataManager();
     return manager.getViewJSONSchema(tablename);

On the client side





  © 2014-2022 ITdaan.com 联系我们: