public void addWelcomeFiles(WebAppContext context, XmlParser.Node node) { Iterator<XmlParser.Node> iter = node.iterator("welcome-file"); while (iter.hasNext()) { XmlParser.Node indexNode = (XmlParser.Node) iter.next(); String welcome = indexNode.toString(false, true); //Servlet Spec 3.0 p. 74 welcome files are additive if (welcome != null && welcome.trim().length() > 0) context.setWelcomeFiles((String[])ArrayUtil.addToArray(context.getWelcomeFiles(),welcome,String.class)); } }
public void processOrdering () { //Process the web.xml's optional <absolute-ordering> element XmlParser.Node ordering = _root.get("absolute-ordering"); if (ordering == null) return; _isOrdered = true; //If an absolute-ordering was already set, then ignore it in favor of this new one // _processor.setOrdering(new AbsoluteOrdering()); Iterator<Object> iter = ordering.iterator(); XmlParser.Node node = null; while (iter.hasNext()) { Object o = iter.next(); if (!(o instanceof XmlParser.Node)) continue; node = (XmlParser.Node) o; if (node.getTag().equalsIgnoreCase("others")) //((AbsoluteOrdering)_processor.getOrdering()).addOthers(); _ordering.add("others"); else if (node.getTag().equalsIgnoreCase("name")) //((AbsoluteOrdering)_processor.getOrdering()).add(node.toString(false,true)); _ordering.add(node.toString(false,true)); } }
public void processBefores (XmlParser.Node ordering) { //Process the <before> elements, looking for an <others/> clause and all of the <name> clauses XmlParser.Node before = ordering.get("before"); if (before == null) return; Iterator<?> iter = before.iterator(); XmlParser.Node node = null; while (iter.hasNext()) { Object o = iter.next(); if (!(o instanceof XmlParser.Node)) continue; node = (XmlParser.Node) o; if (node.getTag().equalsIgnoreCase("others")) { if (_otherType != OtherType.None) throw new IllegalStateException("Duplicate <other> clause detected in "+_xml.getURI()); _otherType = OtherType.Before; } else if (node.getTag().equalsIgnoreCase("name")) _befores.add(node.toString(false,true)); } }
/** * Convert to a string. * * @param tag If false, only _content is shown. */ public synchronized String toString(boolean tag) { StringBuilder buf = new StringBuilder(); toString(buf, tag); return buf.toString(); }
/** * Convert to a string. * * @param tag If false, only _content is shown. */ public synchronized String toString(boolean tag) { StringBuilder buf = new StringBuilder(); toString(buf, tag); return buf.toString(); }
/** * @param context * @param descriptor * @param node */ protected 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"); String role = roleNode.toString(false, true); ((ConstraintAware)context.getSecurityHandler()).addRole(role); }
public void saveSnippet (WebAppContext context, Descriptor descriptor, XmlParser.Node node) throws Exception { LOG.debug("save {}",node.getTag()); if (_showOrigin) _buffer.append(_origin); _buffer.append(" ").append(node.toString()).append("\n"); }
/** * @param context * @param descriptor * @param node */ protected 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"); String role = roleNode.toString(false, true); ((ConstraintAware)context.getSecurityHandler()).addRole(role); }
/** * Recursively go through the entire tree starting at node. * Return the value for the first node with the name set, * e.g. [Set name="name"]value[/Set] * @param name case insensitive */ public static String getValue(Node node, String name) { String nameLC = name.toLowerCase(Locale.US); for (Object o : node) { if (!(o instanceof Node)) continue; Node n = (Node) o; String tag = n.getTag(); if (tag != null && "set".equals(tag.toLowerCase(Locale.US))) { String aname = n.getAttribute("name"); if (aname != null && aname.toLowerCase(Locale.US).equals(nameLC)) return n.toString(false); } else { String rv = getValue(n, name); if (rv != null) return rv; } } return null; }
if (tNode != null) java.math.BigDecimal asDecimal = new java.math.BigDecimal(tNode.toString(false, true)); if (asDecimal.compareTo(org.eclipse.jetty.server.session.SessionHandler.MAX_INACTIVE_MINUTES) > 0) throw new IllegalStateException ("Max session-timeout in minutes is "+org.eclipse.jetty.server.session.SessionHandler.MAX_INACTIVE_MINUTES); String trackMode = mNode.toString(false, true); modes.add(SessionTrackingMode.valueOf(trackMode)); if (tNode != null) boolean httpOnly = Boolean.parseBoolean(tNode.toString(false,true)); switch (context.getMetaData().getOrigin("cookie-config.http-only")) if (tNode != null) boolean secure = Boolean.parseBoolean(tNode.toString(false,true)); switch (context.getMetaData().getOrigin("cookie-config.secure")) if (tNode != null) int maxAge = Integer.parseInt(tNode.toString(false,true)); switch (context.getMetaData().getOrigin("cookie-config.max-age"))
if (startup != null) String s = startup.toString(false, true).toLowerCase(Locale.ENGLISH); int order = 0; if (s.startsWith("t"))
context.getSecurityHandler().setAuthMethod(method.toString(false, true)); context.getMetaData().setOrigin("auth-method", descriptor); break; context.getSecurityHandler().setAuthMethod(method.toString(false, true)); context.getMetaData().setOrigin("auth-method", descriptor); if (!context.getSecurityHandler().getAuthMethod().equals(method.toString(false, true))) throw new IllegalStateException("Conflicting auth-method value in "+descriptor.getResource()); break; String nameStr = (name == null ? "default" : name.toString(false, true)); switch (context.getMetaData().getOrigin("realm-name")) XmlParser.Node loginPage = formConfig.get("form-login-page"); if (loginPage != null) loginPageName = loginPage.toString(false, true); String errorPageName = null; XmlParser.Node errorPage = formConfig.get("form-error-page"); if (errorPage != null) errorPageName = errorPage.toString(false, true);
while (iter.hasNext()) String role = iter.next().toString(false, true); roles.add(role); String guarantee = data.toString(false, true).toUpperCase(Locale.ENGLISH); if (guarantee == null || guarantee.length() == 0 || "NONE".equals(guarantee)) scBase.setDataConstraint(Constraint.DC_NONE); while (iter2.hasNext()) String url = iter2.next().toString(false, true); url = ServletPathSpec.normalize(url); String method = ((XmlParser.Node) methods.next()).toString(false, true); ConstraintMapping mapping = new ConstraintMapping(); mapping.setMethod(method); String method = ((XmlParser.Node)ommissions.next()).toString(false, true); ConstraintMapping mapping = new ConstraintMapping(); mapping.setMethodOmissions(new String[]{method});
while (iter2.hasNext()) String url = iter2.next().toString(false, true); url = ServletPathSpec.normalize(url); paths.add( url); while (preludes.hasNext()) String prelude = preludes.next().toString(false, true); jpg.addIncludePrelude(prelude); while (codas.hasNext()) String coda = codas.next().toString(false, true); jpg.addIncludeCoda(coda);
while (iter.hasNext()) String p = iter.next().toString(false, true); p = ServletPathSpec.normalize(p);
while (iter.hasNext()) String p = iter.next().toString(false, true); p = ServletPathSpec.normalize(p); paths.add(p); while (iter.hasNext()) String n = ((XmlParser.Node) iter.next()).toString(false, true); names.add(n); while(iter.hasNext()) String d=((XmlParser.Node)iter.next()).toString(false,true); dispatches.add(FilterMapping.dispatch(d));
public void processAfters (XmlParser.Node ordering) { //Process the <after> elements, look for an <others/> clause and all of the <name/> clauses XmlParser.Node after = ordering.get("after"); if (after == null) return; Iterator<?> iter = after.iterator(); XmlParser.Node node = null; while (iter.hasNext()) { Object o = iter.next(); if (!(o instanceof XmlParser.Node)) continue; node = (XmlParser.Node) o; if (node.getTag().equalsIgnoreCase("others")) { if (_otherType != OtherType.None) throw new IllegalStateException("Duplicate <other> clause detected in "+_xml.getURI()); _otherType = OtherType.After; } else if (node.getTag().equalsIgnoreCase("name")) _afters.add(node.toString(false,true)); } }
public void processName () { XmlParser.Node root = getRoot(); XmlParser.Node nameNode = root.get("name"); _name = NAMELESS+(_counter++); if (nameNode != null) { String tmp = nameNode.toString(false,true); if (tmp!=null && tmp.length()>0) _name = tmp; } } @Override
public void visitSecurityRole(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { if (context.getSecurityHandler() == null) { LOG.warn("security-role declared but SecurityHandler==null"); return; } //ServletSpec 3.0, p74 elements with multiplicity >1 are additive when merged XmlParser.Node roleNode = node.get("role-name"); String role = roleNode.toString(false, true); ((ConstraintAware)context.getSecurityHandler()).addRole(role); }
public void visitDisplayName(WebAppContext context, Descriptor descriptor, XmlParser.Node node) { //Servlet Spec 3.0 p. 74 Ignore from web-fragments if (!(descriptor instanceof FragmentDescriptor)) { context.setDisplayName(node.toString(false, true)); context.getMetaData().setOrigin("display-name", descriptor); } }