Note that there are some explanatory texts on larger screens.

plurals
  1. POatmosphere + spring + autowired problems
    primarykey
    data
    text
    <p>I am developing a web app and trying to integrate a chat (for now). I am using Spring and Atmosphere to do this. I managed to get the chat working, but now I seem to have run into a problem. I am using the @ManagedService in a separate servlet (similar to the atmosphere-chat-multiroom example) and now I need to access to a bean that is inside the spring application. For the rest of the servlets that I am using, this works flawlessly, but I am at a dead end when it comes to doind this in Atmosphere ManagedService, the service is always returned as null.</p> <p>Does anyone have any clue as to what I can do?</p> <pre><code>@ManagedService(path = "{room: [a-zA-Z][a-zA-Z_0-9]*}") @Singleton public class ChatRoom { private final Logger logger = LoggerFactory.getLogger(ChatRoom.class); private final ConcurrentHashMap&lt;String, String&gt; users = new ConcurrentHashMap&lt;String, String&gt;(); private String chatroomName; private String mappedPath; private BroadcasterFactory factory; @Autowired IFriendsServices friendServices; @Message(encoders = { JacksonEncoder.class }, decoders = { UserDecoder.class }) public void onPrivateMessage(ChatUserMessageDTO user) throws IOException { String userUUID = users.get(user.getUser()); friendServices.createChatMessage(user.getUser(), user.getSource(), user.getMessage()); if (userUUID != null) { AtmosphereResource r = AtmosphereResourceFactory.getDefault().find(userUUID); if (r != null) { ChatProtocolMessageDTO m = new ChatProtocolMessageDTO(user.getSource(), user.getMessage(), users.keySet(), factory.lookupAll()); factory.lookup(mappedPath).broadcast(m, r); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload