Java Code Examples for org.sonatype.nexus.repository.view.Payload#getContentType()
The following examples show how to use
org.sonatype.nexus.repository.view.Payload#getContentType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComposerJsonProcessor.java From nexus-repository-composer with Eclipse Public License 1.0 | 6 votes |
/** * Rewrites the provider JSON so that source entries are removed and dist entries are pointed back to Nexus. */ public Payload rewriteProviderJson(final Repository repository, final Payload payload) throws IOException { Map<String, Object> json = parseJson(payload); if (json.get(PACKAGES_KEY) instanceof Map) { Map<String, Object> packagesMap = (Map<String, Object>) json.get(PACKAGES_KEY); for (String packageName : packagesMap.keySet()) { Map<String, Object> packageVersions = (Map<String, Object>) packagesMap.get(packageName); for (String packageVersion : packageVersions.keySet()) { // TODO: Make this more robust, right now it makes a lot of assumptions and doesn't deal with bad things well Map<String, Object> versionInfo = (Map<String, Object>) packageVersions.get(packageVersion); versionInfo.remove(SOURCE_KEY); // TODO: For now don't allow sources, probably should make this configurable? Map<String, Object> distInfo = (Map<String, Object>) versionInfo.get(DIST_KEY); if (distInfo != null && ZIP_TYPE.equals(distInfo.get(TYPE_KEY))) { versionInfo.put(DIST_KEY, buildDistInfo(repository, packageName, packageVersion, (String) distInfo.get(REFERENCE_KEY), (String) distInfo.get(SHASUM_KEY), ZIP_TYPE)); } } } } return new StringPayload(mapper.writeValueAsString(json), payload.getContentType()); }
Example 2
Source File: HelmFacetImpl.java From nexus-repository-helm with Eclipse Public License 1.0 | 6 votes |
/** * Save an asset and create blob. * * @return blob content */ @Override @Nullable public Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload) { try { if (payload instanceof Content) { AttributesMap contentAttributes = ((Content) payload).getAttributes(); String contentType = payload.getContentType(); return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes); } return saveAsset(tx, asset, contentSupplier, null, null); } catch (IOException ex) { log.warn("Could not set blob {}", ex.getMessage(), ex); return null; } }
Example 3
Source File: P2FacetImpl.java From nexus-repository-p2 with Eclipse Public License 1.0 | 5 votes |
/** * Save an asset && create blob. * * @return blob content */ @Override public Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload) throws IOException { AttributesMap contentAttributes = null; String contentType = null; if (payload instanceof Content) { contentAttributes = ((Content) payload).getAttributes(); contentType = payload.getContentType(); } return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes); }
Example 4
Source File: RFacetUtils.java From nexus-repository-r with Eclipse Public License 1.0 | 5 votes |
/** * Save an asset && create blob. * * @return blob content */ public static Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload) throws IOException { AttributesMap contentAttributes = null; String contentType = null; if (payload instanceof Content) { contentAttributes = ((Content) payload).getAttributes(); contentType = payload.getContentType(); } return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes); }
Example 5
Source File: ConanProxyFacet.java From nexus-repository-conan with Eclipse Public License 1.0 | 5 votes |
/** * Save an asset and create a blob * * @return blob content */ private Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload, final HashCode hash) throws IOException { AttributesMap contentAttributes = null; String contentType = null; if (payload instanceof Content) { contentAttributes = ((Content) payload).getAttributes(); contentType = payload.getContentType(); } return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes, hash); }
Example 6
Source File: CondaFacetImpl.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override public Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload) throws IOException { AttributesMap contentAttributes = null; String contentType = null; if (payload instanceof Content) { contentAttributes = ((Content) payload).getAttributes(); contentType = payload.getContentType(); } return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes); }
Example 7
Source File: OrientPyPiDataUtils.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
/** * Save an asset and create blob. * * @return blob content */ static Content saveAsset( final StorageTx tx, final Asset asset, final TempBlob tempBlob, final Payload payload) throws IOException { AttributesMap contentAttributes = null; String contentType = null; if (payload instanceof Content) { contentAttributes = ((Content) payload).getAttributes(); contentType = payload.getContentType(); } return saveAsset(tx, asset, tempBlob, contentType, contentAttributes); }
Example 8
Source File: GolangDataAccess.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
private Content saveAsset(final StorageTx tx, final Asset asset, final Supplier<InputStream> contentSupplier, final Payload payload) throws IOException { AttributesMap contentAttributes = null; String contentType = null; if (payload instanceof Content) { contentAttributes = ((Content) payload).getAttributes(); contentType = payload.getContentType(); } return saveAsset(tx, asset, contentSupplier, contentType, contentAttributes); }