/** * Extract text from response */ public String extractText(final Response response) throws IOException { final Representation entity = response.getEntity(); assertThat(entity, notNullValue()); final String responseText = entity.getText(); return responseText; }
public NexusArtifact searchForSHA1( String sha1 ) throws Exception { String serviceURI = "service/local/identify/sha1/" + sha1; String responseText = RequestFacade.doGetRequest( serviceURI ).getEntity().getText(); log.debug( "responseText: \n" + responseText ); if ( StringUtils.isEmpty( responseText ) ) { return null; } return (NexusArtifact) xstream.fromXML( responseText ); }
public RoleResource getResourceFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); LOG.debug(" getResourceFromResponse: " + responseString); return getResourceFromResponse(responseString); }
public RepositoryTargetResource getResourceFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); return this.getResourceFromResponse(responseString); }
public RepositoryRouteResource getResourceFromResponse( Response response ) throws IOException { String responseString = response.getEntity().getText(); LOG.debug( "responseText: " + responseString ); Assert.assertFalse( "Response text was empty.", StringUtils.isEmpty( responseString ) ); XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType ); RepositoryRouteResourceResponse resourceResponse = (RepositoryRouteResourceResponse) representation.getPayload( new RepositoryRouteResourceResponse() ); return resourceResponse.getData(); }
public String getString(Reference uriReference, MediaType mediaType) throws RESTException { Response response = context.get(uriReference, mediaType); try { return response.getEntity().getText(); } catch (IOException e) { throw new RESTException("Could not receive " + uriReference, e); } }
/** * Use {@link #getResourceFromText(String)} instead. */ @Deprecated public RepositoryRouteResource getResourceFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); LOG.debug("responseText: " + responseString); Assert.assertTrue(response.getStatus() + "\n" + responseString, response.getStatus().isSuccess()); return getResourceFromText(responseString); }
public UserResource getResourceFromResponse( Response response ) throws IOException { String responseString = response.getEntity().getText(); LOG.debug( " getResourceFromResponse: " + responseString ); XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType ); // this UserResourceRequest resourceResponse = (UserResourceRequest) representation.getPayload( new UserResourceRequest() ); return resourceResponse.getData(); }
public RepositoryResource getResourceFromResponse( Response response ) throws IOException { String responseString = response.getEntity().getText(); LOG.debug( " getResourceFromResponse: " + responseString ); XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType ); RepositoryResourceResponse resourceResponse = (RepositoryResourceResponse) representation .getPayload( new RepositoryResourceResponse() ); return (RepositoryResource) resourceResponse.getData(); }
public RepositoryBaseResource getRepositoryBaseResourceFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); LOG.debug(" getRepositoryBaseResourceFromResponse: " + responseString); XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType); RepositoryResourceResponse resourceResponse = (RepositoryResourceResponse) representation.getPayload(new RepositoryResourceResponse()); return resourceResponse.getData(); }
public RepositoryBaseResource getRepositoryBaseResourceFromResponse( Response response ) throws IOException { String responseString = response.getEntity().getText(); LOG.debug( " getRepositoryBaseResourceFromResponse: " + responseString ); XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType ); RepositoryResourceResponse resourceResponse = (RepositoryResourceResponse) representation.getPayload( new RepositoryResourceResponse() ); return resourceResponse.getData(); }
public UserResource getResourceFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); LOG.debug(" getResourceFromResponse: " + responseString); XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType); // this UserResourceRequest resourceResponse = (UserResourceRequest) representation.getPayload(new UserResourceRequest()); return resourceResponse.getData(); }
public List<PrivilegeStatusResource> getList( ) throws IOException { Response response = this.sendMessage( Method.GET, null ); if ( !response.getStatus().isSuccess() ) { Assert.fail( "Could not get Privilege: " + response.getStatus() +"\n" + response.getEntity().getText()); } return this.getResourceListFromResponse( response ); }
public List<PrivilegeStatusResource> getResourceListFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType); PrivilegeListResourceResponse resourceResponse = (PrivilegeListResourceResponse) representation.getPayload(new PrivilegeListResourceResponse()); return resourceResponse.getData(); }
public PrivilegeStatusResource getResourceFromResponse( Response response ) throws IOException { String responseString = response.getEntity().getText(); XStreamRepresentation representation = new XStreamRepresentation( xstream, responseString, mediaType ); PrivilegeStatusResourceResponse resourceResponse = (PrivilegeStatusResourceResponse) representation.getPayload( new PrivilegeStatusResourceResponse() ); return resourceResponse.getData(); }
public PrivilegeStatusResource getResourceFromResponse(Response response) throws IOException { String responseString = response.getEntity().getText(); XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType); PrivilegeStatusResourceResponse resourceResponse = (PrivilegeStatusResourceResponse) representation.getPayload(new PrivilegeStatusResourceResponse()); return resourceResponse.getData(); }
@SuppressWarnings( "unchecked" ) public List<NexusArtifact> searchFor( Map<String, String> queryArgs ) throws Exception { String responseText = doSearchFor( queryArgs ).getEntity().getText(); XStreamRepresentation representation = new XStreamRepresentation( xstream, responseText, MediaType.APPLICATION_XML ); SearchResponse searchResponde = (SearchResponse) representation.getPayload( new SearchResponse() ); return searchResponde.getData(); }
@SuppressWarnings( "unchecked" ) public static List<NexusArtifact> searchClassname( String classname ) throws Exception { String responseText = doSearchForClassName( classname ).getEntity().getText(); XStreamRepresentation representation = new XStreamRepresentation( xstream, responseText, MediaType.APPLICATION_XML ); SearchResponse searchResponde = (SearchResponse) representation.getPayload( new SearchResponse() ); return searchResponde.getData(); }
public PrivilegeStatusResource getPrivilegeResource(String id) throws IOException { Response response = this.sendMessage(Method.GET, null, id); if (!response.getStatus().isSuccess()) { Assert.fail("Could not get Privilege: " + response.getStatus() + "\n" + response.getEntity().getText()); } return this.getResourceFromResponse(response); }
public List<PrivilegeStatusResource> getList() throws IOException { Response response = this.sendMessage(Method.GET, null); if (!response.getStatus().isSuccess()) { Assert.fail("Could not get Privilege: " + response.getStatus() + "\n" + response.getEntity().getText()); } return this.getResourceListFromResponse(response); }