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


Java EventOutput类代码示例

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


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

示例1: listenToBroadcast

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Path("/Notifications/{ShopID}")
@Produces(SseFeature.SERVER_SENT_EVENTS)
@RolesAllowed({GlobalConstants.ROLE_SHOP_ADMIN})
public EventOutput listenToBroadcast(@PathParam("ShopID")int shopID) {
	final EventOutput eventOutput = new EventOutput();

	if(Globals.broadcasterMap.get(shopID)!=null)
	{
		SseBroadcaster broadcasterOne = Globals.broadcasterMap.get(shopID);
		broadcasterOne.add(eventOutput);
	}
	else
	{
		SseBroadcaster broadcasterTwo = new SseBroadcaster();
		broadcasterTwo.add(eventOutput);
		Globals.broadcasterMap.put(shopID,broadcasterTwo);
	}

	return eventOutput;
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-API,代码行数:22,代码来源:OrderEndpointShopStaffPFS.java

示例2: listenToBroadcast

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Path("/Notifications/{ShopID}")
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput listenToBroadcast(@PathParam("ShopID")int shopID) {
	final EventOutput eventOutput = new EventOutput();

	if(Globals.broadcasterMap.get(shopID)!=null)
	{
		SseBroadcaster broadcasterOne = Globals.broadcasterMap.get(shopID);
		broadcasterOne.add(eventOutput);
	}
	else
	{
		SseBroadcaster broadcasterTwo = new SseBroadcaster();
		broadcasterTwo.add(eventOutput);
		Globals.broadcasterMap.put(shopID,broadcasterTwo);
	}

	return eventOutput;
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-API,代码行数:21,代码来源:OrderResourcePFS.java

示例3: listenToBroadcast

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Path("/Notifications/{EndUserID}")
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput listenToBroadcast(@PathParam("EndUserID")int endUserID) {

	final EventOutput eventOutput = new EventOutput();

	if(Globals.broadcasterMapEndUser.get(endUserID)!=null)
	{
		SseBroadcaster broadcasterOne = Globals.broadcasterMapEndUser.get(endUserID);
		broadcasterOne.add(eventOutput);
	}
	else
	{
		SseBroadcaster broadcasterTwo = new SseBroadcaster();
		broadcasterTwo.add(eventOutput);
		Globals.broadcasterMapEndUser.put(endUserID,broadcasterTwo);
	}

	return eventOutput;
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-API,代码行数:22,代码来源:EndUserResourceNew.java

示例4: listenToBroadcast

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Path("/{ShopID}")
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput listenToBroadcast(@PathParam("ShopID")int shopID) {
    final EventOutput eventOutput = new EventOutput();

    if(Globals.broadcasterMap.get(shopID)!=null)
    {
        SseBroadcaster broadcasterOne = Globals.broadcasterMap.get(shopID);
        broadcasterOne.add(eventOutput);
    }
    else
    {
        SseBroadcaster broadcasterTwo = new SseBroadcaster();
        broadcasterTwo.add(eventOutput);
        Globals.broadcasterMap.put(shopID,broadcasterTwo);
    }
    return eventOutput;
}
 
开发者ID:SumeetMoray,项目名称:Nearby-Shops-API,代码行数:20,代码来源:SSEEndpoint.java

示例5: events

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Path("events")
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput events() {
    final EventOutput eventOutput = new EventOutput();

    if (!broadcaster.add(eventOutput)) {
        // 503 -> 5s delayed client reconnect attempt.
        throw new ServiceUnavailableException(5L);
    }

    try {
        eventOutput.write(event());
    } catch (final IOException ioe) {
        // NO-OP.
    }

    return eventOutput;
}
 
开发者ID:martinjmares,项目名称:javaone2015-cloudone,代码行数:20,代码来源:SpaceObjectResource.java

示例6: subscribeToParameterValueChange

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@Override
public EventOutput subscribeToParameterValueChange(String serviceName,
		String parameterName) {
	try {
		RestService restService = restServiceRegistry
				.getService(serviceName);
		RestParameter restParameter = restService
				.getParameter(parameterName);
		EventOutput eventOutput = new EventOutput();
		Observable obs = valueUpdateHandler.getObservable(restParameter
				.getSubscriptionParameter());
		EventOutputWrapper eventOutputWrapper = new EventOutputWrapper(obs,
				eventOutput);
		return eventOutputWrapper.getEventOutput();
	} catch (NoSuchParameterException nspe) {
		throw new NotFoundException("Parameter " + serviceName + "/"
				+ parameterName + " does not exist!");
	} catch (NoSuchServiceException e) {
		throw new NotFoundException("Service " + serviceName
				+ " does not exist!");
	}
}
 
开发者ID:Mobility-Services-Lab,项目名称:AutomotiveServiceBus,代码行数:23,代码来源:ServiceEndpointImpl.java

示例7: listenToEvents

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@PermitAll
@Produces(SseFeature.SERVER_SENT_EVENTS)
public EventOutput listenToEvents(@QueryParam("token") String token) {
  String removedToken = SLTRegister.remove(token);

  if (removedToken == null) {
    return null;
  }

  final EventOutput eventOutput = new EventOutput();
  sseBroadcaster.add(eventOutput);
  return eventOutput;
}
 
开发者ID:Juraji,项目名称:Biliomi,代码行数:15,代码来源:EventsSseService.java

示例8: getServerSentEvents

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Path("/{stopCode}")
public EventOutput getServerSentEvents(@PathParam("stopCode") final String stopCode) {
    final EventOutput eventOutput = new EventOutput();
    new Thread(() -> new MqttClient(DisplayConfiguration.getSystemParameters().getConnectionString(), UUID.randomUUID().toString(), new OnMessageCallback(eventOutput))).start();
    return eventOutput;
}
 
开发者ID:CROW-NDOV,项目名称:displaydirect,代码行数:8,代码来源:StopSystemEvents.java

示例9: getServerSentEvents

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Produces(SseFeature.SERVER_SENT_EVENTS)
@NoCache
@Path("id-only")
public EventOutput getServerSentEvents(
        @NotNull @Valid @BeanParam SubscriptionRequestParams subscriptionRequestParams) {
    return createEventOutput(subscriptionRequestParams, false);
}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:9,代码来源:FactsResource.java

示例10: getServerSentEventsFull

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@GET
@Produces(SseFeature.SERVER_SENT_EVENTS)
@NoCache
public EventOutput getServerSentEventsFull(
        @NotNull @Valid @BeanParam SubscriptionRequestParams subscriptionRequestParams) {
    return createEventOutput(subscriptionRequestParams, true);
}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:8,代码来源:FactsResource.java

示例11: createEventOutput

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
private EventOutput createEventOutput(SubscriptionRequestParams subscriptionRequestParams,
        boolean fullOutput) {
    final EventOutput eventOutput = new EventOutput();
    SubscriptionRequestTO req = subscriptionRequestParams.toRequest(!fullOutput);
    AtomicReference<Subscription> subscription = new AtomicReference<Subscription>(null);
    FactObserver observer = factsObserverFactory.createFor(eventOutput, linkFactoryContext
            .getBaseUri(), subscription, fullOutput);

    Subscription sub = factStore.subscribe(req, observer);
    subscription.set(sub);

    return eventOutput;
}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:14,代码来源:FactsResource.java

示例12: FactsObserver

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
public FactsObserver(@NonNull EventOutput eventOutput,
        @NonNull LinkFactory<FactsResource> linkFatory,
        @NonNull HyperSchemaCreator hyperSchemaCreator, @NonNull URI baseURI,
        @NonNull AtomicReference<Subscription> subcription,
        @NonNull FactTransformer factTransformer, boolean fullOutputMode) {
    super();

    this.fullOutputMode = fullOutputMode;
    this.eventOutput = eventOutput;
    this.linkFatory = linkFatory;
    this.hyperSchemaCreator = hyperSchemaCreator;
    this.subcription = subcription;
    this.factTransformer = factTransformer;
    // this is need, because we are nor in requestscope anymore
    this.linkFactoryContext = new LinkFactoryContext() {

        @Override
        public MethodCheckerForLink getMethodCheckerForLink() {
            return m -> true;
        }

        @Override
        public FieldCheckerForSchema getFieldCheckerForSchema() {
            return (f, c) -> true;
        }

        @Override
        public URI getBaseUri() {
            return baseURI;
        }
    };
}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:33,代码来源:FactsObserver.java

示例13: createFor

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
FactsObserver createFor(@NonNull EventOutput eventOutput, @NonNull URI baseURI,
        @NonNull AtomicReference<Subscription> subscription, boolean fullOutputMode) {
    FactsObserver factsObserver = new FactsObserver(eventOutput, factsResourceLinkFactory,
            hyperSchemaCreator, baseURI, subscription, factTransformer, fullOutputMode);

    scheduleCleanUp(new CompletableFuture<>(), factsObserver);

    return factsObserver;
}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:10,代码来源:FactsObserverFactory.java

示例14: testNullContracts

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testNullContracts() throws Exception {

    TestHelper.expectNPE(() -> new FactsObserverFactory(null, hyperSchemaCreator,
            factTransformer, executorService, 0));

    TestHelper.expectNPE(() -> new FactsObserverFactory(factsResourceLinkFactory, null,
            factTransformer, executorService, 0));

    TestHelper.expectNPE(() -> new FactsObserverFactory(factsResourceLinkFactory,
            hyperSchemaCreator, null, executorService, 0));

    TestHelper.expectNPE(() -> new FactsObserverFactory(factsResourceLinkFactory,
            hyperSchemaCreator, factTransformer, null, 0));

    FactsObserverFactory uut = new FactsObserverFactory(factsResourceLinkFactory,
            hyperSchemaCreator, factTransformer, executorService, 0);

    TestHelper.expectNPE(() -> uut.createFor(null, new URI("http://ibm.com"),
            new AtomicReference<>(), false));
    TestHelper.expectNPE(() -> uut.createFor(mock(EventOutput.class), null,
            new AtomicReference<>(), false));
    TestHelper.expectNPE(() -> uut.createFor(mock(EventOutput.class), new URI("http://ibm.com"),
            null, false));

}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:28,代码来源:FactsObserverFactory0Test.java

示例15: testGetServerSentEvents

import org.glassfish.jersey.media.sse.EventOutput; //导入依赖的package包/类
@Test
public void testGetServerSentEvents() throws Exception {
    SubscriptionRequestParams subscriptionRequestParams = mock(SubscriptionRequestParams.class);
    SubscriptionRequestTO subTo = mock(SubscriptionRequestTO.class);
    when(subscriptionRequestParams.toRequest(anyBoolean())).thenReturn(subTo);
    FactsObserver value = mock(FactsObserver.class);
    when(eventObserverFactory.createFor(any(), any(), any(), anyBoolean())).thenReturn(value);
    URI baseUri = new URI("http://localhost:8080");
    when(linkFactoryContext.getBaseUri()).thenReturn(baseUri);
    EventOutput returnValue = uut.getServerSentEvents(subscriptionRequestParams);

    verify(eventObserverFactory).createFor(eq(returnValue), eq(baseUri), any(), eq(false));
    verify(factStore).subscribe(subTo, value);
}
 
开发者ID:uweschaefer,项目名称:factcast,代码行数:15,代码来源:FactsResource0Test.java


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