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

项目:tomcat7    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:parabuild-ci    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:parabuild-ci    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:apache-tomcat-7.0.73-with-comment    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:apache-tomcat-7.0.73-with-comment    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:beyondj    文件:UseActionBeanTagExtraInfo.java   
/**
 * Checks to ensure that where the tag supports providing one of two attributes
 * that one and only one is provided.
 */
@Override public ValidationMessage[] validate(final TagData tag) {
    Collection<ValidationMessage> errors = new ArrayList<ValidationMessage>();

    Object beanclass = tag.getAttribute("beanclass");
    Object binding   = tag.getAttribute("binding");
    if (!(beanclass != null ^ binding != null)) {
        errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'beanclass' or 'binding' must be supplied."));
    }

    String var = tag.getAttributeString("var");
    String id  = tag.getAttributeString("id");
    if (!(var != null ^ id != null)) {
        errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'var' or 'id' must be supplied."));
    }

    return errors.toArray(new ValidationMessage[errors.size()]);
}
项目:packagedrone    文件:TagLibraryInfoImpl.java   
/**
    * Translation-time validation of the XML document
    * associated with the JSP page.
    * This is a convenience method on the associated 
    * TagLibraryValidator class.
    *
    * @param thePage The JSP page object
    * @return A string indicating whether the page is valid or not.
    */
   public ValidationMessage[] validate(PageData thePage) {
TagLibraryValidator tlv = getTagLibraryValidator();
if (tlv == null) return null;

       String uri = getURI();
       if (uri.startsWith("/")) {
           uri = URN_JSPTLD + uri;
       }

       ValidationMessage[] messages = tlv.validate(getPrefixString(), uri,
                                                   thePage);
       tlv.release();

       return messages;
   }
项目:nabs    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:class-guard    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:package-drone    文件:TagLibraryInfoImpl.java   
/**
    * Translation-time validation of the XML document
    * associated with the JSP page.
    * This is a convenience method on the associated 
    * TagLibraryValidator class.
    *
    * @param thePage The JSP page object
    * @return A string indicating whether the page is valid or not.
    */
   public ValidationMessage[] validate(PageData thePage) {
TagLibraryValidator tlv = getTagLibraryValidator();
if (tlv == null) return null;

       String uri = getURI();
       if (uri.startsWith("/")) {
           uri = URN_JSPTLD + uri;
       }

       ValidationMessage[] messages = tlv.validate(getPrefixString(), uri,
                                                   thePage);
       tlv.release();

       return messages;
   }
项目:apache-tomcat-7.0.57    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:apache-tomcat-7.0.57    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:WBSAirback    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:WBSAirback    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:stripes    文件:UseActionBeanTagExtraInfo.java   
/**
 * Checks to ensure that where the tag supports providing one of two attributes
 * that one and only one is provided.
 */
@Override public ValidationMessage[] validate(final TagData tag) {
    Collection<ValidationMessage> errors = new ArrayList<ValidationMessage>();

    Object beanclass = tag.getAttribute("beanclass");
    Object binding   = tag.getAttribute("binding");
    if (!(beanclass != null ^ binding != null)) {
        errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'beanclass' or 'binding' must be supplied."));
    }

    String var = tag.getAttributeString("var");
    String id  = tag.getAttributeString("id");
    if (!(var != null ^ id != null)) {
        errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'var' or 'id' must be supplied."));
    }

    return errors.toArray(new ValidationMessage[errors.size()]);
}
项目:orbeon-forms    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:stripesframework    文件:UseActionBeanTagExtraInfo.java   
/**
 * Checks to ensure that where the tag supports providing one of two attributes
 * that one and only one is provided.
 */
