小编mej*_*jas的帖子

找不到Java类的消息正文编写器...和MIME媒体类型text/html

我正在使用jms/atmosphere框架在两个应用程序之间进行通信.其中一个应用程序是主题的消息生成器,发送以下类型的自定义对象:

    @XmlRootElement
    public class A implements Serializable{
    public A(){}

    /* some private properties */

   }
Run Code Online (Sandbox Code Playgroud)

另一方面,不止一个消费者正在监听该主题并根据ID进行不同的订阅.

    @GET
    @Produces({MediaType.APPLICATION_JSON})
    public SuspendResponse<A> subscribe() {
    return new SuspendResponse.SuspendResponseBuilder<A>()
            .broadcaster(topic)
            .outputComments(true)
            .addListener(new EventsLogger()).build();
    } 
   @Override
public void incomingBroadcast() {
    try {
        String id = getID();
        if (id.startsWith("/*")) {
            id = "atmosphere";
        }

        logger.info("Looking up Connection Factory {}", FACTORY_NAME);
        Context ctx = new InitialContext();
        ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup(FACTORY_NAME);

        logger.info("Looking up topic: {}", TOPIC_NAME);
        Topic topic = (Topic) ctx.lookup(TOPIC_NAME);

        connection = connectionFactory.createConnection();
        session = connection.createSession(false, …
Run Code Online (Sandbox Code Playgroud)

java json glassfish jersey atmosphere

15
推荐指数
2
解决办法
3万
查看次数

标签 统计

atmosphere ×1

glassfish ×1

java ×1

jersey ×1

json ×1