Example usage for org.springframework.web.client ResourceAccessException getMessage

List of usage examples for org.springframework.web.client ResourceAccessException getMessage

Introduction

In this page you can find the example usage for org.springframework.web.client ResourceAccessException getMessage.

Prototype

@Override
@Nullable
public String getMessage() 

Source Link

Document

Return the detail message, including the message from the nested exception if there is one.

Usage

From source file:com.tikal.tallerWeb.control.imp.LoginControllerImp.java

@Override
public boolean login(String usuario, char[] password, String otp) {
    try {//from   w  w  w  .j ava  2 s  .c om
        AuthenticationRequest request = new AuthenticationRequest();
        request.setUser(usuario);
        request.setPassword(new String(password));
        if (!StringUtils.isEmpty(otp)) {
            request.setOtp(Integer.valueOf(otp));
        }
        SessionInfo info = loginService.login(request);
        //            tallerFactory.setUsername(info.getUser());
        //            tallerFactory.setPassword(info.getToken());
        //            tallerFactory.setErrorHandler(errorHandler);
        //            tallerFactory.init();
        //
        //            customerFactory.setUsername(info.getUser());
        //            customerFactory.setPassword(info.getToken());
        //            customerFactory.setErrorHandler(errorHandler);
        //            customerFactory.init();
        if (parent != null) {
            parent.afterLogin();
        }
        iniciado = false;
        return true;
    } catch (ResourceAccessException ex) {
        LoginControllerImp.LOGGER.error("error en login" + ex.getMessage());
    } catch (HttpClientErrorException e) {
        mensajesControl.reportaError("Usuario o pasword no validos");
    }
    return false;
}

From source file:org.nekorp.workflow.desktop.control.imp.NuevoServicioWizardImp.java

@Override
public void loadAuto(Auto origen) {
    try {//ww  w . j a  va 2  s .  co  m
        autoBridge.load(origen, servicio.getAuto());
    } catch (ResourceAccessException e) {
        NuevoServicioWizardImp.LOGGER.error("error al cargar autos" + e.getMessage());
        this.mensajesControl.reportaError("Error de comunicacion con el servidor");
    }
}

From source file:org.nekorp.workflow.desktop.control.imp.NuevoServicioWizardImp.java

@Override
public void loadCliente(Customer origen) {
    try {/*from w  w  w  .  ja v  a2 s . c o m*/
        if (origen.getId() != null) {
            Customer customer = clienteDAO.cargar(origen.getId());
            clienteBridge.load(customer, servicio.getCliente());
        } else {
            clienteBridge.load(origen, servicio.getCliente());
        }
    } catch (ResourceAccessException e) {
        NuevoServicioWizardImp.LOGGER.error("error al cargar clientes" + e.getMessage());
        this.mensajesControl.reportaError("Error de comunicacion con el servidor");
    }
}

From source file:org.nekorp.workflow.desktop.control.imp.NuevoServicioWizardImp.java

@Override
public List<Auto> getAutos() {
    try {/*from   w  w w  .  j a  v  a2 s.c om*/
        return autoDAO.consultaTodos();
    } catch (ResourceAccessException e) {
        NuevoServicioWizardImp.LOGGER.error("error al cargar todos los autos" + e.getMessage());
        this.mensajesControl.reportaError("Error de comunicacion con el servidor");
        return new LinkedList<>();
    }
}

From source file:org.nekorp.workflow.desktop.control.imp.NuevoServicioWizardImp.java

@Override
public Customer[] getClientes() {
    try {//from  www.j  av a2s  .  c  o  m
        return clienteDAO.consultaTodos();
    } catch (ResourceAccessException e) {
        NuevoServicioWizardImp.LOGGER.error("error al cargar todos los clientes" + e.getMessage());
        this.mensajesControl.reportaError("Error de comunicacion con el servidor");
        return new Customer[0];
    }
}

From source file:org.nekorp.workflow.desktop.control.imp.NuevoServicioWizardImp.java

@Override
public void buscarCliente(final String name, final Callback<Customer[]> cmd) {
    try {//from  w ww.ja  v  a  2 s. c om
        clienteDAO.buscar(name, cmd);
    } catch (ResourceAccessException e) {
        NuevoServicioWizardImp.LOGGER.error("error al buscar un cliente por nombre" + e.getMessage());
        this.mensajesControl.reportaError("Error de comunicacion con el servidor");
    }
}

From source file:org.nekorp.workflow.desktop.control.imp.NuevoServicioWizardImp.java