@Override public ValidationMessage[] validate(final TagData tag) {
    Collection<ValidationMessage> errors = new ArrayList<ValidationMessage>();

    Object beanclass = tag.getAttribute("beanclass");
    Object binding   = tag.getAttribute("binding");
    if (!(beanclass != null ^ binding != null)) {
        errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'beanclass' or 'binding' must be supplied."));
    }

    String var = tag.getAttributeString("var");
    String id  = tag.getAttributeString("id");
    if (!(var != null ^ id != null)) {
        errors.add(new ValidationMessage(tag.getId(), "Exactly one of 'var' or 'id' must be supplied."));
    }

    return errors.toArray(new ValidationMessage[errors.size()]);
}
项目:tomcat7-eap6-examples    文件:DebugValidator.java   
/**
 * Validate a JSP page.  This will get invoked once per directive in the
 * JSP page.  This method will return <code>null</code> if the page is
 * valid; otherwise the method should return an array of
 * <code>ValidationMessage</code> objects.  An array of length zero is
 * also interpreted as no errors.
 *
 * @param prefix The value of the prefix argument in this directive
 * @param uri The value of the URI argument in this directive
 * @param page The page data for this page
 */
@Override
public ValidationMessage[] validate(String prefix, String uri,
                                    PageData page) {

    System.out.println("---------- Prefix=" + prefix + " URI=" + uri +
                       "----------");

    InputStream is = page.getInputStream();
    while (true) {
        try {
            int ch = is.read();
            if (ch < 0)
                break;
            System.out.print((char) ch);
        } catch (IOException e) {
            break;
        }
    }
    System.out.println();
    System.out.println("-----------------------------------------------");
    return (null);

}
项目:tomcat7    文件:Validator.java   
@Override
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
    if (errors != null && errors.length != 0) {
        StringBuilder errMsg = new StringBuilder();
        errMsg.append("<h3>");
        errMsg.append(Localizer.getMessage(
                "jsp.error.tei.invalid.attributes", n.getQName()));
        errMsg.append("</h3>");
        for (int i = 0; i < errors.length; i++) {
            errMsg.append("<p>");
            if (errors[i].getId() != null) {
                errMsg.append(errors[i].getId());
                errMsg.append(": ");
            }
            errMsg.append(errors[i].getMessage());
            errMsg.append("</p>");
        }

        err.jspError(n, errMsg.toString());
    }

    visitBody(n);
}
项目:tomcat7    文件:TagLibraryInfoImpl.java   
/**
 * Translation-time validation of the XML document associated with the JSP
 * page. This is a convenience method on the associated TagLibraryValidator
 * class.
 * 
 * @param thePage
 *            The JSP page object
 * @return A string indicating whether the page is valid or not.
 */
public ValidationMessage[] validate(PageData thePage) {
    TagLibraryValidator tlv = getTagLibraryValidator();
    if (tlv == null)
        return null;

    String uri = getURI();
    if (uri.startsWith("/")) {
        uri = URN_JSPTLD + uri;
    }

    return tlv.validate(getPrefixString(), uri, thePage);
}
项目:lams    文件:Validator.java   
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
    if (errors != null && errors.length != 0) {
        StringBuffer errMsg = new StringBuffer();
        errMsg.append("<h3>");
        errMsg.append(Localizer.getMessage(
                "jsp.error.tei.invalid.attributes", n.getQName()));
        errMsg.append("</h3>");
        for (int i = 0; i < errors.length; i++) {
            errMsg.append("<p>");
            if (errors[i].getId() != null) {
                errMsg.append(errors[i].getId());
                errMsg.append(": ");
            }
            errMsg.append(errors[i].getMessage());
            errMsg.append("</p>");
        }

        err.jspError(n, errMsg.toString());
    }

    visitBody(n);
}
项目:lams    文件:TagLibraryInfoImpl.java   
/**
 * Translation-time validation of the XML document associated with the JSP
 * page. This is a convenience method on the associated TagLibraryValidator
 * class.
 * 
 * @param thePage
 *            The JSP page object
 * @return A string indicating whether the page is valid or not.
 */
