public class CatalogVersionMediaController extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
MEDIA_URI_PATH |
| Constructor and Description |
|---|
CatalogVersionMediaController() |
| Modifier and Type | Method and Description |
|---|---|
MediaFileDto |
getFile(MultipartFile file)
Create a new media file DTO from the
MultipartFile |
protected LocationHeaderResource |
getLocationHeaderResource() |
MediaData |
getMedia(HttpServletRequest request)
Create a new media DTO from request parameters.
|
MediaData |
getMediaByCode(HttpServletRequest request)
Get a media by code.
|
MediaFacade |
getMediaFacade() |
protected Optional<String> |
parseMediaCode(HttpServletRequest request)
Parses the Request URI after the Media code, which is defined by everything after the /media less the first '/', if
present.
|
void |
setLocationHeaderResource(LocationHeaderResource locationHeaderResource) |
void |
setMediaFacade(MediaFacade mediaFacade) |
MediaData |
uploadMultipartMedia(String catalogId,
String versionId,
MediaData media,
MultipartFile multiPart,
HttpServletRequest request,
HttpServletResponse response)
Upload a media.
|
public static final String MEDIA_URI_PATH
public MediaData uploadMultipartMedia(String catalogId, String versionId, MediaData media, MultipartFile multiPart, HttpServletRequest request, HttpServletResponse response) throws IOException, WebserviceValidationException
catalogId - the unique identifier of the catalog for which to link the new media.versionId - the specific catalog version to which the new media will be associated to.media - the MediaData containing the data for the associated media item to be created.multiPart - the file that was uploaded for the new media.request - the HttpServletRequestresponse - the HttpServletResponseIOException - when an error occurs parsing the MultipartFileWebserviceValidationException - when the media query parameters provided contain validation errorspublic MediaData getMediaByCode(HttpServletRequest request) throws MediaNotFoundException
<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager"> where
org.springframework.web.accept.ContentNegotiationManagerFactoryBean.favorPathExtension = falseMediaNotFoundException - When the media code requested cannot be found.protected Optional<String> parseMediaCode(HttpServletRequest request)
request - the http servlet requestpublic MediaData getMedia(HttpServletRequest request)
request - - the http servlet requestpublic MediaFileDto getFile(MultipartFile file) throws IOException
MultipartFilefile - - a Spring MultipartFileIOException - when an error occurs retrieving the input stream from the multi part filepublic MediaFacade getMediaFacade()
public void setMediaFacade(MediaFacade mediaFacade)
protected LocationHeaderResource getLocationHeaderResource()
public void setLocationHeaderResource(LocationHeaderResource locationHeaderResource)
Copyright © 2000-2016 SAP SE. All Rights Reserved.