Add download server api
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -26,6 +26,11 @@
|
||||
<artifactId>hawkbit-ddi-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.hawkbit</groupId>
|
||||
<artifactId>hawkbit-ddi-dl-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.hawkbit</groupId>
|
||||
<artifactId>hawkbit-rest-core</artifactId>
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.hawkbit.api.ArtifactUrlHandler;
|
||||
import org.eclipse.hawkbit.api.UrlProtocol;
|
||||
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiArtifact;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiArtifactHash;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiChunk;
|
||||
@@ -93,9 +94,9 @@ public final class DataConversionHelper {
|
||||
final String linkHttps = artifactUrlHandler.getUrl(targetid, artifact.getSoftwareModule().getId(),
|
||||
artifact.getFilename(), artifact.getSha1Hash(), UrlProtocol.HTTPS);
|
||||
file.add(new Link(linkHttps).withRel("download"));
|
||||
file.add(new Link(linkHttps + DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX).withRel("md5sum"));
|
||||
file.add(new Link(linkHttps + DdiDlRestConstants.ARTIFACT_MD5_DWNL_SUFFIX).withRel("md5sum"));
|
||||
file.add(new Link(linkHttp).withRel("download-http"));
|
||||
file.add(new Link(linkHttp + DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX).withRel("md5sum-http"));
|
||||
file.add(new Link(linkHttp + DdiDlRestConstants.ARTIFACT_MD5_DWNL_SUFFIX).withRel("md5sum-http"));
|
||||
|
||||
files.add(file);
|
||||
});
|
||||
@@ -147,7 +148,7 @@ public final class DataConversionHelper {
|
||||
final StringBuilder header = new StringBuilder();
|
||||
header.append("attachment;filename=");
|
||||
header.append(fileName);
|
||||
header.append(DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX);
|
||||
header.append(DdiDlRestConstants.ARTIFACT_MD5_DWNL_SUFFIX);
|
||||
|
||||
response.setContentLength(content.length);
|
||||
response.setHeader("Content-Disposition", header.toString());
|
||||
|
||||
@@ -16,7 +16,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
||||
import org.eclipse.hawkbit.cache.CacheWriteNotify;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiArtifactStoreControllerRestApi;
|
||||
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
@@ -49,7 +49,7 @@ import org.springframework.web.context.WebApplicationContext;
|
||||
*/
|
||||
@RestController
|
||||
@Scope(value = WebApplicationContext.SCOPE_REQUEST)
|
||||
public class DdiArtifactStoreController implements DdiArtifactStoreControllerRestApi {
|
||||
public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerRestApi {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DdiArtifactStoreController.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user