List of usage examples for org.springframework.web.socket.sockjs.frame Jackson2SockJsMessageCodec Jackson2SockJsMessageCodec
public Jackson2SockJsMessageCodec()
From source file:org.springframework.web.socket.sockjs.client.SockJsClient.java
/** * Create a {@code SockJsClient} with the given transports. * <p>If the list includes an {@link XhrTransport} (or more specifically an * implementation of {@link InfoReceiver}) the instance is used to initialize * the {@link #setInfoReceiver(InfoReceiver) infoReceiver} property, or * otherwise is defaulted to {@link RestTemplateXhrTransport}. * @param transports the (non-empty) list of transports to use *//* w ww .ja v a 2 s . c o m*/ public SockJsClient(List<Transport> transports) { Assert.notEmpty(transports, "No transports provided"); this.transports = new ArrayList<>(transports); this.infoReceiver = initInfoReceiver(transports); if (jackson2Present) { this.messageCodec = new Jackson2SockJsMessageCodec(); } }
From source file:org.springframework.web.socket.sockjs.transport.TransportHandlingSockJsService.java
/** * Create a TransportHandlingSockJsService with given {@link TransportHandler handler} types. * @param scheduler a task scheduler for heart-beat messages and removing timed-out sessions; * the provided TaskScheduler should be declared as a Spring bean to ensure it gets * initialized at start-up and shuts down when the application stops * @param handlers one or more {@link TransportHandler} implementations to use *//* www. j a v a2 s .c om*/ public TransportHandlingSockJsService(TaskScheduler scheduler, Collection<TransportHandler> handlers) { super(scheduler); if (CollectionUtils.isEmpty(handlers)) { logger.warn("No transport handlers specified for TransportHandlingSockJsService"); } else { for (TransportHandler handler : handlers) { handler.initialize(this); this.handlers.put(handler.getTransportType(), handler); } } if (jackson2Present) { this.messageCodec = new Jackson2SockJsMessageCodec(); } }