Package com.wavemaker.runtime.data.util
Class WMMultipartUtils
- java.lang.Object
-
- com.wavemaker.runtime.data.util.WMMultipartUtils
-
public class WMMultipartUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBLOB
-
Constructor Summary
Constructors Constructor Description WMMultipartUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.wavemaker.runtime.commons.file.model.DownloadResponsebuildDownloadResponse(javax.servlet.http.HttpServletRequest request, java.io.InputStream is, boolean download)static <T> com.wavemaker.runtime.commons.file.model.DownloadResponsebuildDownloadResponseForBlob(T instance, java.lang.String fieldName, javax.servlet.http.HttpServletRequest httpServletRequest, boolean download)static <T> voidbuildHttpResponseForBlob(T instance, java.lang.String fieldName, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)Generate Http response for a field in any Instancestatic java.lang.StringguessContentType(byte[] data)get a match from a stream of datastatic byte[]toByteArray(org.springframework.web.multipart.MultipartFile file)static <T> TtoObject(java.lang.String json, java.lang.Class<T> instance)static <T> TtoObject(org.springframework.web.multipart.MultipartFile multipartFile, java.lang.Class<T> instance)static <T> TtoObject(org.springframework.web.multipart.MultipartHttpServletRequest multipartHttpServletRequest, java.lang.Class<T> instance)static <T> TtoObject(org.springframework.web.multipart.MultipartHttpServletRequest multipartHttpServletRequest, java.lang.Class<T> instance, java.lang.String serviceId)static <T> TupdateLobsContent(T oldInstance, T newInstance)This Api is used to update blob content from old instance to new instance when blob type content is NULL in the new instance
-
-
-
Field Detail
-
BLOB
public static final java.lang.String BLOB
- See Also:
- Constant Field Values
-
-
Method Detail
-
toObject
public static <T> T toObject(org.springframework.web.multipart.MultipartHttpServletRequest multipartHttpServletRequest, java.lang.Class<T> instance)
-
toObject
public static <T> T toObject(org.springframework.web.multipart.MultipartHttpServletRequest multipartHttpServletRequest, java.lang.Class<T> instance, java.lang.String serviceId)
-
toObject
public static <T> T toObject(org.springframework.web.multipart.MultipartFile multipartFile, java.lang.Class<T> instance) throws java.io.IOException- Throws:
java.io.IOException
-
toObject
public static <T> T toObject(java.lang.String json, java.lang.Class<T> instance) throws java.io.IOException- Throws:
java.io.IOException
-
updateLobsContent
public static <T> T updateLobsContent(T oldInstance, T newInstance)This Api is used to update blob content from old instance to new instance when blob type content is NULL in the new instance- Parameters:
oldInstance- : persisted instance.newInstance- : changes in the persisted instance.- Returns:
- returns newInstance with updated blob content
-
toByteArray
public static byte[] toByteArray(org.springframework.web.multipart.MultipartFile file)
-
guessContentType
public static java.lang.String guessContentType(byte[] data)
get a match from a stream of data- Parameters:
data- bytes of data- Returns:
- Guessed content type of given bytes
-
buildHttpResponseForBlob
public static <T> void buildHttpResponseForBlob(T instance, java.lang.String fieldName, javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)Generate Http response for a field in any Instance- Parameters:
instance- any InstancefieldName- name of the fieldhttpServletRequest- to prepare content typehttpServletResponse- to generate response for the given field
-
buildDownloadResponseForBlob
public static <T> com.wavemaker.runtime.commons.file.model.DownloadResponse buildDownloadResponseForBlob(T instance, java.lang.String fieldName, javax.servlet.http.HttpServletRequest httpServletRequest, boolean download)
-
buildDownloadResponse
public static com.wavemaker.runtime.commons.file.model.DownloadResponse buildDownloadResponse(javax.servlet.http.HttpServletRequest request, java.io.InputStream is, boolean download)
-
-