public ValidationMessage[] validate(PageData thePage) {
    TagLibraryValidator tlv = getTagLibraryValidator();
    if (tlv == null)
        return null;

    String uri = getURI();
    if (uri.startsWith("/")) {
        uri = URN_JSPTLD + uri;
    }

    return tlv.validate(getPrefixString(), uri, thePage);
}
项目:apache-tomcat-7.0.73-with-comment    文件:Validator.java   
@Override
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
    if (errors != null && errors.length != 0) {
        StringBuilder errMsg = new StringBuilder();
        errMsg.append("<h3>");
        errMsg.append(Localizer.getMessage(
                "jsp.error.tei.invalid.attributes", n.getQName()));
        errMsg.append("</h3>");
        for (int i = 0; i < errors.length; i++) {
            errMsg.append("<p>");
            if (errors[i].getId() != null) {
                errMsg.append(errors[i].getId());
                errMsg.append(": ");
            }
            errMsg.append(errors[i].getMessage());
            errMsg.append("</p>");
        }

        err.jspError(n, errMsg.toString());
    }

    visitBody(n);
}
项目:apache-tomcat-7.0.73-with-comment    文件:TagLibraryInfoImpl.java   
/**
 * Translation-time validation of the XML document associated with the JSP
 * page. This is a convenience method on the associated TagLibraryValidator
 * class.
 * 
 * @param thePage
 *            The JSP page object
 * @return A string indicating whether the page is valid or not.
 */
public ValidationMessage[] validate(PageData thePage) {
    TagLibraryValidator tlv = getTagLibraryValidator();
    if (tlv == null)
        return null;

    String uri = getURI();
    if (uri.startsWith("/")) {
        uri = URN_JSPTLD + uri;
    }

    return tlv.validate(getPrefixString(), uri, thePage);
}
项目:lazycat    文件:Validator.java   
@Override
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
    if (errors != null && errors.length != 0) {
        StringBuilder errMsg = new StringBuilder();
        errMsg.append("<h3>");
        errMsg.append(Localizer.getMessage("jsp.error.tei.invalid.attributes", n.getQName()));
        errMsg.append("</h3>");
        for (int i = 0; i < errors.length; i++) {
            errMsg.append("<p>");
            if (errors[i].getId() != null) {
                errMsg.append(errors[i].getId());
                errMsg.append(": ");
            }
            errMsg.append(errors[i].getMessage());
            errMsg.append("</p>");
        }

        err.jspError(n, errMsg.toString());
    }

    visitBody(n);
}
项目:lazycat    文件:Validator.java   
/**
 * Validate XML view against the TagLibraryValidator classes of all imported
 * tag libraries.
 */
private static void validateXmlView(PageData xmlView, Compiler compiler) throws JasperException {

    StringBuilder errMsg = null;
    ErrorDispatcher errDisp = compiler.getErrorDispatcher();

    for (Iterator<TagLibraryInfo> iter = compiler.getPageInfo().getTaglibs().iterator(); iter.hasNext();) {

        Object o = iter.next();
        if (!(o instanceof TagLibraryInfoImpl))
            continue;
        TagLibraryInfoImpl tli = (TagLibraryInfoImpl) o;

        ValidationMessage[] errors = tli.validate(xmlView);
        if ((errors != null) && (errors.length != 0)) {
            if (errMsg == null) {
                errMsg = new StringBuilder();
            }
            errMsg.append("<h3>");
            errMsg.append(Localizer.getMessage("jsp.error.tlv.invalid.page", tli.getShortName(),
                    compiler.getPageInfo().getJspFile()));
            errMsg.append("</h3>");
            for (int i = 0; i < errors.length; i++) {
                if (errors[i] != null) {
                    errMsg.append("<p>");
                    errMsg.append(errors[i].getId());
                    errMsg.append(": ");
                    errMsg.append(errors[i].getMessage());
                    errMsg.append("</p>");
                }
            }
        }
    }

    if (errMsg != null) {
        errDisp.jspError(errMsg.toString());
    }
}
项目:lazycat    文件:TagLibraryInfoImpl.java   
/**
 * Translation-time validation of the XML document associated with the JSP
 * page. This is a convenience method on the associated TagLibraryValidator
 * class.
 * 
 * @param thePage
 *            The JSP page object
 * @return A string indicating whether the page is valid or not.
 */
