javax.servlet.descriptor.JspConfigDescriptor Java Examples

The following examples show how to use javax.servlet.descriptor.JspConfigDescriptor. 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: TestApplicationContext.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Test
public void testJspPropertyGroupsAreIsolated() throws Exception {
    Tomcat tomcat = getTomcatInstanceTestWebapp(false, false);

    StandardContext standardContext =
            (StandardContext) tomcat.getHost().findChildren()[0];

    ServletContext servletContext = standardContext.getServletContext();

    Assert.assertNull(servletContext.getJspConfigDescriptor());

    tomcat.start();

    JspConfigDescriptor jspConfigDescriptor =
            servletContext.getJspConfigDescriptor();
    Collection<JspPropertyGroupDescriptor> propertyGroups =
            jspConfigDescriptor.getJspPropertyGroups();
    Assert.assertFalse(propertyGroups.isEmpty());
    propertyGroups.clear();

    jspConfigDescriptor = servletContext.getJspConfigDescriptor();
    propertyGroups = jspConfigDescriptor.getJspPropertyGroups();
    Assert.assertFalse(propertyGroups.isEmpty());
}
 
Example #2
Source File: ApplicationContext.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    JspConfigDescriptor jspConfigDescriptor = context
            .getJspConfigDescriptor();
    if (jspConfigDescriptor.getJspPropertyGroups().isEmpty()
            && jspConfigDescriptor.getTaglibs().isEmpty()) {
        return null;
    } else {
        return jspConfigDescriptor;
    }
}
 
Example #3
Source File: TestJspConfigDescriptorImpl.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Test
public void testPropertyGroupsAreIsolate() {
    List<TaglibDescriptor> taglibs = Collections.emptyList();
    List<JspPropertyGroupDescriptor> propertyGroups = new ArrayList<>();
    propertyGroups.add(new JspPropertyGroupDescriptorImpl(new JspPropertyGroup()));
    JspConfigDescriptor descriptor = new JspConfigDescriptorImpl(propertyGroups, taglibs);
    descriptor.getJspPropertyGroups().clear();
    Assert.assertEquals(propertyGroups, descriptor.getJspPropertyGroups());
}
 
Example #4
Source File: TestJspConfigDescriptorImpl.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Test
public void testTaglibsAreIsolate() {
    List<TaglibDescriptor> taglibs = new ArrayList<>();
    taglibs.add(new TaglibDescriptorImpl("location", "uri"));
    List<JspPropertyGroupDescriptor> propertyGroups = Collections.emptyList();
    JspConfigDescriptor descriptor = new JspConfigDescriptorImpl(propertyGroups, taglibs);
    descriptor.getTaglibs().clear();
    Assert.assertEquals(taglibs, descriptor.getTaglibs());
}
 
Example #5
Source File: ApplicationContextFacade.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    if (SecurityUtil.isPackageProtectionEnabled()) {
        return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor",
                null);
    } else {
        return context.getJspConfigDescriptor();
    }
}
 
Example #6
Source File: ApplicationContextFacade.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    if (SecurityUtil.isPackageProtectionEnabled()) {
        return (JspConfigDescriptor) doPrivileged("getJspConfigDescriptor",
                null);
    } else {
        return context.getJspConfigDescriptor();
    }
}
 
Example #7
Source File: ServletContextHandlerWrapper.java    From uavstack with Apache License 2.0 4 votes vote down vote up
@Override
public void setJspConfigDescriptor(JspConfigDescriptor d) {

    context.setJspConfigDescriptor(d);
}
 
Example #8
Source File: FailedContext.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() { return null; }
 
Example #9
Source File: MockServletContext.java    From flow with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    return null;
}
 
Example #10
Source File: MockServletContext.java    From live-chat-engine with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
	// TODO Auto-generated method stub
	return null;
}
 
Example #11
Source File: JspConfig.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
private void processWebDotXml(ServletContext ctxt) throws JasperException {

        JspConfigDescriptor jspConfig = ctxt.getJspConfigDescriptor();
        if (jspConfig == null) {
            return;
        }

        jspProperties = new ArrayList<JspPropertyGroup>();
        for (JspPropertyGroupDescriptor jpg: jspConfig.getJspPropertyGroups()) {

            Collection<String> urlPatterns = jpg.getUrlPatterns();
            String pageEncoding = jpg.getPageEncoding();
            String scriptingInvalid = jpg.getScriptingInvalid();
            String elIgnored = jpg.getElIgnored();
            String isXml = jpg.getIsXml();
            String trimSpaces = jpg.getTrimDirectiveWhitespaces();
            String poundAllowed = jpg.getDeferredSyntaxAllowedAsLiteral();
            String buffer = jpg.getBuffer();
            String defaultContentType = jpg.getDefaultContentType();
            String errorOnUndeclaredNamespace = jpg.getErrorOnUndeclaredNamespace();
            ArrayList<String> includePrelude = new ArrayList<String>();
            includePrelude.addAll(jpg.getIncludePreludes());
            ArrayList<String> includeCoda = new ArrayList<String>();
            includeCoda.addAll(jpg.getIncludeCodas());

            // Creates a JspPropertyGroup for each url pattern in the given
            // urlPatterns, and adds it to the given jspProperties.
            // This simplifies the matching logic.

            for (String urlPattern: urlPatterns) {
                String path = null;
                String extension = null;
 
                if (urlPattern.indexOf('*') < 0) {
                    // Exact match
                    path = urlPattern;
                } else {
                    int i = urlPattern.lastIndexOf('/');
                    String file;
                    if (i >= 0) {
                        path = urlPattern.substring(0,i+1);
                        file = urlPattern.substring(i+1);
                    } else {
                        file = urlPattern;
                    }
 
                    // pattern must be "*", or of the form "*.jsp"
                    if (file.equals("*")) {
                        extension = "*";
                    } else if (file.startsWith("*.")) {
                        extension = file.substring(file.indexOf('.')+1);
                    }

                    // The url patterns are reconstructed as the following:
                    // path != null, extension == null:  / or /foo/bar.ext
                    // path == null, extension != null:  *.ext
                    // path != null, extension == "*":   /foo/*
                    boolean isStar = "*".equals(extension);
                    if ((path == null && (extension == null || isStar))
                            || (path != null && !isStar)) {
                        if (log.isLoggable(Level.WARNING)) {
                            log.warning(Localizer.getMessage(
                                "jsp.warning.bad.urlpattern.propertygroup",
                                urlPattern));
                        }
                        continue;
                    }
                 }
 
                 JspProperty property = new JspProperty(isXml,
                                                    elIgnored,
                                                    scriptingInvalid,
                                                    trimSpaces,
                                                    poundAllowed,
                                                    pageEncoding,
                                                    includePrelude,
                                                    includeCoda,
                                                    defaultContentType,
                                                    buffer,
                                                    errorOnUndeclaredNamespace);
                 JspPropertyGroup propertyGroup =
                     new JspPropertyGroup(path, extension, property);

                 jspProperties.add(propertyGroup);
            }
        }
    }
 
