当前位置: 首页>>代码示例>>Java>>正文


Java TyrusWebSocketEngine类代码示例

本文整理汇总了Java中org.glassfish.tyrus.core.TyrusWebSocketEngine的典型用法代码示例。如果您正苦于以下问题:Java TyrusWebSocketEngine类的具体用法?Java TyrusWebSocketEngine怎么用?Java TyrusWebSocketEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TyrusWebSocketEngine类属于org.glassfish.tyrus.core包,在下文中一共展示了TyrusWebSocketEngine类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createdEndpoint

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
@Override
public Object createdEndpoint(ServerEndpointRegistration registration, ComponentProviderService provider,
		WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException {

	DirectFieldAccessor accessor = new DirectFieldAccessor(engine);
	Object sessionListener = accessor.getPropertyValue("sessionListener");
	Object clusterContext = accessor.getPropertyValue("clusterContext");
	try {
		if (constructorWithBooleanArgument) {
			// Tyrus 1.11+
			return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
					"/", registration.getConfigurator(), sessionListener, clusterContext, null, Boolean.TRUE);
		}
		else {
			return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
					"/", registration.getConfigurator(), sessionListener, clusterContext, null);
		}
	}
	catch (Exception ex) {
		throw new HandshakeFailureException("Failed to register " + registration, ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:AbstractTyrusRequestUpgradeStrategy.java

示例2: createTyrusEndpoint

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
private Object createTyrusEndpoint(Endpoint endpoint, String endpointPath, String protocol,
		List<Extension> extensions, WebSocketContainer container, TyrusWebSocketEngine engine)
		throws DeploymentException {

	ServerEndpointRegistration endpointConfig = new ServerEndpointRegistration(endpointPath, endpoint);
	endpointConfig.setSubprotocols(Collections.singletonList(protocol));
	endpointConfig.setExtensions(extensions);
	return getEndpointHelper().createdEndpoint(endpointConfig, this.componentProvider, container, engine);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:AbstractTyrusRequestUpgradeStrategy.java

示例3: unregisterTyrusEndpoint

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
private void unregisterTyrusEndpoint(TyrusWebSocketEngine engine, Object tyrusEndpoint) {
	if (tyrusEndpoint != null) {
		try {
			getEndpointHelper().unregister(engine, tyrusEndpoint);
		}
		catch (Throwable ex) {
			// ignore
		}
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AbstractTyrusRequestUpgradeStrategy.java

示例4: register

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
@Override
public void register(TyrusWebSocketEngine engine, Object endpoint) {
	try {
		registerMethod.invoke(engine, endpoint);
	}
	catch (Exception ex) {
		throw new HandshakeFailureException("Failed to register " + endpoint, ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:AbstractTyrusRequestUpgradeStrategy.java

示例5: unregister

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
@Override
public void unregister(TyrusWebSocketEngine engine, Object endpoint) {
	try {
		unRegisterMethod.invoke(engine, endpoint);
	}
	catch (Exception ex) {
		throw new HandshakeFailureException("Failed to unregister " + endpoint, ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:AbstractTyrusRequestUpgradeStrategy.java

示例6: buildEngine

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
private void buildEngine() {
    engine = TyrusWebSocketEngine.builder(this)
            .incomingBufferSize(incomingBufferSize)
            .clusterContext(clusterContext)
            .applicationEventListener(applicationEventListener)
            .maxSessionsPerApp(maxSessionsPerApp)
            .maxSessionsPerRemoteAddr(maxSessionsPerRemoteAddr)
            .parallelBroadcastEnabled(BooleanUtils.isTrue(parallelBroadcastEnabled))
            .tracingType(tracingType)
            .tracingThreshold(tracingThreshold)
            .build();
}
 
开发者ID:icode,项目名称:ameba-container-grizzly,代码行数:13,代码来源:WebSocketServerContainer.java

示例7: upgradeInternal

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
@Override
public void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response,
		String selectedProtocol, List<Extension> extensions, Endpoint endpoint)
		throws HandshakeFailureException {

	HttpServletRequest servletRequest = getHttpServletRequest(request);
	HttpServletResponse servletResponse = getHttpServletResponse(response);

	TyrusServerContainer serverContainer = (TyrusServerContainer) getContainer(servletRequest);
	TyrusWebSocketEngine engine = (TyrusWebSocketEngine) serverContainer.getWebSocketEngine();
	Object tyrusEndpoint = null;
	boolean success;

	try {
		// Shouldn't matter for processing but must be unique
		String path = "/" + random.nextLong();
		tyrusEndpoint = createTyrusEndpoint(endpoint, path, selectedProtocol, extensions, serverContainer, engine);
		getEndpointHelper().register(engine, tyrusEndpoint);

		HttpHeaders headers = request.getHeaders();
		RequestContext requestContext = createRequestContext(servletRequest, path, headers);
		TyrusUpgradeResponse upgradeResponse = new TyrusUpgradeResponse();
		UpgradeInfo upgradeInfo = engine.upgrade(requestContext, upgradeResponse);
		success = SUCCESS.equals(upgradeInfo.getStatus());
		if (success) {
			if (logger.isTraceEnabled()) {
				logger.trace("Successful request upgrade: " + upgradeResponse.getHeaders());
			}
			handleSuccess(servletRequest, servletResponse, upgradeInfo, upgradeResponse);
		}
	}
	catch (Exception ex) {
		unregisterTyrusEndpoint(engine, tyrusEndpoint);
		throw new HandshakeFailureException("Error during handshake: " + request.getURI(), ex);
	}

	unregisterTyrusEndpoint(engine, tyrusEndpoint);
	if (!success) {
		throw new HandshakeFailureException("Unexpected handshake failure: " + request.getURI());
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:42,代码来源:AbstractTyrusRequestUpgradeStrategy.java

示例8: ServerInstance

import org.glassfish.tyrus.core.TyrusWebSocketEngine; //导入依赖的package包/类
ServerInstance() {
    serverProperties.put( TyrusWebSocketEngine.WSADL_SUPPORT, "true" );
    Runtime.getRuntime().addShutdownHook( createShutdownHookThread() );
    reset();
}
 
开发者ID:renatoathaydes,项目名称:spark-ws,代码行数:6,代码来源:ServerInstance.java


注:本文中的org.glassfish.tyrus.core.TyrusWebSocketEngine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。