/** * Decode the given SockJS message frame. * @param content the SockJS message frame * @return an array of messages, or {@code null} if none * @throws IOException if the content could not be parsed */ @Nullable String[] decodeInputStream(InputStream content) throws IOException;
/** * Protected accessor for internal use. */ @Nullable protected Integer getSendTimeLimit() { return this.sendTimeLimit; }
/** * Protected accessor for internal use. */ @Nullable protected Integer getSendBufferSizeLimit() { return this.sendBufferSizeLimit; }
@Override @Nullable public Principal getUser() { return this.user; }
/** * Return the user associated with the request, if any. */ @Nullable Principal getUser();
/** * Constructor for SockJsTransportFailureException. * @param message the exception message * @param cause the root cause * @since 4.1.7 */ public SockJsTransportFailureException(String message, @Nullable Throwable cause) { super(message, cause); }
/** * Perform an HTTP request to the SockJS "Info" URL. * and return the resulting JSON response content, or raise an exception. * <p>Note that as of 4.2 this method accepts a {@code headers} parameter. * @param infoUrl the URL to obtain SockJS server information from * @param headers the headers to use for the request * @return the body of the response */ String executeInfoRequest(URI infoUrl, @Nullable HttpHeaders headers);
/** * Set the UrlPathHelper to configure on the {@code SimpleUrlHandlerMapping} * used to map handshake requests. */ public void setUrlPathHelper(@Nullable UrlPathHelper urlPathHelper) { this.urlPathHelper = urlPathHelper; }
/** * Return the TaskScheduler, if configured. */ @Nullable protected TaskScheduler getTaskScheduler() { return this.scheduler; }
/** * Set the JSR-356 {@link ServerContainer} to use for endpoint registration. * If not set, the container is going to be retrieved via the {@code ServletContext}. */ public void setServerContainer(@Nullable ServerContainer serverContainer) { this.serverContainer = serverContainer; }
@Override @Nullable public ServerContainer getObject() { return this.serverContainer; }
/** * Constructor for a standard WebSocket session. * @param headers the headers of the handshake request * @param attributes attributes from the HTTP handshake to associate with the WebSocket * session; the provided attributes are copied, the original map is not used. * @param localAddress the address on which the request was received * @param remoteAddress the address of the remote client */ public StandardWebSocketSession(@Nullable HttpHeaders headers, @Nullable Map<String, Object> attributes, @Nullable InetSocketAddress localAddress, @Nullable InetSocketAddress remoteAddress) { this(headers, attributes, localAddress, remoteAddress, null); }
@Override @Nullable public String[] decodeInputStream(InputStream content) throws IOException { return this.objectMapper.readValue(content, String[].class); }
/** * The standard Java WebSocket API allows passing "user properties" to the * server via {@link ClientEndpointConfig#getUserProperties() userProperties}. * Use this property to configure one or more properties to be passed on * every handshake. */ public void setUserProperties(@Nullable Map<String, Object> userProperties) { if (userProperties != null) { this.userProperties.putAll(userProperties); } }
@Nullable private ScheduledFuture<?> initLoggingTask(long initialDelay) { if (this.sockJsTaskScheduler != null && this.loggingPeriod > 0 && logger.isInfoEnabled()) { return this.sockJsTaskScheduler.scheduleAtFixedRate(() -> logger.info(WebSocketMessageBrokerStats.this.toString()), initialDelay, this.loggingPeriod, TimeUnit.MILLISECONDS); } return null; }
/** * @see org.springframework.aop.MethodMatcher#matches(java.lang.reflect.Method, java.lang.Class) */ @Override public boolean matches(Method m, @Nullable Class<?> targetClass) { return false; }
private static void registerBeanDefByName( String name, RootBeanDefinition beanDef, ParserContext context, @Nullable Object source) { beanDef.setSource(source); beanDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); context.getRegistry().registerBeanDefinition(name, beanDef); context.registerComponent(new BeanComponentDefinition(beanDef, name)); }
private RuntimeBeanReference registerUserRegistryMessageHandler( RuntimeBeanReference userRegistry, RuntimeBeanReference brokerTemplate, String destination, ParserContext context, @Nullable Object source) { Object scheduler = WebSocketNamespaceUtils.registerScheduler(SCHEDULER_BEAN_NAME, context, source); RootBeanDefinition beanDef = new RootBeanDefinition(UserRegistryMessageHandler.class); beanDef.getConstructorArgumentValues().addIndexedArgumentValue(0, userRegistry); beanDef.getConstructorArgumentValues().addIndexedArgumentValue(1, brokerTemplate); beanDef.getConstructorArgumentValues().addIndexedArgumentValue(2, destination); beanDef.getConstructorArgumentValues().addIndexedArgumentValue(3, scheduler); String beanName = registerBeanDef(beanDef, context, source); return new RuntimeBeanReference(beanName); }