KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > utils > WebAppPathResolver


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12

13 package org.jahia.utils;
14
15 import javax.servlet.ServletContext JavaDoc;
16
17 /**
18  * <p>Title: Web application path resolver</p>
19  * <p>Description: Resolves all the paths using the ServletContext.getRealPath
20  * method.</p>
21  * <p>Copyright: Copyright (c) 2004</p>
22  * <p>Company: Jahia Ltd</p>
23  * @author Serge Huber
24  * @version 1.0
25  */

26
27 public class WebAppPathResolver implements PathResolver {
28
29     ServletContext JavaDoc servletContext = null;
30
31     public WebAppPathResolver(ServletContext JavaDoc servletContext) {
32         this.servletContext = servletContext;
33     }
34
35     public String JavaDoc resolvePath(String JavaDoc relativePath) {
36         return servletContext.getRealPath("/" + relativePath);
37     }
38 }
39
Popular Tags