Spring Framework ServletContextResourceLoader - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ServletContextResourceLoader class.

This code example shows how to use the following methods:
        this.loader = loader; 
    } 
 
    @Override 
    protected void initServletContext(ServletContext servletContext) { 
        this.scloader = new ServletContextResourceLoader(servletContext); 
    } 
 
    @Override 
    protected URL getUrl(HttpServletRequest request) throws IOException { 
        String ctxPath = request.getContextPath(); 
        String reqPath = request.getRequestURI(); 
        reqPath = URLDecoder.decode(reqPath, "UTF-8"); 
        reqPath = reqPath.substring(ctxPath.length()); 
 
        if ((reqPath.length() > 1) && reqPath.startsWith("/")) { 
            reqPath = reqPath.substring(1); 
        } 
 
        // sigh, in order to serve the file we have to open it 2 times 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	private ResourceLoader resourceLoader; 
 
	private FlowDefinitionResourceFactory factory; 
 
	protected void setUp() throws Exception { 
		resourceLoader = new ServletContextResourceLoader(new MockServletContext()); 
		factory = new FlowDefinitionResourceFactory(); 
	} 
 
	public void testGetFlowIdNoBasePath() { 
		Resource resource = resourceLoader.getResource("/WEB-INF/hotels/booking/booking-flow.xml"); 
		assertEquals("booking-flow", factory.getFlowId(resource)); 
	} 
 
	public void testGetFlowIdFileSystemResourceBasePathMatch() { 
		Resource resource = new FileSystemResource("/the/path/on/the/file/system/sample-flow.xml"); 
		factory.setBasePath("file:/the/path"); 
		assertEquals("on/the/file/system", factory.getFlowId(resource)); 
	} 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        private ServletContext context; 
 
        @PostConstruct 
        public void init() { 
            if(this.resourceLoader == null) { 
                this.resourceLoader = new ServletContextResourceLoader(context); 
            } 
        } 
 
        @Override 
        public void setServletContext(ServletContext servletContext) { 
            this.context = servletContext; 
        } 
 
        public void setResourceLoader(ResourceLoader resourceLoader) { 
            this.resourceLoader = resourceLoader; 
        } 
         
        @Override 
	public long getLastModified(String name) { 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java