RelativePathConfigurator.java from Kneobase at Krugle
Show RelativePathConfigurator.java syntax highlighted
package com.kneobase.web.util;
import javax.servlet.ServletContext;
import org.springframework.web.context.ServletContextAware;
import com.kneobase.util.I_PathInfo;
/**
* @author patricio.keilty@colaborativa.net
*
*/
public class RelativePathConfigurator implements ServletContextAware, I_PathInfo {
private String _path;
private static String _realPath;
public RelativePathConfigurator( String path ){
_path = path;
}
/**
* @see org.springframework.web.context.ServletContextAware#setServletContext(javax.servlet.ServletContext)
*/
public void setServletContext( ServletContext arg0 ){
_realPath = arg0.getRealPath( "/" );
// Linuxes patch
// apparently absolute paths must start with //// ( 4 slashes )
if( _realPath.startsWith( "/" ) )
_realPath = "///" + _realPath;
}
/**
* @see I_PathInfo#getPath()
*/
public String getPath() {
return _realPath + _path;
}
}
See more files for this project here