I'm working on file upload handling in server side. I'm using the code posted here. I modified the FileCommand Class code to the following
import org.springframework.web.multipart.MultipartFile;
public class FileUploadCommand {
private MultipartFile file;
public void setFile(MultipartFile file) {
this.file=file;
}
public MultipartFile getFile() {
return this.file;
} }
and the dispatcher-servlet.xml
<mvc:annotation-driven/>
<context:component-scan base-package="fileupload"/>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/api/file/*"/>
<bean id="fileUploadHandlerInterceptor" class="fileupload.FileUploadHandlerInterceptor">
<constructor-arg index="0" ref="putServletFileUpload" />
</bean>
</mvc:interceptor>
</mvc:interceptors>
<bean name="putServletFileUpload" class="fileupload.PutServletFileUpload">
<constructor-arg index="0">
<bean class="org.apache.commons.fileupload.disk.DiskFileItemFactory" />
</constructor-arg>
</bean>
The problem is that the HandlerInterceptor which is FileUploadHandlerInterceptor were not called when I tested the application. Could anyone help me to find out the cause of this problem.
Aucun commentaire:
Enregistrer un commentaire