import java.io.FileNotFoundException;
import java.io.InputStream;
+import com.opensymphony.webwork.interceptor.ServletResponseAware;
+
+import javax.servlet.http.HttpServletResponse;
+
/**
* Proxy functionality.
*
*/
public class ProxyAction
extends PlexusActionSupport
+ implements ServletResponseAware
{
/**
* @plexus.requirement
private InputStream artifactStream;
+ private long contentLength;
+
+ private HttpServletResponse httpServletResponse;
+
public String execute()
throws ProxyException
{
contentType = "application/octet-stream";
filename = file.getName();
+
+ contentLength = file.length();
+
+ httpServletResponse.addDateHeader( "Last-Modified", file.lastModified() );
}
catch ( ResourceDoesNotExistException e )
{
return contentType;
}
+ public long getContentLength()
+ {
+ return contentLength;
+ }
+
public InputStream getArtifactStream()
{
return artifactStream;
}
+
+ public void setServletResponse( HttpServletResponse httpServletResponse )
+ {
+ this.httpServletResponse = httpServletResponse;
+ }
}
<param name="contentDisposition">filename="${filename}"</param>
<param name="inputName">artifactStream</param>
<param name="bufferSize">1024</param>
+ <param name="contentLength">${contentLength}</param>
</result>
<result name="notFound" type="httpheader">404</result>
</action>