diff --git a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java index c6b9cd5d3ed..e87ce1fd885 100644 --- a/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java +++ b/jetty-annotations/src/main/java/org/eclipse/jetty/annotations/AnnotationDecorator.java @@ -28,12 +28,17 @@ import org.eclipse.jetty.webapp.WebAppContext; */ public class AnnotationDecorator implements Decorator { - AnnotationIntrospector _introspector = new AnnotationIntrospector(); + protected AnnotationIntrospector _introspector = new AnnotationIntrospector(); /** * @param context */ public AnnotationDecorator(WebAppContext context) + { + registerHandlers(context); + } + + public void registerHandlers (WebAppContext context) { _introspector.registerHandler(new ResourceAnnotationHandler(context)); _introspector.registerHandler(new ResourcesAnnotationHandler(context)); diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java index 424a98869e8..09bb4ccdbd0 100644 --- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java +++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java @@ -60,12 +60,12 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor { try { - registerVisitor("env-entry", getClass().getDeclaredMethod("visitEnvEntry", __signature)); - registerVisitor("resource-ref", getClass().getDeclaredMethod("visitResourceRef", __signature)); - registerVisitor("resource-env-ref", getClass().getDeclaredMethod("visitResourceEnvRef", __signature)); - registerVisitor("message-destination-ref", getClass().getDeclaredMethod("visitMessageDestinationRef", __signature)); - registerVisitor("post-construct", getClass().getDeclaredMethod("visitPostConstruct", __signature)); - registerVisitor("pre-destroy", getClass().getDeclaredMethod("visitPreDestroy", __signature)); + registerVisitor("env-entry", getClass().getMethod("visitEnvEntry", __signature)); + registerVisitor("resource-ref", getClass().getMethod("visitResourceRef", __signature)); + registerVisitor("resource-env-ref", getClass().getMethod("visitResourceEnvRef", __signature)); + registerVisitor("message-destination-ref", getClass().getMethod("visitMessageDestinationRef", __signature)); + registerVisitor("post-construct", getClass().getMethod("visitPostConstruct", __signature)); + registerVisitor("pre-destroy", getClass().getMethod("visitPreDestroy", __signature)); } catch (Exception e) { diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java index 627277e2ebf..d49bc0c3c29 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/PreconfigureDescriptorProcessor.java @@ -45,11 +45,11 @@ public class PreconfigureDescriptorProcessor extends IterativeDescriptorProcesso _showOrigin=LOG.isDebugEnabled(); try { - registerVisitor("env-entry", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("resource-ref", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("resource-env-ref", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("message-destination-ref", getClass().getDeclaredMethod("saveSnippet", __signature)); - registerVisitor("data-source", getClass().getDeclaredMethod("saveSnippet", __signature)); + registerVisitor("env-entry", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("resource-ref", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("resource-env-ref", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("message-destination-ref", getClass().getMethod("saveSnippet", __signature)); + registerVisitor("data-source", getClass().getMethod("saveSnippet", __signature)); } catch (Exception e) { diff --git a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java index 7e5a6c849b9..f63d2381a3f 100644 --- a/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java +++ b/jetty-quickstart/src/main/java/org/eclipse/jetty/quickstart/QuickStartDescriptorProcessor.java @@ -51,7 +51,7 @@ public class QuickStartDescriptorProcessor extends IterativeDescriptorProcessor { try { - registerVisitor("context-param", this.getClass().getDeclaredMethod("visitContextParam", __signature)); + registerVisitor("context-param", this.getClass().getMethod("visitContextParam", __signature)); } catch (Exception e) { diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java index ad7bbd77723..de6c181d4fe 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java @@ -81,25 +81,25 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor { try { - registerVisitor("context-param", this.getClass().getDeclaredMethod("visitContextParam", __signature)); - registerVisitor("display-name", this.getClass().getDeclaredMethod("visitDisplayName", __signature)); - registerVisitor("servlet", this.getClass().getDeclaredMethod("visitServlet", __signature)); - registerVisitor("servlet-mapping", this.getClass().getDeclaredMethod("visitServletMapping", __signature)); - registerVisitor("session-config", this.getClass().getDeclaredMethod("visitSessionConfig", __signature)); - registerVisitor("mime-mapping", this.getClass().getDeclaredMethod("visitMimeMapping", __signature)); - registerVisitor("welcome-file-list", this.getClass().getDeclaredMethod("visitWelcomeFileList", __signature)); - registerVisitor("locale-encoding-mapping-list", this.getClass().getDeclaredMethod("visitLocaleEncodingList", __signature)); - registerVisitor("error-page", this.getClass().getDeclaredMethod("visitErrorPage", __signature)); - registerVisitor("taglib", this.getClass().getDeclaredMethod("visitTagLib", __signature)); - registerVisitor("jsp-config", this.getClass().getDeclaredMethod("visitJspConfig", __signature)); - registerVisitor("security-constraint", this.getClass().getDeclaredMethod("visitSecurityConstraint", __signature)); - registerVisitor("login-config", this.getClass().getDeclaredMethod("visitLoginConfig", __signature)); - registerVisitor("security-role", this.getClass().getDeclaredMethod("visitSecurityRole", __signature)); - registerVisitor("filter", this.getClass().getDeclaredMethod("visitFilter", __signature)); - registerVisitor("filter-mapping", this.getClass().getDeclaredMethod("visitFilterMapping", __signature)); - registerVisitor("listener", this.getClass().getDeclaredMethod("visitListener", __signature)); - registerVisitor("distributable", this.getClass().getDeclaredMethod("visitDistributable", __signature)); - registerVisitor("deny-uncovered-http-methods", this.getClass().getDeclaredMethod("visitDenyUncoveredHttpMethods", __signature)); + registerVisitor("context-param", this.getClass().getMethod("visitContextParam", __signature)); + registerVisitor("display-name", this.getClass().getMethod("visitDisplayName", __signature)); + registerVisitor("servlet", this.getClass().getMethod("visitServlet", __signature)); + registerVisitor("servlet-mapping", this.getClass().getMethod("visitServletMapping", __signature)); + registerVisitor("session-config", this.getClass().getMethod("visitSessionConfig", __signature)); + registerVisitor("mime-mapping", this.getClass().getMethod("visitMimeMapping", __signature)); + registerVisitor("welcome-file-list", this.getClass().getMethod("visitWelcomeFileList", __signature)); + registerVisitor("locale-encoding-mapping-list", this.getClass().getMethod("visitLocaleEncodingList", __signature)); + registerVisitor("error-page", this.getClass().getMethod("visitErrorPage", __signature)); + registerVisitor("taglib", this.getClass().getMethod("visitTagLib", __signature)); + registerVisitor("jsp-config", this.getClass().getMethod("visitJspConfig", __signature)); + registerVisitor("security-constraint", this.getClass().getMethod("visitSecurityConstraint", __signature)); + registerVisitor("login-config", this.getClass().getMethod("visitLoginConfig", __signature)); + registerVisitor("security-role", this.getClass().getMethod("visitSecurityRole", __signature)); + registerVisitor("filter", this.getClass().getMethod("visitFilter", __signature)); + registerVisitor("filter-mapping", this.getClass().getMethod("visitFilterMapping", __signature)); + registerVisitor("listener", this.getClass().getMethod("visitListener", __signature)); + registerVisitor("distributable", this.getClass().getMethod("visitDistributable", __signature)); + registerVisitor("deny-uncovered-http-methods", this.getClass().getMethod("visitDenyUncoveredHttpMethods", __signature)); } catch (Exception e) { @@ -205,7 +205,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitDisplayName(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitDisplayName(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0 p. 74 Ignore from web-fragments if (!(descriptor instanceof FragmentDescriptor)) @@ -221,7 +221,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitServlet(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitServlet(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String id = node.getAttribute("id"); @@ -638,7 +638,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitServletMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitServletMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0, p74 //servlet-mappings are always additive, whether from web xml descriptors (web.xml/web-default.xml/web-override.xml) or web-fragments. @@ -685,7 +685,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitSessionConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitSessionConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { XmlParser.Node tNode = node.get("session-timeout"); if (tNode != null) @@ -1014,7 +1014,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitMimeMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitMimeMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String extension = node.getString("extension", false, true); if (extension != null && extension.startsWith(".")) @@ -1061,7 +1061,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitWelcomeFileList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitWelcomeFileList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { switch (context.getMetaData().getOrigin("welcome-file-list")) { @@ -1110,7 +1110,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitLocaleEncodingList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitLocaleEncodingList(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { Iterator iter = node.iterator("locale-encoding-mapping"); while (iter.hasNext()) @@ -1161,7 +1161,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitErrorPage(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitErrorPage(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String error = node.getString("error-code", false, true); int code=0; @@ -1226,7 +1226,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param context * @param node */ - protected void addWelcomeFiles(WebAppContext context, XmlParser.Node node) + public void addWelcomeFiles(WebAppContext context, XmlParser.Node node) { Iterator iter = node.iterator("welcome-file"); while (iter.hasNext()) @@ -1246,7 +1246,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @param context */ - protected ServletMapping addServletMapping (String servletName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) + public ServletMapping addServletMapping (String servletName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) { ServletMapping mapping = new ServletMapping(); mapping.setServletName(servletName); @@ -1271,7 +1271,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @param context */ - protected void addFilterMapping (String filterName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) + public void addFilterMapping (String filterName, XmlParser.Node node, WebAppContext context, Descriptor descriptor) { FilterMapping mapping = new FilterMapping(); mapping.setFilterName(filterName); @@ -1317,7 +1317,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitTagLib(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitTagLib(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Additive across web.xml and web-fragment.xml String uri = node.getString("taglib-uri", false, true); @@ -1343,7 +1343,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitJspConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitJspConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Additive across web.xml and web-fragment.xml JspConfig config = (JspConfig)context.getServletContext().getJspConfigDescriptor(); @@ -1432,7 +1432,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitSecurityConstraint(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitSecurityConstraint(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { Constraint scBase = new Constraint(); @@ -1547,7 +1547,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param node * @throws Exception */ - protected void visitLoginConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception + public void visitLoginConfig(WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception { //ServletSpec 3.0 p74 says elements present 0/1 time if specified in web.xml take //precendece over any web-fragment. If not specified in web.xml, then if specified @@ -1716,7 +1716,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged XmlParser.Node roleNode = node.get("role-name"); @@ -1730,7 +1730,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitFilter(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitFilter(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String name = node.getString("filter-name", false, true); FilterHolder holder = _filterHolderMap.get(name); @@ -1866,7 +1866,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitFilterMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitFilterMapping(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0, p74 //filter-mappings are always additive, whether from web xml descriptors (web.xml/web-default.xml/web-override.xml) or web-fragments. @@ -1910,7 +1910,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitListener(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitListener(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { String className = node.getString("listener-class", false, true); EventListener listener = null; @@ -1956,7 +1956,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitDistributable(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitDistributable(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { // the element has no content, so its simple presence // indicates that the webapp is distributable... @@ -1974,7 +1974,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param descriptor * @param node */ - protected void visitDenyUncoveredHttpMethods(WebAppContext context, Descriptor descriptor, XmlParser.Node node) + public void visitDenyUncoveredHttpMethods(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { ((ConstraintAware)context.getSecurityHandler()).setDenyUncoveredHttpMethods(true); } @@ -1987,7 +1987,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @throws InstantiationException * @throws IllegalAccessException */ - protected EventListener newListenerInstance(WebAppContext context,Class clazz) throws Exception + public EventListener newListenerInstance(WebAppContext context,Class clazz) throws Exception { ListenerHolder h = context.getServletHandler().newListenerHolder(Source.DESCRIPTOR); EventListener l = context.getServletContext().createInstance(clazz); @@ -2001,7 +2001,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor * @param p * @return the normalized pattern */ - protected String normalizePattern(String p) + public String normalizePattern(String p) { if (p != null && p.length() > 0 && !p.startsWith("/") && !p.startsWith("*")) return "/" + p; return p; diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index bb8ca17a5ee..c2eec1e1977 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -1210,24 +1210,6 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL catch (IOException e){LOG.warn(Log.EXCEPTION,e);} } - if (dir!=null && !dir.exists()) - { - dir.mkdir(); - dir.deleteOnExit(); - } - - if (dir!=null && ( !dir.exists() || !dir.isDirectory() || !dir.canWrite())) - throw new IllegalArgumentException("Bad temp directory: "+dir); - - try - { - if (dir!=null) - dir=dir.getCanonicalFile(); - } - catch(Exception e) - { - LOG.warn(e); - } _tmpDir=dir; setAttribute(TEMPDIR,_tmpDir); } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java index 1dc3d12fd92..1e4096c19cb 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebInfConfiguration.java @@ -360,7 +360,7 @@ public class WebInfConfiguration extends AbstractConfiguration context.setTempDirectory(tmpDir); } - private void configureTempDirectory (File dir, WebAppContext context) + public void configureTempDirectory (File dir, WebAppContext context) { if (dir == null) throw new IllegalArgumentException("Null temp dir");