Package org.glassfish.jersey.media.sse

Examples of org.glassfish.jersey.media.sse.EventOutput


            throw new RuntimeException(ex);
        }
    }

    protected Response executeCommandAsSse(ParameterMap data) {
        EventOutput ec = ResourceUtil.runCommandWithSse(commandName, data, null, null);
        return Response.status(HttpURLConnection.HTTP_OK).entity(ec).build();
    }
View Full Code Here


    @GET
    @Path("events")
    @Produces(SseFeature.SERVER_SENT_EVENTS)
    public EventOutput itemEvents() {
        final EventOutput eventOutput = new EventOutput();
        BROADCASTER.add(eventOutput);
        return eventOutput;
    }
View Full Code Here

            throw new RuntimeException(ex);
        }
    }

    protected Response executeCommandAsSse(ParameterMap data) {
        EventOutput ec = ResourceUtil.runCommandWithSse(commandName, data, null, null);
        return Response.status(HttpURLConnection.HTTP_OK).entity(ec).build();
    }
View Full Code Here

            }
        }
    }

    protected Response executeCommandAsSse(ParameterMap data) {
        EventOutput ec = ResourceUtil.runCommandWithSse(commandName, data, null, null);
        return Response.status(HttpURLConnection.HTTP_OK).entity(ec).build();
    }
View Full Code Here

            }
        }
    }

    protected Response executeCommandAsSse(ParameterMap data) {
        EventOutput ec = ResourceUtil.runCommandWithSse(commandName, data, null, null);
        return Response.status(HttpURLConnection.HTTP_OK).entity(ec).build();
    }
View Full Code Here

        commandInvocation
                .outbound(new RestPayloadImpl.Outbound(false))
                .subject(getSubject())
                .managedJob()
                .parameters(params);
        final EventOutput ec = new EventOutput();
        AdminCommandListener listener = new AdminCommandListener() {
                    @Override
                    public void onAdminCommandEvent(String name, Object event) {
                        if (name == null || name.startsWith("client.")) {
                            return; //Prevent events from client to be send back to client
                        }
                        if (event == null) {
                            return;
                        }
                        if (ec.isClosed()) {
                            return;
                        }
                        OutboundEvent outEvent = new OutboundEvent.Builder()
                                                    .name(name)
                                                    .mediaType(MediaType.APPLICATION_JSON_TYPE)
                                                    .data(event.getClass(), event)
                                                    .build();
                        try {
                            ec.write(outEvent);
                        } catch (Exception ex) {
                            if (logger.isLoggable(Level.FINE)) {
                                logger.log(Level.FINE, strings.getLocalString("sse.writeevent.exception",
                                        "Can not write object as SSE (type = {0})",
                                        event.getClass().getName()), ex);
View Full Code Here

            throw new RuntimeException(ex);
        }
    }

    protected Response executeCommandAsSse(ParameterMap data) {
        EventOutput ec = ResourceUtil.runCommandWithSse(commandName, data, null, null);
        return Response.status(HttpURLConnection.HTTP_OK).entity(ec).build();
    }
View Full Code Here

    @GET
    @Path("events")
    @Produces(SseFeature.SERVER_SENT_EVENTS)
    public EventOutput itemEvents() {
        final EventOutput eventOutput = new EventOutput();
        BROADCASTER.add(eventOutput);
        return eventOutput;
    }
View Full Code Here

     */
    @GET
    @Produces(SseFeature.SERVER_SENT_EVENTS)
    public EventOutput getMessageStream() {
        LOGGER.info("--> SSE connection received.");
        final EventOutput eventOutput = new EventOutput();
        broadcaster.add(eventOutput);
        return eventOutput;
    }
View Full Code Here

        }
    }

    protected Response actSse(final CommandInvoker invoker) {
        final boolean includeResourceLinks = includeResourceLinks();
        EventOutput eo = executeSseCommand(getSubject(), invoker.getCommand(), invoker.getParams(), new ResponseBodyBuilderImpl() {
            @Override
            protected ResponseBody success(ActionReport report) {
                invoker.setResult(report.getExtraProperties());
                SseResponseBody responseBody = new SseResponseBody();
                responseBody.addSuccess(invoker.getSuccessMessage());
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.media.sse.EventOutput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.