|
@@ -3,6 +3,7 @@ package hello;
|
|
import org.springframework.messaging.handler.annotation.MessageMapping;
|
|
import org.springframework.messaging.handler.annotation.MessageMapping;
|
|
import org.springframework.messaging.handler.annotation.SendTo;
|
|
import org.springframework.messaging.handler.annotation.SendTo;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
+import org.springframework.web.util.HtmlUtils;
|
|
|
|
|
|
@Controller
|
|
@Controller
|
|
public class GreetingController {
|
|
public class GreetingController {
|
|
@@ -12,7 +13,7 @@ public class GreetingController {
|
|
@SendTo("/topic/greetings")
|
|
@SendTo("/topic/greetings")
|
|
public Greeting greeting(HelloMessage message) throws Exception {
|
|
public Greeting greeting(HelloMessage message) throws Exception {
|
|
Thread.sleep(1000); // simulated delay
|
|
Thread.sleep(1000); // simulated delay
|
|
- return new Greeting("Hello, " + message.getName() + "!");
|
|
|
|
|
|
+ return new Greeting("Hello, " + HtmlUtils.htmlEscape(message.getName()) + "!");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|