public ValidationMessage[] validate(PageData thePage) {
    TagLibraryValidator tlv = getTagLibraryValidator();
    if (tlv == null)
        return null;

    String uri = getURI();
    if (uri.startsWith("/")) {
        uri = URN_JSPTLD + uri;
    }

    return tlv.validate(getPrefixString(), uri, thePage);
}
项目:combinatorius    文件:ComboTagExtraInfoTest.java   
@Test
public void testValidateTypeCSSorJS() {
    Mockito.when(tagData.getAttributeString("type")).thenReturn("cssXX");
    final ValidationMessage[] validationMessages = comboTagExtraInfo.validate(tagData);
    Assert.assertTrue("Type must be either 'css' or 'js'",
            validationMessages[0].getMessage().equals("Type must be either 'css' or 'js'"));
}
项目:combinatorius    文件:ComboTagExtraInfoTest.java   
@Test
public void testValidateIncorrectPath() {
    Mockito.when(tagData.getAttribute("path")).thenReturn("path");
    final ValidationMessage[] validationMessages = comboTagExtraInfo.validate(tagData);
    Assert.assertTrue("Path must match '/path/' or '${path}' pattern",
            validationMessages[0].getMessage().equals("Path must match '/path/' or '${path}' pattern"));
}
项目:combinatorius    文件:ComboTagExtraInfoTest.java   
@Test
public void testValidateResourcesHasNoSpaces() {
    Mockito.when(tagData.getAttribute("csv_resources")).thenReturn("test.css,test test.css");
    final ValidationMessage[] validationMessages = comboTagExtraInfo.validate(tagData);
    Assert.assertTrue("Resources must not contain white spaces",
            validationMessages[0].getMessage().equals("Resources must not contain white spaces"));
}
项目:combinatorius    文件:ComboTagExtraInfoTest.java   
@Test
public void testValidateThemeHasNoSpaces() {
    Mockito.when(tagData.getAttribute("theme")).thenReturn("test theme");
    final ValidationMessage[] validationMessages = comboTagExtraInfo.validate(tagData);
    Assert.assertTrue("Theme must not contain white spaces",
            validationMessages[0].getMessage().equals("Theme must not contain white spaces"));
}
项目:combinatorius    文件:ComboTagExtraInfoTest.java   
@Test
public void testValidateCSSreourcesForCSStype() {
    Mockito.when(tagData.getAttribute("csv_resources")).thenReturn("test.css,test.js");
    final ValidationMessage[] validationMessages = comboTagExtraInfo.validate(tagData);
    Assert.assertTrue("Resources must contain .css files only",
            validationMessages[0].getMessage().equals("Resources must contain .css files only"));
}
项目:combinatorius    文件:ComboTagExtraInfoTest.java   
@Test
public void testValidateJSreourcesForJStype() {
    Mockito.when(tagData.getAttributeString("type")).thenReturn("js");
    Mockito.when(tagData.getAttribute("csv_resources")).thenReturn("test.js,test.css");
    final ValidationMessage[] validationMessages = comboTagExtraInfo.validate(tagData);
    Assert.assertTrue("Resources must contain .js files only",
            validationMessages[0].getMessage().equals("Resources must contain .js files only"));
}
项目:feilong-taglib    文件:PagerTagExtraInfo.java   
@Override
// JSP 2.0 and higher containers call validate() instead of isValid().
// The default implementation of this method is to call isValid().

