struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (WW-3247) Unable to upload files with Spring security filter in Struts2 using File upload interceptor
Date Tue, 15 Sep 2009 15:17:34 GMT

     [ https://issues.apache.org/struts/browse/WW-3247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Musachy Barroso resolved WW-3247.
---------------------------------

    Resolution: Not A Problem

please ask questions on the user mailing list

> Unable to upload files with Spring security filter in Struts2 using File upload interceptor
> -------------------------------------------------------------------------------------------
>
>                 Key: WW-3247
>                 URL: https://issues.apache.org/struts/browse/WW-3247
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.1.6
>         Environment: Windows XP, Vista
>            Reporter: Sundeep Raikhelkar
>
> I am able to upload files in struts2 (2.1.6), when I remove the spring security filter
in web.xml. With spring security filter, I get a null in File object inside action class.
That is line with code "testFile.length()" throws null exception. 
> I have provided my code snippets below. Along with struts, I am using spring 2.5.6 and
Spring security 2.0.5.
> Can anybody please help on this?
> Web XML
>  
> <!--<filter>
> <filter-name>springSecurityFilterChain</filter-name>
> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
> </filter>
> -->
> <!--
> <filter-mapping>
> <filter-name>springSecurityFilterChain</filter-name>
> <url-pattern>/*</url-pattern>
> </filter-mapping>
> -->
>  
> Struts XML
> <!--All packages extend base package--> 
> <package name="base" extends="struts-default">
> <interceptors>
> 	<interceptor-stack name="base-stack">
> 		<interceptor-ref name="defaultStack" />
> 		<interceptor-ref name="fileUpload">
> 			<param name="maximumSize">10240</param>
> 		</interceptor-ref>
> 	</interceptor-stack>
> </interceptors>
> <default-interceptor-ref name="base-stack" />
> </package> 
> JSP 
> <s:form action="save" method="post" enctype="multipart/form-data">
> <s:file name="testFile" id="testFile"></s:file>
> <s:submit></s:submit>
> </s:form>
>  
> Action
> private File testFile;
> public File getTestFile() {
> 	return testFile;
> }
> public void setTestFile(File testFile) {
> 	this.testFile = testFile;
> }
> public String save(){
> 	byte[] testFileContent = new byte[(int) testFile.length()];
> 	new FileInputStream(testFile).read(testFileContent);
> 	//write testFileContent  to a local file
> 	writeFile("D:\\etl.gif",testFileContent); 
> 	return ActionSupport.SUCCESS;
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message