/** * IMPORTANT: Make sure to release the Response in a finally block when you are done with it. */ public Response sendMessage( Method method, RepositoryBaseResource resource, String id ) throws IOException { if ( resource != null && resource.getProviderRole() == null ) { if ( "virtual".equals( resource.getRepoType() ) ) { resource.setProviderRole( ShadowRepository.class.getName() ); } else { resource.setProviderRole( Repository.class.getName() ); } } XStreamRepresentation representation = new XStreamRepresentation( xstream, "", mediaType ); String idPart = ( method == Method.POST ) ? "" : "/" + id; String serviceURI = SERVICE_PART + idPart; RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse(); repoResponseRequest.setData( resource ); // now set the payload representation.setPayload( repoResponseRequest ); LOG.debug( "sendMessage: " + representation.getText() ); return nexusRestClient.sendMessage( serviceURI, method, representation ); }
/** * IMPORTANT: Make sure to release the Response in a finally block when you are done with it. */ public Response sendMessage(Method method, RepositoryBaseResource resource, String id) throws IOException { if (resource != null && resource.getProviderRole() == null) { if ("virtual".equals(resource.getRepoType())) { resource.setProviderRole(ShadowRepository.class.getName()); } else { resource.setProviderRole(Repository.class.getName()); } } XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType); String idPart = (method == Method.POST) ? "" : "/" + id; String serviceURI = SERVICE_PART + idPart; RepositoryResourceResponse repoResponseRequest = new RepositoryResourceResponse(); repoResponseRequest.setData(resource); // now set the payload representation.setPayload(repoResponseRequest); LOG.debug("sendMessage: " + representation.getText()); return nexusRestClient.sendMessage(serviceURI, method, representation); }
repoRes.setProviderRole(template.getRepositoryProviderRole());
repoRes.setProviderRole( template.getRepositoryProviderRole() );