Properly handling contextRoot when retrieving dojo and extension resources
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@916514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
78155c8d5c
commit
b4b2a2b6e8
3 changed files with 7 additions and 2 deletions
|
|
@ -22,3 +22,4 @@ Bundle-DocURL: http://www.apache.org/
|
|||
Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -111,5 +111,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.tuscany.sca.common.http.HTTPConstants;
|
||||
import org.apache.tuscany.sca.common.http.HTTPContentTypeMapper;
|
||||
import org.apache.tuscany.sca.common.http.HTTPUtil;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -46,14 +47,18 @@ public class DojoResourceServlet extends HttpServlet {
|
|||
|
||||
@Override
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String contextRoot = URLDecoder.decode(HTTPUtil.getContextRoot(request), HTTPConstants.CHARACTER_ENCODING_UTF8);
|
||||
String path = URLDecoder.decode(request.getRequestURI(), HTTPConstants.CHARACTER_ENCODING_UTF8);
|
||||
|
||||
if( path.startsWith("/dojo") ) {
|
||||
if( path.startsWith(contextRoot + "/dojo") ) {
|
||||
if( ! path.contains("tuscany/AtomService.js")) {
|
||||
//this is a workaround where we need to have dojo files in its own folder
|
||||
//to avoid clean target to clean other non dojo resources
|
||||
path = path.substring(contextRoot.length());
|
||||
path = "/dojo" + path;
|
||||
}
|
||||
} else if (path.startsWith(contextRoot)) {
|
||||
path = path.substring(contextRoot.length() + 1);
|
||||
} else if( path.startsWith("/")) {
|
||||
path = path.substring(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue