Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 143875 Details for
Bug 285722
Running Tomcat with 'Serve Modules Without Publishing' option and multiple wb-resource deploy-path
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to WtpDirContext to lookup the additional web Resourses
WtpDirContext.patch (text/plain), 4.36 KB, created by
Matteo TURRA
on 2009-08-10 05:24:00 EDT
(
hide
)
Description:
Patch to WtpDirContext to lookup the additional web Resourses
Filename:
MIME Type:
Creator:
Matteo TURRA
Created:
2009-08-10 05:24:00 EDT
Size:
4.36 KB
patch
obsolete
>--- C:\temp\a\2.java\WtpDirContext.java 2007-03-20 15.00.32.000000000 +-0200 >+++ C:\temp\a\WtpDirContext.java 2009-08-06 17.07.59.000000000 +-0200 >@@ -33,37 +33,59 @@ > public class WtpDirContext extends FileDirContext { > // Map<String, File> > private Map virtualMappings; > > // Map<String, File> > private Map tagfileMappings; >- >+ >+ // Map<String, String> >+ private Map webResourcesMapping; >+ > private String virtualClasspath; >+ >+ private String webResources; > > /** > * Tomcat digester will automatically set this property to the value of the > * "virtualClasspath" xml attribute. > * @param path ; separated list of path elements. > */ > public void setVirtualClasspath(String path) { > virtualClasspath = path; > } > >+ /** >+ * Tomcat digester will automatically set this property to the value of the >+ * "webResources" xml attribute. >+ * @param path ; separated list of path elements. >+ */ >+ public void setWebResources(String path) { >+ webResources = path; >+ } >+ > public void allocate() { > super.allocate(); > virtualMappings = new Hashtable(); // new Hashtable<String, File>(); > tagfileMappings = new Hashtable(); // new Hashtable<String, File>(); >- >+ webResourcesMapping = new Hashtable(); // new Hashtable<String, String>(); >+ > StringTokenizer tkn = new StringTokenizer(virtualClasspath, ";"); > while (tkn.hasMoreTokens()) { > File file = new File(tkn.nextToken(), "META-INF"); > > if (!file.exists() || !file.isDirectory()) { > continue; > } > scanForTlds(file); >+ } >+ StringTokenizer tknwebResources = new StringTokenizer(webResources, ";"); >+ int i = 0; >+ while (tknwebResources.hasMoreTokens()) { >+ i++; >+ String token = tknwebResources.nextToken(); >+ webResourcesMapping.put(String.valueOf(i), token); > } > } > > private void scanForTlds(File dir) { > > File[] files = dir.listFiles(); >@@ -108,14 +130,32 @@ > if (file.exists()) { > tagfileMappings.put(name, file); > return new FileResourceAttributes(file); > } > } > } >+ Attributes superAttr; > >- return super.getAttributes(name); >+ try { >+ superAttr = super.getAttributes(name); >+ return superAttr; >+ } catch (NamingException ex) { >+ superAttr = null; >+ } >+ for (Object webResourcesDir : webResourcesMapping.values()){ >+ String dir = (String) webResourcesDir; >+ File f = new File (dir + "/" + name); >+ if (f.exists() && f.isFile()) { >+ FileResourceAttributes fra = new FileResourceAttributes(f); >+ superAttr = fra; >+ } >+ } >+ if (superAttr == null) { >+ throw new NamingException(); >+ } >+ return superAttr; > } > > protected ArrayList list(File file) { > ArrayList entries = super.list(file); > if ("WEB-INF".equals(file.getName())) { > entries.addAll(getVirtualNamingEntries()); >@@ -131,15 +171,34 @@ > } > } else if (name.startsWith("/META-INF/tags") && name.endsWith(".tag") > || name.endsWith(".tagx")) { > > // already loaded tag file > return new FileResource((File) tagfileMappings.get(name)); >- } >- >- return super.lookup(name); >+ } >+ >+ Object retSuper; >+ try { >+ retSuper = super.lookup(name); >+ return retSuper; >+ } catch (NamingException ex) { >+ retSuper = null; >+ } >+ >+ for (Object webResourcesDit : webResourcesMapping.values()){ >+ String dir = (String) webResourcesDit; >+ File f = new File (dir + "/" + name); >+ if (f.exists() && f.isFile()) { >+ FileResource fr = new FileResource(f); >+ retSuper = fr; >+ } >+ } >+ if (retSuper == null) { >+ throw new NamingException(); >+ } >+ return retSuper; > } > > private List getVirtualNamingEntries() { > List virtual = new ArrayList(); > for (Iterator iter = virtualMappings.keySet().iterator(); iter > .hasNext();) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 285722
:
143872
|
143874
| 143875 |
143876
|
143877