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


Java Message类代码示例

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


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

示例1: onCategoryMessage

import org.atmosphere.config.service.Message; //导入依赖的package包/类
@Message(encoders = {JacksonEncoder.class}, decoders = {CategoryDecoder.class})
public Category onCategoryMessage(Category message) throws IOException {

    if (!resources.containsKey(message.getClient())) {
        resources.put(message.getClient(), message.getUuid());
        return new Category(message.getClient(), " subscribe to category " + categoryName, resources.keySet(), getCategories(factory.lookupAll()));
    }

    if (message.getMessage().contains("disconnecting")) {
        resources.remove(message.getClient());
        
        return new Category(message.getClient(), " disconnected from category " + categoryName, resources.keySet(), getCategories(factory.lookupAll()));
    }

    message.setUsers(resources.keySet());
    logger.info("{} just send {}", message.getClient(), message.getMessage());
    return new Category(message.getClient(), message.getMessage(), resources.keySet(), getCategories(factory.lookupAll()));
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:19,代码来源:DictumDelivery.java

示例2: onMessage

import org.atmosphere.config.service.Message; //导入依赖的package包/类
@Message(decoders = {ActivityDTOJacksonDecoder.class})
public void onMessage(AtmosphereResource atmosphereResource, ActivityDTO activityDTO) throws IOException {
    if (activityDTO.getUserLogin() != null){
        AtmosphereRequest request = atmosphereResource.getRequest();
        activityDTO.setUuid(atmosphereResource.uuid());
        activityDTO.setIpAddress(request.getRemoteAddr());
        activityDTO.setTime(dateTimeFormatter.print(Calendar.getInstance().getTimeInMillis()));
        String json = jsonMapper.writeValueAsString(activityDTO);
        log.debug("Sending user tracking data {}", json);
        b.broadcast(json);
    }
}
 
开发者ID:sanketbajoria,项目名称:jittrackGTS,代码行数:13,代码来源:ActivityService.java

示例3: onMessage

import org.atmosphere.config.service.Message; //导入依赖的package包/类
@Message(decoders = {ActivityDTOJacksonDecoder.class})
public void onMessage(AtmosphereResource atmosphereResource, ActivityDTO activityDTO) throws IOException {
    AtmosphereRequest request = atmosphereResource.getRequest();
    activityDTO.setUuid(atmosphereResource.uuid());
    activityDTO.setIpAddress(request.getRemoteAddr());
    activityDTO.setTime(dateTimeFormatter.print(Calendar.getInstance().getTimeInMillis()));
    String json = jsonMapper.writeValueAsString(activityDTO);
    log.debug("Sending user tracking data {}", json);
    b.broadcast(json);
}
 
开发者ID:thpham,项目名称:ithings-demo,代码行数:11,代码来源:ActivityService.java

示例4: onMessage

import org.atmosphere.config.service.Message; //导入依赖的package包/类
@Message(decoders = {ActivityDTOJacksonDecoder.class})
public void onMessage(AtmosphereResource atmosphereResource, ActivityDTO activityDTO) throws IOException {
    AtmosphereRequest request = atmosphereResource.getRequest();
    activityDTO.setSessionId(request.getSession().getId());
    activityDTO.setIpAddress(request.getRemoteAddr());
    activityDTO.setTime(dateTimeFormatter.print(Calendar.getInstance().getTimeInMillis()));
    String json = jsonMapper.writeValueAsString(activityDTO);
    log.debug("Sending user tracking data {}", json);
    for (AtmosphereResource trackerResource : b.getAtmosphereResources()) {
        trackerResource.getResponse().write(json);
    }
}
 
开发者ID:ravikiran438,项目名称:cevent-app,代码行数:13,代码来源:ActivityService.java

示例5: onMessage

import org.atmosphere.config.service.Message; //导入依赖的package包/类
@Message(encoders = {GsonEncoder.class}, decoders = {GsonDecoder.class})
public Data onMessage(Data data) throws IOException {
    data.setTime(new Date().getTime());
    logger.info("{} just send {}", data.getAuthor(), data.getMessage());
    return data;
}
 
开发者ID:janScheible,项目名称:knorxx,代码行数:7,代码来源:ChatQueue.java

示例6: onMessage

import org.atmosphere.config.service.Message; //导入依赖的package包/类
@Message(encoders = {DataGsonEncoder.class}, decoders = {DataGsonDecoder.class})
public Data onMessage(Data data) throws IOException {
    data.setTime(new Date().getTime());
    logger.info("{} just send {}", data.getAuthor(), data.getMessage());
    return data;
}
 
开发者ID:janScheible,项目名称:knorxx,代码行数:7,代码来源:ChatQueue.java

示例7: onMessage

import org.atmosphere.config.service.Message; //导入依赖的package包/类
/**
 * Simple annotated class that demonstrate how {@link org.atmosphere.config.managed.Encoder} and {@link org.atmosphere.config.managed.Decoder
 * can be used.
 *
 * @param message an instance of {@link ChatMessage }
 * @return the chat message
 * @throws IOException
 */
@Message(encoders = {ChatMessageEncoderDecoder.class}, decoders = {ChatMessageEncoderDecoder.class})
public final ChatMessage onMessage(final ChatMessage message) throws IOException{
    logger.info("{} just send {}", message.getAuthor(), message.getMessage());
    return message;
}
 
开发者ID:spyboost,项目名称:atmosphere-chat-angular,代码行数:14,代码来源:Chat.java


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