Null VaadinResponse when using @Push

Hi all,

I’m experiencing a problem where by if I use the @Push annotation, when I get the CurrentResponse from the VaadinService its Null.


@Route(value = "test")
public class TestView extends VerticalLayout {
	private static Logger log = LoggerFactory.getLogger(TestView.class);
	public void init() {
		Button button = new Button("Let's Go");
		button.addClickListener(e -> {
			log.error("the current response is: " + 
				(VaadinService.getCurrentResponse() == null ? "Null" : "Not Null")); // <-- Null Here
		log.error("the current response is: " +
			(VaadinService.getCurrentResponse() == null ? "Null" : "Not Null"));  // <-- Not Null Here

If I remove the @Push, both calls to getCurrentResponse are ‘Not Null’.

Is this right? I’m trying to add cookies, but also need Push as updates are made in a background thread.

Thanks for any info,


Hi, try using @Push(transport=WEBSOCKET_XHR), then everything will be handled through normal HTTP requests except what you push from background threads

Hi Artur,

Yes, that has worked a treat. Thank you!