Java 类javax.servlet.jsp.tagext.JspTag 实例源码

项目:geeMVC-Java-MVC-Framework    文件:FormFieldTagSupport.java   
protected FormTagSupport formTag() {
    GeemvcTagSupport currentTagSupport = this;
    JspTag parentTag = null;
    FormTagSupport formTagSupport = null;

    while ((parentTag = currentTagSupport.getParent()) != null) {
        if (parentTag instanceof FormTagSupport) {
            formTagSupport = (FormTagSupport) parentTag;
            break;
        } else if (parentTag instanceof GeemvcTagSupport) {
            currentTagSupport = (GeemvcTagSupport) parentTag;
        } else {
            break;
        }
    }

    return formTagSupport;
}
项目:packagedrone    文件:TagHandlerPool.java   
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);
}
项目:packagedrone    文件:TagHandlerPool.java   
/**
 * 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;
}
项目:packagedrone    文件:TagHandlerPool.java   
/**
 * 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);
    }
}
项目:Bootstrap.jsp    文件:NestedTagSupport.java   
@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);
}
项目:package-drone    文件:TagHandlerPool.java   
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);
}
项目:package-drone    文件:TagHandlerPool.java   
/**
 * 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;
}
项目:package-drone    文件:TagHandlerPool.java   
/**
 * 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);
    }
}
项目:TechnologyReadinessTool    文件:BaseTag.java   
@Override
public void doTag() throws JspException, IOException {
    try {
        JspTag parent = getOptionalParentTag(ParentTag.class);
        Map<String, Object> actionContext = ActionContext.getContext().getValueStack().getContext();
        if (parent != null && parent instanceof ParentTag && ((ParentTag) parent).isCollectingChildren()) {
            this.actionContext = new HashMap<>(actionContext);
            ((ParentTag) parent).getChildren().add(this);
            if (this instanceof ParentTag) {
                ((ParentTag) this).collectChildren();
            }
        } else {
            if (this instanceof ParentTag) {
                ((ParentTag) this).collectChildren();
            }
            String jspResult = execute();
            if (jspResult != null) {
                renderPage(jspResult);
            }
        }
    } catch (Exception e) {
        printStackTrace(e);
    }
}
项目:jsmart-web    文件:DropMenuTagHandler.java   
@Override
public boolean beforeTag() throws JspException, IOException {
    JspTag parent = getParent();
    if (parent instanceof ButtonTagHandler) {
        ((ButtonTagHandler) parent).setDropMenu(this);
        return false;

    } else if (parent instanceof LinkTagHandler) {
        ((LinkTagHandler) parent).setDropMenu(this);
        return false;

    } else if (parent instanceof DropDownTagHandler) {
        ((DropDownTagHandler) parent).setDropMenu(this);
        return false;
    }
    return false;
}
项目:jsmart-web    文件:LoadTagHandler.java   
@Override
public boolean beforeTag() throws JspException, IOException {
    JspTag parent = getParent();
    if (parent instanceof AutoCompleteTagHandler) {
        ((AutoCompleteTagHandler) parent).setLoadTag(this);
        return false;

    } else if (parent instanceof ButtonTagHandler) {
        ((ButtonTagHandler) parent).setLoadTag(this);
        return false;

    } else if (parent instanceof LinkTagHandler) {
        ((LinkTagHandler) parent).setLoadTag(this);
        return false;

    } else if (parent instanceof ListTagHandler) {
        ((ListTagHandler) parent).setLoadTag(this);
        return false;

    } else if (parent instanceof TableTagHandler) {
        ((TableTagHandler) parent).setLoadTag(this);
        return false;
    }
    return super.beforeTag();
}
项目:jsmart-web    文件:HeaderTagHandler.java   
@Override
public boolean beforeTag() throws JspException, IOException {
    JspTag parent = getParent();

    if (parent instanceof ModalTagHandler) {
        ((ModalTagHandler) parent).setHeader(this);
        return false;

    } else if (parent instanceof RowTagHandler) {
        ((RowTagHandler) parent).setHeader(this);
        return false;

    } else if (parent instanceof PanelTagHandler) {
        ((PanelTagHandler) parent).setHeader(this);
        return false;

    } else if (parent instanceof AlertTagHandler) {
        ((AlertTagHandler) parent).setHeader(this);
        return false;

    } else if (parent instanceof SlideTagHandler) {
        ((SlideTagHandler) parent).setHeader(this);
        return false;
    }
    return super.beforeTag();
}
项目:jsmart-web    文件:CheckListTagHandler.java   
@Override
@SuppressWarnings("unchecked")
public boolean beforeTag() throws JspException, IOException {
    JspTag parent = getParent();
    Object object = getTagValue(values);

    if (object instanceof Map) {
        Map<Object, Object> map = (Map<Object, Object>) object;

        for (Entry<Object, Object> entry : map.entrySet()) {

            CheckTagHandler check = new CheckTagHandler();
            check.setValue(entry.getKey());
            check.setLabel(entry.getValue() != null ? entry.getValue().toString() : null);

            if (parent instanceof RadioGroupTagHandler) {
                ((RadioGroupTagHandler) parent).addCheck(check);

            } else if (parent instanceof CheckGroupTagHandler) {
                ((CheckGroupTagHandler) parent).addCheck(check);
            }
        }
    }
    return false;
}
项目:jsmart-web    文件:ButtonTagHandler.java   
@Override
public boolean beforeTag() throws JspException, IOException {
    JspTag parent = getParent();
    if (parent instanceof InputTagHandler) {
        ((InputTagHandler) parent).addChildAddOn(this);
        return false;

    } else if (parent instanceof AutoCompleteTagHandler) {
        ((AutoCompleteTagHandler) parent).addChildAddOn(this);
        return false;

    } else if (parent instanceof DateTagHandler) {
        ((DateTagHandler) parent).addChildAddOn(this);
        return false;

    } else if (parent instanceof UploadTagHandler) {
        ((UploadTagHandler) parent).addChildAddOn(this);
        return false;

    } else if (parent instanceof SelectTagHandler) {
        ((SelectTagHandler) parent).addChildAddOn(this);
        return false;
    }
    return super.beforeTag();
}
项目:jsmart-web    文件:ReCaptchaTagHandler.java   
@Override
public Tag executeTag() throws JspException, IOException {

    JspTag parent = getParent();
    if (!(parent instanceof FormTagHandler) && !(parent instanceof RestTagHandler)) {
        throw ConstraintTagException.fromConstraint("recaptcha", "Tag must be placed inside [form] or [rest] tag");
    }

    // Just to call nested tags
    JspFragment body = getJspBody();
    if (body != null) {
        body.invoke(null);
    }

    setRandomId("recaptcha");

    // ReCaptcha V2
    if (version.equals(ReCaptchaHandler.RECAPTCHA_V2)) {
        return executeRecaptchaV2(parent);
    }
    // ReCaptcha V1
    return executeRecaptchaV1(parent);
}
项目:jsmart-web    文件:OptionsTagHandler.java   
@SuppressWarnings("unchecked")
@Override
public boolean beforeTag() throws JspException, IOException {
    JspTag parent = getParent();
    Object object = getTagValue(values);

    if (object instanceof Map) {
        Map<Object, Object> map = (Map<Object, Object>) object;

        for (Entry<Object, Object> entry : map.entrySet()) {

            OptionTagHandler option = new OptionTagHandler();
            option.setValue(entry.getKey());
            option.setLabel(entry.getValue() != null ? entry.getValue().toString() : null);

            if (parent instanceof SelectTagHandler) {
                ((SelectTagHandler) parent).addOption(option);
            }
        }
    }
    return true;
}
项目:jsmart-web    文件:EmptyTagHandler.java   
@Override
public boolean beforeTag() throws JspException, IOException {
    JspTag parent = getParent();
    if (parent instanceof ListTagHandler) {
        ((ListTagHandler) parent).setEmptyTag(this);

    } else if (parent instanceof TableTagHandler) {
        ((TableTagHandler) parent).setEmptyTag(this);

    } else if (parent instanceof AccordionTagHandler) {
        ((AccordionTagHandler) parent).setEmptyTag(this);

    } else if (parent instanceof RepeatTagHandler) {
        ((RepeatTagHandler) parent).setEmptyTag(this);
    }
    return false;
}
项目:sinavi-jfw    文件:NestedParameterTag.java   
/**
 * {@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());
    }

}
项目:Runway-SDK    文件:ContextTagSupport.java   
@Override
public void doTag() throws JspException, IOException
{
  JspTag parent = this.getParent();

  if (parent instanceof TableTagSupport)
  {
    if (this.getJspBody() != null)
    {
      this.getJspBody().invoke(null);
    }

    Table table = (Table) ( (TableTagSupport) parent ).getColumnar();

    table.setContext(context);
  }
}
项目:Runway-SDK    文件:HeaderTagSupport.java   
@Override
public void doTag() throws JspException, IOException
{
  JspTag column = findAncestorWithClass(this, ColumnTagIF.class);

  if(column != null && this.getJspBody() != null)
  {
    ColumnTagIF columnTag = ((ColumnTagIF) column);      
    Entry header = columnTag.getColumn().getHeader();

    if(this.getJspBody() != null)
    {
      this.getJspBody().invoke(header.getWriter());
    }

    header.setPopulated(true);
  }    
}
项目:Runway-SDK    文件:PageTagSupport.java   
@Override
public void doTag() throws JspException, IOException
{
  JspTag tag = SimpleTagSupport.findAncestorWithClass(this, PaginationTagSupport.class);

  if(tag != null)
  {
    Page page = ((PaginationTagSupport) tag).getCurrent();

    if(!page.getLeftGap() && !page.getRightGap())
    {
      // Print out a text marker which will replaced with the appropriate page number
      // when the pagination data structure is processed
      this.getJspContext().getOut().print(Pagination.PAGE_MARKER);
    }
  }
}
项目:Runway-SDK    文件:StructColumnTagSupport.java   
/**
 * (non-Javadoc)
 *
 * @see
 * com.runwaysdk.controller.tag.ColumnableTagIF#next(java.lang.String)
 */
