javax.servlet.jsp.tagext.JspTag Java Examples
The following examples show how to use
javax.servlet.jsp.tagext.JspTag.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JspContextWrapper.java From Tomcat8-Source-Read with MIT License | 6 votes |
public JspContextWrapper(JspTag jspTag, JspContext jspContext, ArrayList<String> nestedVars, ArrayList<String> atBeginVars, ArrayList<String> atEndVars, Map<String,String> aliases) { this.jspTag = jspTag; this.invokingJspCtxt = (PageContext) jspContext; if (jspContext instanceof JspContextWrapper) { rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt; } else { rootJspCtxt = invokingJspCtxt; } this.nestedVars = nestedVars; this.atBeginVars = atBeginVars; this.atEndVars = atEndVars; this.pageAttributes = new HashMap<>(16); this.aliases = aliases; if (nestedVars != null) { this.originalNestedVars = new HashMap<>(nestedVars.size()); } else { this.originalNestedVars = null; } syncBeginTagFile(); }
Example #2
Source File: NestedTagSupport.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void setParent(JspTag parent) { if (parent != null && this.parents.size() > 0) { boolean valid = false; for (Class<? extends BaseTag> clazz : this.parents) { if (clazz.isAssignableFrom(parent.getClass())) { valid = true; break; } } if (!valid) { final StringBuilder error = new StringBuilder("Invalid parent for "); error.append(this).append(": ").append(parent); throw new IllegalArgumentException(error.toString()); } } this.parent = parent; super.setParent(parent); }
Example #3
Source File: JspUtils.java From velocity-tools with Apache License 2.0 | 6 votes |
/** * If necessary, wraps a {@link SimpleTag} into a {@link Tag}. * * @param tag The tag to (possibly) wrap. * @return The wrapped tag, or the tag passed as parameter if it was not necessary. */ public static Tag wrapTag(JspTag tag) { if (tag == null) { return null; } if (tag instanceof Tag) { return (Tag) tag; } if (tag instanceof SimpleTag) { return new TagAdapter((SimpleTag) tag); } throw new VelocityToolsJspException( "Cannot get tag that is not a Tag nor a SimpleTag, class " + tag.getClass().getCanonicalName()); }
Example #4
Source File: NestedParameterTag.java From sinavi-jfw with Apache License 2.0 | 6 votes |
/** * {@link ParameterAware}を探して、コールバックします。 * まず、直接の親タグが{@link ParameterAware}かどうか判定します。 * そうであれば、コールバックして終了します。 * もし、直接の親タグが{@link ParameterAware}ない場合、 * {@link SimpleTagSupport#findAncestorWithClass(JspTag, Class)}を利用して、 * ルートまで{@link ParameterAware}を探して辿ります。 * それでも見つからない場合、処理を終了します。 * @throws JspException {@link JspException} * @throws IOException {@link IOException} */ @Override public void doTag() throws JspException, IOException { super.doTag(); Args.checkNotEmpty(getName()); JspTag s = getParent(); if (!ParameterAware.class.isInstance(s)) { s = SimpleTagSupport.findAncestorWithClass(this, ParameterAware.class); } if (s == null) return; ParameterAware parent = (ParameterAware) s; if (getValues() != null) { parent.awareParameter(name, getValues()); } else { parent.awareParameter(name, getValue()); } }
Example #5
Source File: TagHandlerPool.java From packagedrone with Eclipse Public License 1.0 | 6 votes |
/** * Adds the given tag handler to this tag handler pool, unless this tag * handler pool has already reached its capacity, in which case the tag * handler's release() method is called. * * @param handler JspTag handler to add to this tag handler pool */ public void reuse(JspTag handler) { synchronized( this ) { if (current < (handlers.length - 1)) { handlers[++current] = handler; return; } } // There is no need for other threads to wait for us to release if (handler instanceof Tag) { ((Tag)handler).release(); } if (resourceInjector != null) { resourceInjector.preDestroy(handler); } }
Example #6
Source File: TagHandlerPool.java From packagedrone with Eclipse Public License 1.0 | 6 votes |
/** * Gets the next available tag handler from this tag handler pool, * instantiating one if this tag handler pool is empty. * * @param handlerClass Tag handler class * * @return Reused or newly instantiated tag handler * * @throws JspException if a tag handler cannot be instantiated */ public <T extends JspTag> JspTag get(Class<T> handlerClass) throws JspException { synchronized( this ) { if (current >= 0) { return handlers[current--]; } } // Out of sync block - there is no need for other threads to // wait for us to construct a tag for this thread. JspTag tagHandler = null; try { if (resourceInjector != null) { tagHandler = resourceInjector.createTagHandlerInstance( handlerClass); } else { tagHandler = handlerClass.newInstance(); } } catch (Exception e) { throw new JspException(e.getMessage(), e); } return tagHandler; }
Example #7
Source File: TagHandlerPool.java From packagedrone with Eclipse Public License 1.0 | 6 votes |
protected void init( ServletConfig config ) { int maxSize=-1; String maxSizeS=getOption(config, OPTION_MAXSIZE, null); if( maxSizeS != null ) { try { maxSize=Integer.parseInt(maxSizeS); } catch( Exception ex) { maxSize=-1; } } if( maxSize <0 ) { maxSize=Constants.MAX_POOL_SIZE; } this.handlers = new JspTag[maxSize]; this.current = -1; this.resourceInjector = (ResourceInjector) config.getServletContext().getAttribute( Constants.JSP_RESOURCE_INJECTOR_CONTEXT_ATTRIBUTE); }
Example #8
Source File: Dropdown.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setParent(JspTag parent) { if (parent instanceof Nav) { super.setElement("li"); } super.setParent(parent); }
Example #9
Source File: Container.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setParent(JspTag parent) { if (parent instanceof Container) { throw new IllegalArgumentException("Bootstrap containers may not be nested"); } super.setParent(parent); }
Example #10
Source File: CarouselControl.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setParent(JspTag parent) { if (parent != null) { final Carousel carousel = (Carousel) parent; super.setAttribute("href", "#" + carousel.getId(true)); } }
Example #11
Source File: CarouselItem.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setParent(JspTag parent) { if (parent != null) { if (parent instanceof Carousel) { ((Carousel) parent).addItem(this); } } super.setParent(parent); }
Example #12
Source File: CarouselIndicators.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setParent(JspTag parent) { if (parent instanceof Carousel) { this.carousel = (Carousel) parent; } super.setParent(parent); }
Example #13
Source File: Button.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void doTag() throws JspException, IOException { final JspTag parent = super.getParent(); if (parent instanceof ButtonGroup) { final ButtonGroup buttonGroup = (ButtonGroup) parent; if (buttonGroup.getFacet(JustifiedFacet.class).getValue()) { if ("button".equals(super.getElement())) { super.wrapIn(new ButtonGroup()); return; } } } super.doTag(); }
Example #14
Source File: NavbarButton.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void setParent(JspTag parent) { if (parent instanceof Nav) { super.setElement("li"); } super.setParent(parent); }
Example #15
Source File: CdiPlugin.java From tomee with Apache License 2.0 | 5 votes |
@Override public boolean isEEComponent(final Class<?> impl) { return Servlet.class.isAssignableFrom(impl) || Filter.class.isAssignableFrom(impl) || ServletContextListener.class.isAssignableFrom(impl) || JspTag.class.isAssignableFrom(impl); }
Example #16
Source File: JspUtilsTest.java From velocity-tools with Apache License 2.0 | 5 votes |
/** * Test method for {@link org.apache.velocity.tools.view.jsp.jspimpl.JspUtils#setLatestTag(org.apache.velocity.context.Context, javax.servlet.jsp.tagext.JspTag)}. */ @Test public void testSetLatestTag() { Context context = createMock(Context.class); JspTag tag = createMock(JspTag.class); expect(context.put(LATEST_TAG_ATTRIBUTE_NAME, tag)).andReturn(null); replay(context, tag); JspUtils.setLatestTag(context, tag); verify(context, tag); }
Example #17
Source File: JspUtilsTest.java From velocity-tools with Apache License 2.0 | 5 votes |
/** * Test method for {@link org.apache.velocity.tools.view.jsp.jspimpl.JspUtils#getLatestJspTag(org.apache.velocity.context.Context)}. */ @Test public void testGetLatestJspTag() { Context context = createMock(Context.class); JspTag tag = createMock(JspTag.class); expect(context.get(LATEST_TAG_ATTRIBUTE_NAME)).andReturn(tag); replay(context, tag); assertSame(tag, JspUtils.getLatestJspTag(context)); verify(context, tag); }
Example #18
Source File: JspFragmentHelper.java From Tomcat8-Source-Read with MIT License | 5 votes |
public JspFragmentHelper( int discriminator, JspContext jspContext, JspTag parentTag ) { this.discriminator = discriminator; this.jspContext = jspContext; if(jspContext instanceof PageContext) { _jspx_page_context = (PageContext)jspContext; } else { _jspx_page_context = null; } this.parentTag = parentTag; }
Example #19
Source File: JspContextWrapper.java From Tomcat8-Source-Read with MIT License | 4 votes |
private ELContextWrapper(ELContext wrapped, JspTag jspTag, PageContext pageContext) { this.wrapped = wrapped; this.jspTag = jspTag; this.pageContext = pageContext; }
Example #20
Source File: NestedTagSupport.java From Bootstrap.jsp with GNU Lesser General Public License v2.1 | 4 votes |
public JspTag getParent() { return this.parent; }
Example #21
Source File: JspFragmentHelper.java From packagedrone with Eclipse Public License 1.0 | 4 votes |
public JspTag getParentTag() { return this.parentTag; }
Example #22
Source File: JspFragmentHelper.java From tomcatsrc with Apache License 2.0 | 4 votes |
public JspTag getParentTag() { return this.parentTag; }
Example #23
Source File: JspFragmentHelper.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
public JspTag getParentTag() { return this.parentTag; }
Example #24
Source File: BookLocationTag.java From Online-Library-System with GNU General Public License v2.0 | 4 votes |
public JspTag getParent() { return null; }
Example #25
Source File: SearchByTag.java From Online-Library-System with GNU General Public License v2.0 | 4 votes |
public JspTag getParent() { return null; }
Example #26
Source File: JspFragmentHelper.java From Tomcat8-Source-Read with MIT License | 4 votes |
public JspTag getParentTag() { return this.parentTag; }
Example #27
Source File: ResourceInjector.java From packagedrone with Eclipse Public License 1.0 | 2 votes |
/** * Invokes any @PreDestroy methods defined on the instance's class * (and super-classes). * * @param handler The tag handler instance whose @PreDestroy methods * to call */ public void preDestroy(JspTag handler);
Example #28
Source File: ResourceInjector.java From packagedrone with Eclipse Public License 1.0 | 2 votes |
/** * Instantiates and injects the given tag handler class. * * @param clazz the tag handler class to be instantiated and injected * * @throws Exception if an error has occurred during instantiation or * injection */ public <T extends JspTag> T createTagHandlerInstance(Class<T> clazz) throws Exception;
Example #29
Source File: TagHandlerPool.java From packagedrone with Eclipse Public License 1.0 | 2 votes |
/** * Constructs a tag handler pool with the given capacity. * * @param capacity Tag handler pool capacity * @deprecated Use static getTagHandlerPool */ public TagHandlerPool(int capacity) { this.handlers = new JspTag[capacity]; this.current = -1; }
Example #30
Source File: BookLocationTag.java From Online-Library-System with GNU General Public License v2.0 | 2 votes |
public void setParent(JspTag arg0) { }