@Override
public void buscarAuto(String numeroSerie, Callback<List<Auto>> cmd) {
    try {/*  ww w .  ja va2s  .c  o  m*/
        autoDAO.buscar(numeroSerie, cmd);
    } catch (ResourceAccessException e) {
        NuevoServicioWizardImp.LOGGER.error("error al buscar un auto por numero de serie" + e.getMessage());
        this.mensajesControl.reportaError("Error de comunicacion con el servidor");
    }
}

From source file:org.nekorp.workflow.desktop.control.imp.NuevoServicioWizardImp.java

@Override
public void nuevoServicio() {
    try {//from   www. ja v a  2  s.c  o  m
        //como es parte del wizard se asume que el servicio es nuevo.
        Servicio nuevoServicio = new Servicio();
        servicioBridge.unload(servicio, nuevoServicio);
        //primero se tratan de guardar los datos del cliente y auto.
        ClienteMxPojo nuevoCliente = new ClienteMxPojo();
        clienteBridge.unload(servicio.getCliente(), nuevoCliente);
        clienteDAO.guardar(nuevoCliente);
        //el cliente nuevo o no, al terminar ya debe tener id
        nuevoServicio.setIdCliente(nuevoCliente.getId());
        //datos del auto
        Auto nuevoAuto = new Auto();
        autoBridge.unload(servicio.getAuto(), nuevoAuto);
        autoDAO.guardar(nuevoAuto);
        nuevoServicio.setIdAuto(nuevoAuto.getNumeroSerie());
        //se guarda el nuevo servicio
        servicioDAO.guardar(nuevoServicio);
        registrarInicioServicio();
        //la bitacora del servicio esta vacia por que es nuevo.
        List<Evento> bitacora = new LinkedList<>();
        //se copian los datos de la bitacora
        bitacoraBridge.unload(servicio.getBitacora(), bitacora);
        bitacoraDAO.guardar(nuevoServicio.getId(), bitacora);
        worflowApp.cargaServicio(nuevoServicio.getId());
    } catch (ResourceAccessException e) {
        NuevoServicioWizardImp.LOGGER.error("error al guardar el nuevo servicio" + e.getMessage());
        this.mensajesControl.reportaError("Error de comunicacion con el servidor");
    }
}

From source file:de.zib.gndms.gndmc.utils.HTTPGetter.java

private EnhancedResponseExtractor get(final HttpMethod method, final String url,
        final RequestCallback requestCallback) throws NoSuchAlgorithmException, KeyManagementException {
    CustomSSLContextRequestFactory requestFactory = new CustomSSLContextRequestFactory(sslContext);
    RestTemplate rt = new RestTemplate(requestFactory);
    requestFactory.setConnectTimeout(getTimeout());
    requestFactory.setReadTimeout(getTimeout());

    try {//from  www .j a  v a 2 s .  c  om
        return rt.execute(url, method, requestCallback, new ResponseExtractor<EnhancedResponseExtractor>() {

            // call the EnhancedResponseExtractor registered for this response.statusCode
            @Override
            public EnhancedResponseExtractor extractData(ClientHttpResponse response) throws IOException {
                int statusCode = response.getStatusCode().value();

                EnhancedResponseExtractor enhancedResponseExtractor = extractorMap.get(statusCode);
                if (null == enhancedResponseExtractor)
                    enhancedResponseExtractor = extractorMap.get(statusCode / 100);
                if (null == enhancedResponseExtractor)
                    enhancedResponseExtractor = extractorMap.get(0);
                if (null == enhancedResponseExtractor)
                    throw new IllegalStateException(
                            "No default ResponseExtractor registered. THIS IS NOT HAPPENING :/");

                enhancedResponseExtractor.extractData(url, response);

                return enhancedResponseExtractor;
            }

        });
    } catch (ResourceAccessException e) {
        throw new RuntimeException("Could not connect to " + url + ": " + e.getMessage(), e);
    }
}

From source file:com.bcknds.demo.oauth2.security.ClientCredentialAuthenticationTests.java

/**
 * Test insecure endpoint without authentication
 *//*from  w  ww. j  ava 2  s  . com*/
@Test
public void testInsecureEndpointNoAuthentication() {
    RestTemplate restTemplate = new RestTemplate();
    ResponseEntity<String> response = null;
    try {
        response = restTemplate.getForEntity(INSECURE_ENDPOINT, String.class);
        assertEquals("You are home.", response.getBody());
        assertEquals(HttpStatus.OK, response.getStatusCode());
    } catch (ResourceAccessException ex) {
        fail("It appears that the server may not be running. Please start it before running tests");
    } catch (Exception ex) {
        fail(ex.getMessage());
    }
}