public void next(String attributeName)
{
  JspTag table = findAncestorWithClass(this, TableTagSupport.class);

  if (table != null)
  {
    TableTagSupport tableTagSupport = ( (TableTagSupport) table );
    tableTagSupport.next(null);

    // Set current value
    // TODO use type safe getter
    if (this.hasNext())
    {
      setScopedAttributes(attributeName);
    }
  }
}
项目:Runway-SDK    文件:StructColumnTagSupport.java   
public AttributeDTO getAttributeDTO(String name)
{
  JspTag ancestor = findAncestorWithClass(this, TableTagSupport.class);
  TableTagSupport table = ( (TableTagSupport) ancestor );

  if (table != null)
  {
    AttributeStructDTO structDTO = (AttributeStructDTO) table.getAttributeDTO(attributeName);

    if (structDTO != null)
    {
      return structDTO.getAttributeDTO(name);
    }
  }

  return null;
}
项目:Runway-SDK    文件:FreeColumnTagSupport.java   
@Override
public void doTag() throws JspException, IOException
{
  JspTag parent = findAncestorWithClass(this, ColumnableTagIF.class);

  if (parent != null)
  {
    ColumnableTagIF table = ( (ColumnableTagIF) parent );

    if (this.getJspBody() != null)
    {
      this.getJspBody().invoke(column.getWriter());
    }

    table.getColumnar().addColumn(column);
  }
}
项目:geeMVC-Java-MVC-Framework    文件:SectionTagSupport.java   
@Override
public void doTag() throws JspException, IOException {
    PageContext pageCtx = ((PageContext) jspContext);
    LayoutContext layoutCtx = (LayoutContext) pageCtx.getAttribute(LayoutContext.KEY, PageContext.REQUEST_SCOPE);

    JspTag parentLayoutTag = getParent();

    if (parentLayoutTag == null)
        throw new IllegalStateException(
                "The section tag must have a parent tag of either 'LayoutTagSupport' (<h:layout><h:section name=\"content\"></h:section></h:layout>) or 'UseLayoutTagSupport' (<h:use layout=\"layout.jsp\"><h:section name=\"content\"></h:section></h:use).");

    if (parentLayoutTag instanceof LayoutTagSupport) {
        // Checks if this section has previously already been rendered by the "use" layout tag, which overrides the
        // original layout version.
        if (layoutCtx.hasSection(name))
            pageCtx.getOut().write(layoutCtx.section(name));

            // No overridden version exists, so we just render the one from the original layout.
        else
            pageCtx.getOut().write(getBodyContent());
    }
    // When a section is being rendered from within the "use" layout tag, we simply remember the result for later
    // when it comes to rendering the complete layout. This version will have precedence over the original layout
    // version.
    else if (parentLayoutTag instanceof UseLayoutTagSupport) {
        layoutCtx.putSection(name, getBodyContent());
    } else {
        throw new IllegalStateException("The section tag can only have 'LayoutTagSupport' (<h:layout></h:layout>) or 'UseLayoutTagSupport' (<h:use layout=\"layout.jsp\"></h:use) as its parent tag.");
    }
}
项目:beyondj    文件:JspFragmentHelper.java   
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;
}
项目:packagedrone    文件:JspFragmentHelper.java   
public JspFragmentHelper( int discriminator, JspContext jspContext, 
    JspTag parentTag ) 
{
    this.discriminator = discriminator;
    this.jspContext = jspContext;
    this._jspx_page_context = null;
    if( jspContext instanceof PageContext ) {
        _jspx_page_context = (PageContext)jspContext;
    }
    this.parentTag = parentTag;
}
项目:Bootstrap.jsp    文件:Dropdown.java   
@Override
public void setParent(JspTag parent) {
    if (parent instanceof Nav) {
        super.setElement("li");
    }
    super.setParent(parent);
}
项目:Bootstrap.jsp    文件:Container.java   
@Override
public void setParent(JspTag parent) {
    if (parent instanceof Container) {
        throw new IllegalArgumentException("Bootstrap containers may not be nested");
    }
    super.setParent(parent);
}
项目:Bootstrap.jsp    文件:CarouselControl.java   
@Override
public void setParent(JspTag parent) {
    if (parent != null) {
        final Carousel carousel = (Carousel) parent;
        super.setAttribute("href", "#" + carousel.getId(true));
    }
}
项目:Bootstrap.jsp    文件:CarouselItem.java   
@Override
public void setParent(JspTag parent) {
    if (parent != null) {
        if (parent instanceof Carousel) {
            ((Carousel) parent).addItem(this);
        }
    }
    super.setParent(parent);
}
项目:Bootstrap.jsp    文件:CarouselIndicators.java   
@Override
public void setParent(JspTag parent) {
    if (parent instanceof Carousel) {
        this.carousel = (Carousel) parent;
    }
    super.setParent(parent);
}
项目:Bootstrap.jsp    文件:Button.java   
@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();
}
项目:Bootstrap.jsp    文件:NavbarButton.java   
@Override
public void setParent(JspTag parent) {
    if (parent instanceof Nav) {
        super.setElement("li");
    }
    super.setParent(parent);
}
项目:class-guard    文件:JspFragmentHelper.java   
public JspFragmentHelper( int discriminator, JspContext jspContext, 
    JspTag parentTag ) 
{
    this.discriminator = discriminator;
    this.jspContext = jspContext;
    this._jspx_page_context = null;
    if( jspContext instanceof PageContext ) {
        _jspx_page_context = (PageContext)jspContext;
    }
    this.parentTag = parentTag;
}
项目:package-drone    文件:JspFragmentHelper.java   
public JspFragmentHelper( int discriminator, JspContext jspContext, 
    JspTag parentTag ) 
{
    this.discriminator = discriminator;
    this.jspContext = jspContext;
    this._jspx_page_context = null;
    if( jspContext instanceof PageContext ) {
        _jspx_page_context = (PageContext)jspContext;
    }
    this.parentTag = parentTag;
}
项目:apache-tomcat-7.0.57    文件:JspFragmentHelper.java   
public JspFragmentHelper( int discriminator, JspContext jspContext, 
    JspTag parentTag ) 
{
    this.discriminator = discriminator;
    this.jspContext = jspContext;
    this._jspx_page_context = null;
    if( jspContext instanceof PageContext ) {
        _jspx_page_context = (PageContext)jspContext;
    }
    this.parentTag = parentTag;
}
项目:apache-tomcat-7.0.57    文件:JspFragmentHelper.java   
public JspFragmentHelper( int discriminator, JspContext jspContext, 
    JspTag parentTag ) 
{
    this.discriminator = discriminator;
    this.jspContext = jspContext;
    this._jspx_page_context = null;
    if( jspContext instanceof PageContext ) {
        _jspx_page_context = (PageContext)jspContext;
    }
    this.parentTag = parentTag;
}
项目:CryptMeme    文件:AttachmentTag.java   
@Override
public int doEndTag() {
    JspTag parent = findAncestorWithClass(this, SendEmailTag.class);
    if (parent instanceof SendEmailTag) {
        SendEmailTag sendEmailTag = (SendEmailTag)parent;
        sendEmailTag.addAttachment(origFilename, tempFilename);
    }
    else
        log.error("No SendEmailTag ancestor found. Ancestor: " + parent);

    return EVAL_PAGE;
}
项目:CryptMeme    文件:ParamTag.java   
@Override
public int doEndTag() {
    JspTag parent = findAncestorWithClass(this, MessageTag.class);
    if (parent instanceof MessageTag) {
        MessageTag messageTag = (MessageTag)parent;
        if (value == null)
            messageTag.addParameter(getBodyContent().getString());
        else
            messageTag.addParameter(value);
    }
    else
        log.error("No MessageTag ancestor found. Ancestor: " + parent);

    return EVAL_PAGE;
}