Example #12
Source File: TldScanner.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
private void processWebDotXml() throws Exception {


        // Skip if we are only looking for listeners
        if (scanListeners) {
            return;
        }

        JspConfigDescriptor jspConfig = ctxt.getJspConfigDescriptor();
        if (jspConfig == null) {
            return;
        }

        for (TaglibDescriptor taglib: jspConfig.getTaglibs()) {

            if (taglib == null) {
                continue;
            }
            String tagUri = taglib.getTaglibURI();
            String tagLoc = taglib.getTaglibLocation();
            if (tagUri == null || tagLoc == null) {
                continue;
            }
            // Ignore system tlds in web.xml, for backward compatibility
            if (systemUris.contains(tagUri)
                        || (!useMyFaces && systemUrisJsf.contains(tagUri))) {
                continue;
            }
            // Save this location if appropriate
            if (uriType(tagLoc) == NOROOT_REL_URI)
                    tagLoc = "/WEB-INF/" + tagLoc;
            String tagLoc2 = null;
            if (tagLoc.endsWith(JAR_FILE_SUFFIX)) {
                tagLoc = ctxt.getResource(tagLoc).toString();
                tagLoc2 = "META-INF/taglib.tld";
            }
            if (log.isLoggable(Level.FINE)) {
                log.fine( "Add tld map from web.xml: " + tagUri + "=>" + tagLoc+ "," + tagLoc2);
            }
            mappings.put(tagUri, new String[] { tagLoc, tagLoc2 });
        }
    }
 
Example #13
Source File: JspCServletContext.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
public JspConfigDescriptor getJspConfigDescriptor() {
    return jspConfigDescriptor;
}
 
Example #14
Source File: HackServletContextStandardContext.java    From onetwo with Apache License 2.0 4 votes vote down vote up
public JspConfigDescriptor getJspConfigDescriptor() {
	return servletContext.getJspConfigDescriptor();
}
 
Example #15
Source File: MockServletContext.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
	throw new UnsupportedOperationException();
}
 
Example #16
Source File: MockServletContext.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
	throw new UnsupportedOperationException();
}
 
Example #17
Source File: MockServletContext.java    From HttpSessionReplacer with MIT License 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
  // Mock method
  return null;
}
 
Example #18
Source File: MockServletContext.java    From HttpSessionReplacer with MIT License 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {

  return null;
}
 
Example #19
Source File: LocalServletContext.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    Debug.logWarning("getJspConfigDescriptor called - unsupported - returning null", module);
    return null;
}
 
Example #20
Source File: ServletContextHandlerWrapper.java    From uavstack with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {

    return context.getJspConfigDescriptor();
}
 
Example #21
Source File: MockServletContext.java    From knox with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
  return null;
}
 
Example #22
Source File: MyServletContext.java    From caravan with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    return null;
}
 
Example #23
Source File: MockServletContext.java    From arctic-sea with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
Example #24
Source File: ServletContextImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    return deploymentInfo.getJspConfigDescriptor();
}
 
Example #25
Source File: JspCServletContext.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    return null;
}
 
Example #26
Source File: DeploymentInfo.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public DeploymentInfo setJspConfigDescriptor(JspConfigDescriptor jspConfigDescriptor) {
    this.jspConfigDescriptor = jspConfigDescriptor;
    return this;
}
 
Example #27
Source File: DeploymentInfo.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public JspConfigDescriptor getJspConfigDescriptor() {
    return jspConfigDescriptor;
}
 
Example #28
Source File: TesterServletContext.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    throw new RuntimeException("Not implemented");
}
 
Example #29
Source File: RangerKRBAuthenticationFilter.java    From ranger with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
	return null;
}
 
Example #30
Source File: ThreadLocalServletContext.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public JspConfigDescriptor getJspConfigDescriptor() {
    return get().getJspConfigDescriptor();
}