public JasperTagInfo(String tagName, String tagClassName, String bodyContent, String infoString, TagLibraryInfo taglib, TagExtraInfo tagExtraInfo, TagAttributeInfo[] attributeInfo, String displayName, String smallIcon, String largeIcon, TagVariableInfo[] tvi, String mapName) { super(tagName, tagClassName, bodyContent, infoString, taglib, tagExtraInfo, attributeInfo, displayName, smallIcon, largeIcon, tvi); this.dynamicAttrsMapName = mapName; }
PageInfo(BeanRepository beanRepository, String jspFile, boolean isTagFile) { this.isTagFile = isTagFile; this.jspFile = jspFile; this.beanRepository = beanRepository; this.varInfoNames = new HashSet<String>(); this.taglibsMap = new HashMap<String, TagLibraryInfo>(); this.jspPrefixMapper = new HashMap<String, String>(); this.xmlPrefixMapper = new HashMap<String, LinkedList<String>>(); this.nonCustomTagPrefixMap = new HashMap<String, Mark>(); this.imports = new Vector<String>(); this.dependants = new HashMap<String,Long>(); this.includePrelude = new Vector<String>(); this.includeCoda = new Vector<String>(); this.pluginDcls = new Vector<String>(); this.prefixes = new HashSet<String>(); // Enter standard imports imports.addAll(Constants.STANDARD_IMPORTS); }
public void startPrefixMapping(String prefix, String uri) throws SAXException { TagLibraryInfo taglibInfo; if (directivesOnly && !(JSP_URI.equals(uri))) { return; } try { taglibInfo = getTaglibInfo(prefix, uri); } catch (JasperException je) { throw new SAXParseException( Localizer.getMessage("jsp.error.could.not.add.taglibraries"), locator, je); } if (taglibInfo != null) { if (pageInfo.getTaglib(uri) == null) { pageInfo.addTaglib(uri, taglibInfo); } pageInfo.pushPrefixMapping(prefix, uri); } else { pageInfo.pushPrefixMapping(prefix, null); } }
@Override public void startPrefixMapping(String prefix, String uri) throws SAXException { TagLibraryInfo taglibInfo; if (directivesOnly && !(JSP_URI.equals(uri))) { return; } try { taglibInfo = getTaglibInfo(prefix, uri); } catch (JasperException je) { throw new SAXParseException(Localizer.getMessage("jsp.error.could.not.add.taglibraries"), locator, je); } if (taglibInfo != null) { if (pageInfo.getTaglib(uri) == null) { pageInfo.addTaglib(uri, taglibInfo); } pageInfo.pushPrefixMapping(prefix, uri); } else { pageInfo.pushPrefixMapping(prefix, null); } }
PageInfo(BeanRepository beanRepository, String jspFile, boolean isTagFile) { this.isTagFile = isTagFile; this.jspFile = jspFile; this.beanRepository = beanRepository; this.varInfoNames = new HashSet<String>(); this.taglibsMap = new HashMap<String, TagLibraryInfo>(); this.jspPrefixMapper = new HashMap<String, String>(); this.xmlPrefixMapper = new HashMap<String, LinkedList<String>>(); this.nonCustomTagPrefixMap = new HashMap<String, Mark>(); this.imports = new Vector<String>(); this.dependants = new HashMap<String, Long>(); this.includePrelude = new Vector<String>(); this.includeCoda = new Vector<String>(); this.pluginDcls = new Vector<String>(); this.prefixes = new HashSet<String>(); // Enter standard imports imports.addAll(Constants.STANDARD_IMPORTS); }
private void initServletContext() { try { context =new JspCServletContext (new PrintWriter(new OutputStreamWriter(System.out, "UTF-8")), new URL("file:" + uriRoot.replace('\\','/') + '/')); tldScanner = new TldScanner(context, isValidationEnabled); // START GlassFish 750 taglibs = new ConcurrentHashMap<String, TagLibraryInfo>(); context.setAttribute(Constants.JSP_TAGLIBRARY_CACHE, taglibs); tagFileJarUrls = new ConcurrentHashMap<String, URL>(); context.setAttribute(Constants.JSP_TAGFILE_JAR_URLS_CACHE, tagFileJarUrls); // END GlassFish 750 } catch (MalformedURLException me) { System.out.println("**" + me); } catch (UnsupportedEncodingException ex) { } rctxt = new JspRuntimeContext(context, this); jspConfig = new JspConfig(context); tagPluginManager = new TagPluginManager(context); }
/** * Returns an array of TagLibraryInfo objects representing the entire set * of tag libraries (including this TagLibraryInfo) imported by taglib * directives in the translation unit that references this * TagLibraryInfo. * * If a tag library is imported more than once and bound to different * prefices, only the TagLibraryInfo bound to the first prefix must be * included in the returned array. * * @return Array of TagLibraryInfo objects representing the entire set * of tag libraries (including this TagLibraryInfo) imported by taglib * directives in the translation unit that references this TagLibraryInfo. * * @since 2.1 */ public TagLibraryInfo[] getTagLibraryInfos() { TagLibraryInfo[] taglibs = null; Collection c = pageInfo.getTaglibs(); if (c != null) { Object[] objs = c.toArray(); if (objs != null && objs.length > 0) { taglibs = new TagLibraryInfo[objs.length]; for (int i=0; i<objs.length; i++) { taglibs[i] = (TagLibraryInfo) objs[i]; } } } return taglibs; }
PageInfo(BeanRepository beanRepository, String jspFile) { this.jspFile = jspFile; this.beanRepository = beanRepository; this.taglibsMap = new HashMap<String, TagLibraryInfo>(); this.jspPrefixMapper = new HashMap<String, String>(); this.xmlPrefixMapper = new HashMap<String, LinkedList<String>>(); this.nonCustomTagPrefixMap = new HashMap<String, Mark>(); this.imports = new ArrayList<String>(); this.dependants = new ArrayList<String>(); this.includePrelude = new ArrayList<String>(); this.includeCoda = new ArrayList<String>(); this.pluginDcls = new ArrayList<String>(); this.prefixes = new HashSet<String>(); // Enter standard imports for(int i = 0; i < STANDARD_IMPORTS.length; i++) imports.add(STANDARD_IMPORTS[i]); }
PageInfo(BeanRepository beanRepository, String jspFile) { this.jspFile = jspFile; this.beanRepository = beanRepository; this.varInfoNames = new HashSet<String>(); this.taglibsMap = new HashMap<String, TagLibraryInfo>(); this.jspPrefixMapper = new HashMap<String, String>(); this.xmlPrefixMapper = new HashMap<String, LinkedList<String>>(); this.nonCustomTagPrefixMap = new HashMap<String, Mark>(); this.imports = new Vector<String>(); this.dependants = new HashMap<String,Long>(); this.includePrelude = new Vector<String>(); this.includeCoda = new Vector<String>(); this.pluginDcls = new Vector<String>(); this.prefixes = new HashSet<String>(); // Enter standard imports imports.addAll(Constants.STANDARD_IMPORTS); }
@Override public void startPrefixMapping(String prefix, String uri) throws SAXException { TagLibraryInfo taglibInfo; if (directivesOnly && !(JSP_URI.equals(uri))) { return; } try { taglibInfo = getTaglibInfo(prefix, uri); } catch (JasperException je) { throw new SAXParseException( Localizer.getMessage("jsp.error.could.not.add.taglibraries"), locator, je); } if (taglibInfo != null) { if (pageInfo.getTaglib(uri) == null) { pageInfo.addTaglib(uri, taglibInfo); } pageInfo.pushPrefixMapping(prefix, uri); } else { pageInfo.pushPrefixMapping(prefix, null); } }
public TagFileDirectiveVisitor(Compiler compiler, TagLibraryInfo tagLibInfo, String name, String path) { err = compiler.getErrorDispatcher(); this.tagLibInfo = tagLibInfo; this.name = name; this.path = path; attributeVector = new Vector<TagAttributeInfo>(); variableVector = new Vector<TagVariableInfo>(); }
public TagFileDirectiveVisitor(Compiler compiler, TagLibraryInfo tagLibInfo, String name, String path) { err = compiler.getErrorDispatcher(); this.tagLibInfo = tagLibInfo; this.name = name; this.path = path; attributeVector = new Vector(); variableVector = new Vector(); }
/** * 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()); } }
private Node parseCustomAction(String qName, String localName, String uri, Attributes nonTaglibAttrs, Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start, Node parent) throws SAXException { // Check if this is a user-defined (custom) tag TagLibraryInfo tagLibInfo = pageInfo.getTaglib(uri); if (tagLibInfo == null) { return null; } TagInfo tagInfo = tagLibInfo.getTag(localName); TagFileInfo tagFileInfo = tagLibInfo.getTagFile(localName); if (tagInfo == null && tagFileInfo == null) { throw new SAXParseException(Localizer.getMessage("jsp.error.xml.bad_tag", localName, uri), locator); } Class<?> tagHandlerClass = null; if (tagInfo != null) { String handlerClassName = tagInfo.getTagClassName(); try { tagHandlerClass = ctxt.getClassLoader().loadClass(handlerClassName); } catch (Exception e) { throw new SAXParseException( Localizer.getMessage("jsp.error.loadclass.taghandler", handlerClassName, qName), locator, e); } } String prefix = getPrefix(qName); Node.CustomTag ret = null; if (tagInfo != null) { ret = new Node.CustomTag(qName, prefix, localName, uri, nonTaglibAttrs, nonTaglibXmlnsAttrs, taglibAttrs, start, parent, tagInfo, tagHandlerClass); } else { ret = new Node.CustomTag(qName, prefix, localName, uri, nonTaglibAttrs, nonTaglibXmlnsAttrs, taglibAttrs, start, parent, tagFileInfo); } return ret; }
private TagLibraryInfo getTaglibInfo(String prefix, String uri) throws JasperException { TagLibraryInfo result = null; if (uri.startsWith(URN_JSPTAGDIR)) { // uri (of the form "urn:jsptagdir:path") references tag file dir String tagdir = uri.substring(URN_JSPTAGDIR.length()); result = new ImplicitTagLibraryInfo(ctxt, parserController, pageInfo, prefix, tagdir, err); } else { // uri references TLD file boolean isPlainUri = false; if (uri.startsWith(URN_JSPTLD)) { // uri is of the form "urn:jsptld:path" uri = uri.substring(URN_JSPTLD.length()); } else { isPlainUri = true; } TldLocation location = ctxt.getTldLocation(uri); if (location != null || !isPlainUri) { if (ctxt.getOptions().isCaching()) { result = ctxt.getOptions().getCache().get(uri); } if (result == null) { /* * If the uri value is a plain uri, a translation error must * not be generated if the uri is not found in the taglib * map. Instead, any actions in the namespace defined by the * uri value must be treated as uninterpreted. */ result = new TagLibraryInfoImpl(ctxt, parserController, pageInfo, prefix, uri, location, err, null); if (ctxt.getOptions().isCaching()) { ctxt.getOptions().getCache().put(uri, result); } } } } return result; }
public TagFileDirectiveVisitor(Compiler compiler, TagLibraryInfo tagLibInfo, String name, String path) { err = compiler.getErrorDispatcher(); this.tagLibInfo = tagLibInfo; this.name = name; this.path = path; attributeVector = new ArrayList<TagAttributeInfo>(); variableVector = new ArrayList<TagVariableInfo>(); jspVersionDouble = Double.valueOf(tagLibInfo.getRequiredVersion()); }