List of usage examples for javax.servlet.jsp.tagext Tag getClass
@HotSpotIntrinsicCandidate public final native Class<?> getClass();
From source file:org.hdiv.web.util.TagUtils.java
/** * Determine whether the supplied {@link Tag} has any ancestor tag of the * supplied type./* w w w. j a v a 2s. c o m*/ * * @param tag the tag whose ancestors are to be checked * @param ancestorTagClass the ancestor {@link Class} being searched for * @return <code>true</code> if the supplied {@link Tag} has any ancestor * tag of the supplied type * @throws IllegalArgumentException if either of the supplied arguments is * <code>null</code>; or if the supplied * <code>ancestorTagClass</code> is not type-assignable to the * {@link Tag} class */ public static Tag getAncestorOfType(Tag tag, Class ancestorTagClass) { Assert.notNull(tag, "Tag cannot be null"); Assert.notNull(ancestorTagClass, "Ancestor tag class cannot be null"); if (!Tag.class.isAssignableFrom(ancestorTagClass)) { throw new IllegalArgumentException( "Class '" + ancestorTagClass.getName() + "' is not a valid Tag type"); } Tag ancestor = tag.getParent(); while (ancestor != null) { if (ancestorTagClass.isAssignableFrom(ancestor.getClass())) { return ancestor; } ancestor = ancestor.getParent(); } return null; }
From source file:net.mlw.vlh.web.util.JspUtils.java
public static Tag getParent(Tag self, Class klass) throws JspException { Tag tag = self.getParent(); while (!(klass.isAssignableFrom(tag.getClass()))) { tag = tag.getParent();/*from w ww . j a va 2s . com*/ if (tag == null) { final String message = "Parent tag of class " + klass + " of the tag's class " + self + " was not found."; LOGGER.error(message); throw new JspException(message); } } return tag; }
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
public static void afterBody(ChildPageContext ctx) throws Exception { Pair<Tag, Integer> tt = ctx.getTagStack().lastElement(); Tag t = tt.getFirst(); if (log.isDebugEnabled() == true) log.debug("afterBody: " + t.getClass().getName()); if (tt.getSecond() != Tag.EVAL_BODY_INCLUDE && tt.getSecond() != javax.servlet.jsp.tagext.Tag.SKIP_BODY && t instanceof BodyTag) { JspWriter couts = ctx.popBody(); // JspWriter cout = ctx.getPageContext().getOut(); // TODO Rx minor new PrintWriter costs a lot because: // public PrintWriter(Writer out, // boolean autoFlush) { // super(out); // this.out = out; // this.autoFlush = autoFlush; // ooohhhh // lineSeparator = (String) java.security.AccessController.doPrivileged( // new sun.security.action.GetPropertyAction("line.separator")); // }//from ww w. j a v a 2s. c o m PrintWriterPatched nout = createPrintWriter(couts); ctx.setInternalGroovyOut(nout); // ctx.getBinding().setProperty("out", nout); } }
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
/** * @return if return false page will be skipped *///from ww w. ja v a2s. c o m public static boolean initSimpleTag(Tag tag, List<Object> attributes, ChildPageContext ctx) throws Exception { if (log.isDebugEnabled()) log.debug("Init simple tag: " + tag.getClass().getName()); Tag ptag = ctx.getCurrentTag(); PageContext pctx = ctx;// .getBrickContext().getPageContext(); if (ctx.isUseParentTagContext() == true) pctx = ctx.getParentPageContext(); tag.setPageContext(pctx); tag.setParent(ptag); attributes = evalAttributes(tag, attributes, ctx); setAttributes(tag, attributes, ctx); ctx.setCurrentTag(tag); int r = tag.doStartTag(); // ctx.getTagStack().push(new Pair<Tag, Integer>(tag, r)); r = tag.doEndTag(); // ctx.getTagStack().pop(); ctx.setCurrentTag(ptag); return r != javax.servlet.jsp.tagext.Tag.SKIP_PAGE; }
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
/** * @return true if body should be included */// w w w . j av a2s.c o m public static boolean initTag(Tag tag, List<Object> attributes, ChildPageContext ctx) throws Exception { Tag ptag = ctx.getCurrentTag(); if (log.isDebugEnabled()) log.debug("Init tag: " + tag.getClass().getName()); PageContext pctx = ctx; if (ctx.isUseParentTagContext() == true) pctx = ctx.getParentPageContext(); tag.setPageContext(pctx); tag.setParent(ptag); attributes = evalAttributes(tag, attributes, ctx); setAttributes(tag, attributes, ctx); ctx.setCurrentTag(tag); int r = tag.doStartTag(); ctx.getTagStack().push(new Pair<Tag, Integer>(tag, r)); JspWriter oout = pctx.getOut(); ctx.setInternalGroovyOut(createPrintWriter(oout)); if (r != javax.servlet.jsp.tagext.Tag.SKIP_BODY && r != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE && tag instanceof BodyTag) { BodyTag btag = (BodyTag) tag; JspWriter out = pctx.pushBody(); PrintWriterPatched newPout = createPrintWriter(out, true); ctx.setInternalGroovyOut(newPout); btag.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out); btag.doInitBody(); } boolean ret = r != javax.servlet.jsp.tagext.Tag.SKIP_BODY; if (log.isDebugEnabled()) log.debug("Init tag: " + tag.getClass().getName() + ": " + ret); return ret; }
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
public static boolean continueAfterBody(ChildPageContext ctx) throws Exception { if (ctx.getTagStack().size() == 0) return false; Pair<Tag, Integer> tt = ctx.getTagStack().lastElement(); Tag t = tt.getFirst(); boolean ret = false; if (t instanceof IterationTag) { IterationTag bt = (IterationTag) t; int r = bt.doAfterBody(); ret = javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN == r; }/*w w w . j a v a 2 s. c o m*/ if (log.isDebugEnabled() == true) log.debug("continueAfterBody: " + t.getClass().getName() + ": " + ret); return ret; }
From source file:de.micromata.genome.gwiki.page.gspt.TagSupport.java
/** * @return true if continue//from www . jav a2s. c o m */ public static boolean endTag(ChildPageContext ctx) throws Exception { Pair<Tag, Integer> tt = ctx.getTagStack().pop(); Tag t = tt.getFirst(); int r = t.doEndTag(); if (ctx.getTagStack().size() > 0) ctx.setCurrentTag(ctx.getTagStack().lastElement().getFirst()); else ctx.setCurrentTag(null); boolean ret = r != javax.servlet.jsp.tagext.Tag.SKIP_PAGE; if (log.isDebugEnabled() == true) log.debug("endTag: " + t.getClass().getName() + ": " + ret); return ret; }
From source file:com.adito.core.CoreUtil.java
/** * @param clazz// www. j ava2s.co m * @param tag * @return Tag */ public static Tag getParentTagOfClass(Class clazz, Tag tag) { while ((tag = tag.getParent()) != null) { if (tag.getClass().equals(clazz)) { return tag; } } return null; }
From source file:org.seasar.mayaa.impl.engine.processor.JspProcessor.java
/** * customTag?????/* w w w . ja v a 2 s . c o m*/ * customTag?SimpleTagWrapper?????SimpleTag? * ???? * * @param customTag ?? * @return customTag? */ private Class getTagClass(Tag customTag) { if (customTag instanceof SimpleTagWrapper) { return ((SimpleTagWrapper) customTag).getSimpleTag().getClass(); } return customTag.getClass(); }