Hi,
I want to know if its possible to handle multiple media types using "ByteArrayHttpMessageConverter". My scenario is that, i will not be knowing the media type till i get some document from the server. So, it can be anything (a pdf, a doc, an image etc.,). Is there a way to configure the ByteArrayHttpMessageConverter - media type dynamically?
Can anyone throw some light on this?
I have tried giving all possible media types as below,
But this is not right! it is not working as i expect. Some media types takes precedence over the othersCode:<bean id="byteArrayMessageConverter" class="org.springframework.http.converter.ByteArrayHttpMessageConverter"> <property name="supportedMediaTypes"> <list> <bean class="org.springframework.http.MediaType"> <constructor-arg value="application" /> <constructor-arg value="pdf" /> </bean> <bean class="org.springframework.http.MediaType"> <constructor-arg value="text" /> <constructor-arg value="plain" /> </bean> <bean class="org.springframework.http.MediaType"> <constructor-arg value="text" /> <constructor-arg value="csv" /> </bean> <bean class="org.springframework.http.MediaType"> <constructor-arg value="text" /> <constructor-arg value="xml" /> </bean> <bean class="org.springframework.http.MediaType"> <constructor-arg value="application" /> <constructor-arg value="msword" /> </bean> <bean class="org.springframework.http.MediaType"> <constructor-arg value="application" /> <constructor-arg value="vnd.ms-excel" /> </bean> </list> </property> </bean>
Thanks in advance!
Paary



Reply With Quote
Will surely try this way!