// If isValid() returns false, a generic ValidationMessage[] is returned indicating isValid() returned false.
public ValidationMessage[] validate(TagData tagData){
    if (LOGGER.isDebugEnabled()){
        Map<String, Object> map = getTagDataAttributeMap(tagData);
        LOGGER.debug(JsonUtil.format(map));
    }
    return super.validate(tagData);
}
项目:packagedrone    文件:Validator.java   
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
    err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
           if (errors != null && errors.length != 0) {
    StringBuilder errMsg = new StringBuilder();
               errMsg.append("<h3>");
               errMsg.append(Localizer.getMessage("jsp.error.tei.invalid.attributes",
                       n.getQName()));
               errMsg.append("</h3>");
               for (int i=0; i<errors.length; i++) {
                   errMsg.append("<p>");
        if (errors[i].getId() != null) {
        errMsg.append(errors[i].getId());
        errMsg.append(": ");
        }
                   errMsg.append(errors[i].getMessage());
                   errMsg.append("</p>");
               }

    err.jspError(n, errMsg.toString());
           }

    visitBody(n);
}
项目:class-guard    文件:Validator.java   
@Override
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
    if (errors != null && errors.length != 0) {
        StringBuilder errMsg = new StringBuilder();
        errMsg.append("<h3>");
        errMsg.append(Localizer.getMessage(
                "jsp.error.tei.invalid.attributes", n.getQName()));
        errMsg.append("</h3>");
        for (int i = 0; i < errors.length; i++) {
            errMsg.append("<p>");
            if (errors[i].getId() != null) {
                errMsg.append(errors[i].getId());
                errMsg.append(": ");
            }
            errMsg.append(errors[i].getMessage());
            errMsg.append("</p>");
        }

        err.jspError(n, errMsg.toString());
    }

    visitBody(n);
}
项目:class-guard    文件:TagLibraryInfoImpl.java   
/**
 * Translation-time validation of the XML document associated with the JSP
 * page. This is a convenience method on the associated TagLibraryValidator
 * class.
 * 
 * @param thePage
 *            The JSP page object
 * @return A string indicating whether the page is valid or not.
 */
public ValidationMessage[] validate(PageData thePage) {
    TagLibraryValidator tlv = getTagLibraryValidator();
    if (tlv == null)
        return null;

    String uri = getURI();
    if (uri.startsWith("/")) {
        uri = URN_JSPTLD + uri;
    }

    return tlv.validate(getPrefixString(), uri, thePage);
}
项目:package-drone    文件:Validator.java   
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
    err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
           if (errors != null && errors.length != 0) {
    StringBuilder errMsg = new StringBuilder();
               errMsg.append("<h3>");
               errMsg.append(Localizer.getMessage("jsp.error.tei.invalid.attributes",
                       n.getQName()));
               errMsg.append("</h3>");
               for (int i=0; i<errors.length; i++) {
                   errMsg.append("<p>");
        if (errors[i].getId() != null) {
        errMsg.append(errors[i].getId());
        errMsg.append(": ");
        }
                   errMsg.append(errors[i].getMessage());
                   errMsg.append("</p>");
               }

    err.jspError(n, errMsg.toString());
           }

    visitBody(n);
}
项目:apache-tomcat-7.0.57    文件:Validator.java   
@Override
public void visit(Node.CustomTag n) throws JasperException {
    TagInfo tagInfo = n.getTagInfo();
    if (tagInfo == null) {
        err.jspError(n, "jsp.error.missing.tagInfo", n.getQName());
    }

    ValidationMessage[] errors = tagInfo.validate(n.getTagData());
    if (errors != null && errors.length != 0) {
        StringBuilder errMsg = new StringBuilder();
        errMsg.append("<h3>");
        errMsg.append(Localizer.getMessage(
                "jsp.error.tei.invalid.attributes", n.getQName()));
        errMsg.append("</h3>");
        for (int i = 0; i < errors.length; i++) {
            errMsg.append("<p>");
            if (errors[i].getId() != null) {
                errMsg.append(errors[i].getId());
                errMsg.append(": ");
            }
            errMsg.append(errors[i].getMessage());
            errMsg.append("</p>");
        }

        err.jspError(n, errMsg.toString());
    }

    visitBody(n);
}
项目:apache-tomcat-7.0.57    文件:TagLibraryInfoImpl.java   
/**
 * Translation-time validation of the XML document associated with the JSP
 * page. This is a convenience method on the associated TagLibraryValidator
 * class.
 * 
 * @param thePage
 *            The JSP page object
 * @return A string indicating whether the page is valid or not.
 */
public ValidationMessage[] validate(PageData thePage) {
    TagLibraryValidator tlv = getTagLibraryValidator();
    if (tlv == null)
        return null;

    String uri = getURI();
    if (uri.startsWith("/")) {
        uri = URN_JSPTLD + uri;
    }

    return tlv.validate(getPrefixString(), uri, thePage);
}