Package org.graylog2.restclient.models.api.results

Examples of org.graylog2.restclient.models.api.results.MessageResult


    public Response status() {
        /*
         * IMPORTANT!! When implementing permissions for radio: This must be
         *             accessible without authorization. LBs don't do that.
         */
        final LoadBalancerStatus lbStatus = serverStatus.getLifecycle().getLoadbalancerStatus();

        final Response.Status status = lbStatus == LoadBalancerStatus.ALIVE
                ? Response.Status.OK : Response.Status.SERVICE_UNAVAILABLE;

        return Response.status(status)
                .entity(lbStatus.toString().toUpperCase())
                .build();
    }
View Full Code Here


    @PUT @Timed
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/override/{status}")
    public Response override(@PathParam("status") String status) {
        final LoadBalancerStatus lbStatus;
        try {
            lbStatus = LoadBalancerStatus.valueOf(status.toUpperCase());
        } catch(IllegalArgumentException e) {
            throw new WebApplicationException(e, Response.Status.BAD_REQUEST);
        }
View Full Code Here

    @GET @Timed
    @Produces(MediaType.TEXT_PLAIN)
    @ApiOperation(value = "Get status of this graylog2-server node for load balancers. " +
            "Returns either ALIVE with HTTP 200 or DEAD with HTTP 503.")
    public Response status() {
        final LoadBalancerStatus lbStatus = serverStatus.getLifecycle().getLoadbalancerStatus();

        Response.Status status = lbStatus == LoadBalancerStatus.ALIVE
                ? Response.Status.OK : Response.Status.SERVICE_UNAVAILABLE;

        return Response.status(status)
                .entity(lbStatus.toString().toUpperCase())
                .build();
    }
View Full Code Here

                new DateTime((long) fields.remove("timestamp"), DateTimeZone.UTC)
        );
        final List<Stream> streamList = Lists.newArrayList();

        for (String id : bean.getStreams()) {
            Stream stream = getStream(id);

            if (stream != null) {
                streamList.add(stream);
            }
        }
View Full Code Here

        LOG.debug("Loaded modules: " + pluginModules);

        GuiceInstantiationService instantiationService = new GuiceInstantiationService();
        List<Module> bindingsModules = getBindingsModules(instantiationService,
                new RadioBindings(configuration),
                new RadioInitializerBindings());
        LOG.debug("Adding plugin modules: " + pluginModules);
        bindingsModules.addAll(pluginModules);
        final Injector injector = GuiceInjectorHolder.createInjector(bindingsModules);
        instantiationService.setInjector(injector);
View Full Code Here

        LOG.debug("Loaded modules: " + pluginModules);

        GuiceInstantiationService instantiationService = new GuiceInstantiationService();
        List<Module> bindingsModules = getBindingsModules(instantiationService,
                new RadioBindings(configuration),
                new RadioInitializerBindings());
        LOG.debug("Adding plugin modules: " + pluginModules);
        bindingsModules.addAll(pluginModules);
        final Injector injector = GuiceInjectorHolder.createInjector(bindingsModules);
        instantiationService.setInjector(injector);
View Full Code Here

    @ApiOperation(value = "Ping - Accepts pings of graylog2-radio nodes.",
            notes = "Every graylog2-radio node is regularly pinging to announce that it is active.")
    @Path("/{radioId}/ping")
    public Response ping(@ApiParam(name = "JSON body", required = true) String body,
                         @ApiParam(name = "radioId", required = true) @PathParam("radioId") String radioId) {
        PingRequest pr;

        try {
            pr = objectMapper.readValue(body, PingRequest.class);
        } catch(IOException e) {
            LOG.error("Error while parsing JSON", e);
View Full Code Here

    @Test
    public void testGetMessage() throws Exception {
        final Request request = new RequestBuilder()
                .setUrl("http://user:password@localhost:1234/some/path?query=foo#fragment")
                .build();
        final APIException apiException = new APIException(request, (Response) null);

        final String message = apiException.getMessage();
        assertThat(message, not(new Contains(":password")));
        assertThat(message, new Contains("user@"));
    }
View Full Code Here

        });
        modules.add(new ModelFactoryModule());
        injector = Guice.createInjector(modules);

        // start the services that need starting
        final ApiClient api = injector.getInstance(ApiClient.class);
        api.start();
        injector.getInstance(ServerNodesRefreshService.class).start();
        // TODO replace with custom AuthenticatedAction filter
        RedirectAuthenticator.userService = injector.getInstance(UserService.class);
        RedirectAuthenticator.sessionService = injector.getInstance(SessionService.class);
View Full Code Here

            user.setSubject(new Subject.Builder(SecurityUtils.getSecurityManager())
                    .principals(new SimplePrincipalCollection(user.getName(), "REST realm"))
                    .authenticated(true)
                    .buildSubject());
        } catch (IOException e) {
            throw new Graylog2ServerUnavailableException("Could not connect to Graylog2 Server.", e);
        } catch (APIException e) {
            if (e.getCause() != null && e.getCause() instanceof ConnectException) {
                throw new Graylog2ServerUnavailableException("Could not connect to Graylog2 Server.", e);
            } else {
                throw new AuthenticationException("Unable to communicate with graylog2-server backend", e);
            }
        } catch (PlayException e) {
            log.error("Misconfigured play application. Please make sure your application.secret is longer than 16 characters!", e);
View Full Code Here

TOP

Related Classes of org.graylog2.restclient.models.api.results.MessageResult

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.