Package com.sun.jersey.api.client

Examples of com.sun.jersey.api.client.UniformInterfaceException


        assertThat(successfullResult.getResult().get(), is("Hello"));
    }

    @Test
    public void testFallback(){
        UniformInterfaceException exception = new UniformInterfaceException("failed request", mock(ClientResponse.class));
        ClientException clientException = new ClientException(exception);
        ClientResponseResult<String> failedResult = ClientResponseResult.clientFailure(clientException);

        assertThat(failedResult.isSuccess(), is(false));
        assertThat(failedResult.getFallbackException(), is(clientException));
View Full Code Here


    try {
      if (clientResponse.getStatus() < 300) {
        final RepoMD repomd = new RepoMD(clientResponse.getEntityInputStream());
        return repomd.getLocation(metadataType.getType());
      }
      throw getNexusClient().convert(new UniformInterfaceException(clientResponse));
    }
    finally {
      clientResponse.close();
    }
  }
View Full Code Here

        clientResponse.setEntityInputStream(
            new CompressionAdapter(compression).adapt(clientResponse.getEntityInputStream())
        );
        return clientResponse.getEntity(returnType);
      }
      throw getNexusClient().convert(new UniformInterfaceException(clientResponse));
    }
    finally {
      clientResponse.close();
    }
  }
View Full Code Here

      if (Response.Status.ACCEPTED.getStatusCode() == response.getStatus()) {
        throw new EventsAreStillBeingHandledException(actualTimeout);
      }
      else if (!response.getClientResponseStatus().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
        throw getNexusClient().convert(new UniformInterfaceException(response));
      }
    }
    catch (ClientHandlerException e) {
      throw getNexusClient().convert(e);
    }
View Full Code Here

      if (Response.Status.ACCEPTED.getStatusCode() == response.getStatus()) {
        throw new TasksAreStillRunningException(actualTimeout);
      }
      else if (!response.getClientResponseStatus().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
        throw getNexusClient().convert(new UniformInterfaceException(response));
      }
    }
    catch (ClientHandlerException e) {
      throw getNexusClient().convert(e);
    }
View Full Code Here

      if (Response.Status.ACCEPTED.getStatusCode() == response.getStatus()) {
        throw new RoutingJobsAreStillRunningException(actualTimeout);
      }
      else if (!response.getClientResponseStatus().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {
        throw getNexusClient().convert(new UniformInterfaceException(response));
      }
    }
    catch (ClientHandlerException e) {
      throw getNexusClient().convert(e);
    }
View Full Code Here

              }
            }
        );
      }
      if (!Response.Status.Family.SUCCESSFUL.equals(response.getClientResponseStatus().getFamily())) {
        throw nexusClient.convert(new UniformInterfaceException(response));
      }
      response.close();
      return response;
    }
    catch (ClientHandlerException e) {
View Full Code Here

                  }
                } catch (InterruptedException ignore) {
                } catch (ExecutionException e) {
                  if (e.getCause() != null){
                    if (e.getCause().getClass() == UniformInterfaceException.class){
                        UniformInterfaceException ue = (UniformInterfaceException)e.getCause();
                        ClientResponse cr = ue.getResponse();         
                        if (actionRequester == null){      
                        toaster.showToaster(cr.getEntity(String.class), true);
                        } else {
                            actionRequester.completeBackgroundAction(
                                Status.NO_CONTENT,
View Full Code Here

                toaster.showToaster(authorAcquired);
                } catch (InterruptedException ignore) {
                } catch (ExecutionException e) {
                  if (e.getCause() != null){
                    if (e.getCause().getClass() == UniformInterfaceException.class){
                        UniformInterfaceException ue = (UniformInterfaceException)e.getCause();
                        ClientResponse cr = ue.getResponse();         
                        toaster.showToaster(cr.getEntity(String.class), true);
                        } else if (e.getCause().getClass() == ClientHandlerException.class)  {
                          toaster.showToaster(Const.ConnectionFailedMessage, true);
                        } else {
                          processExecutionException(e);
View Full Code Here

                } catch (InterruptedException ignore) {
                } catch (CancellationException ignore){                 
                } catch (ExecutionException e) {
                  if (e.getCause() != null){
                    if (e.getCause().getClass() == UniformInterfaceException.class){
                        UniformInterfaceException ue = (UniformInterfaceException)e.getCause();
                        ClientResponse cr = ue.getResponse();
                        if (cr.getClientResponseStatus() == Status.UNAUTHORIZED){
                          new RegisterForFavoriteAction(thought, favoriteManager, parentFrame);
                        } else {
                          favoriteManager.completeBackgroundAction(cr.getClientResponseStatus(), cr.getEntity(String.class));
                        }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.UniformInterfaceException

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.