jsptest-svn-commits Mailing List for JspTest (Page 5)
Status: Alpha
Brought to you by:
lkoskela
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(3) |
Feb
|
Mar
(2) |
Apr
(38) |
May
(1) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(17) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gdi...@us...> - 2007-10-05 18:34:07
|
Revision: 176 http://jsptest.svn.sourceforge.net/jsptest/?rev=176&view=rev Author: gdinwiddie Date: 2007-10-05 11:34:06 -0700 (Fri, 05 Oct 2007) Log Message: ----------- initial work toward getting jsptest to work for JSP 1.2 spec. So far the strategy has been to duplicate things for JSP 2.0 and hack them until the tests pass. The thought is that the duplication can be removed afterwards. Modified Paths: -------------- branches/multispecsupport.1.2/jsptest-jsp12/pom.xml branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java Added Paths: ----------- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JasperCompiler.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspExecutionImpl.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspImpl.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/JspTestServletOutputStream.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockEmbeddedServletOptions.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletRequest.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletResponse.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpSession.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspFactory.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspWriter.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockPageContext.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockServletConfig.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockServletContext.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockServletInputStream.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockTagInfo.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockTldLocationsCache.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/utils/ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/utils/StringUtils.java branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/org/ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/org/apache/ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/org/apache/jasper/ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/org/apache/jasper/compiler/ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/org/apache/jasper/servlet/ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/org/apache/jasper/servlet/JspServletWrapperWrapper.java branches/multispecsupport.1.2/jsptest-jsp12/src/test/java/net/ branches/multispecsupport.1.2/jsptest-jsp12/src/test/java/net/sf/ branches/multispecsupport.1.2/jsptest-jsp12/src/test/java/net/sf/jsptest/ branches/multispecsupport.1.2/jsptest-jsp12/src/test/java/net/sf/jsptest/utils/ branches/multispecsupport.1.2/jsptest-jsp12/src/test/java/net/sf/jsptest/utils/StringUtilsTest.java Modified: branches/multispecsupport.1.2/jsptest-jsp12/pom.xml =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/pom.xml 2007-10-05 18:33:38 UTC (rev 175) +++ branches/multispecsupport.1.2/jsptest-jsp12/pom.xml 2007-10-05 18:34:06 UTC (rev 176) @@ -37,5 +37,10 @@ <artifactId>jasper-runtime</artifactId> <version>4.1.30</version> </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.3</version> + </dependency> </dependencies> </project> Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JasperCompiler.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JasperCompiler.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JasperCompiler.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,432 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.jsp12; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.jsp.tagext.TagInfo; + +import net.sf.jsptest.compiler.JspCompilationInfo; +import net.sf.jsptest.compiler.java.CommandLineJavac; +import net.sf.jsptest.compiler.java.JavaCompiler; +import net.sf.jsptest.compiler.jsp12.mock.MockEmbeddedServletOptions; +import net.sf.jsptest.compiler.jsp12.mock.MockServletConfig; +import net.sf.jsptest.compiler.jsp12.mock.MockTagInfo; +import net.sf.jsptest.utils.Path; +import net.sf.jsptest.utils.StringUtils; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.jasper.EmbededServletOptions; +import org.apache.jasper.JasperException; +import org.apache.jasper.JspCompilationContext; +import org.apache.jasper.Options; +import org.apache.jasper.compiler.Compiler; +import org.apache.jasper.compiler.JspRuntimeContext; +import org.apache.jasper.compiler.ServletWriter; +import org.apache.jasper.servlet.JspCServletContext; +import org.apache.jasper.servlet.JspServletWrapper; +import org.apache.jasper.servlet.JspServletWrapperWrapper; + +/** + * The <tt>JasperTestCase</tt> provides a facility for compiling JavaServer + * Pages outside a real Servlet/JSP container. + * <p> + * It makes use of Jakarta Tomcat's Jasper JSP compiler to compile a JSP file + * into Java source code, and then Sun's javac implementation to compile the + * Java source code into Java bytecode. + * <p> + * The resulting .class file is written under a "WEB-INF/classes" directory + * under the "web root" defined by concrete subclasses through the + * implementation of <tt>getWebRoot()</tt>. If you want the .class files to + * be generated somewhere else than under the web root, you can also override + * <tt>getClassOutputBaseDir()</tt>, which specifies the root directory for + * the compiled .class files. + * <p> + * The resulting Servlet class gets its package based on the + * <tt>getJspPackageName()</tt> method which can be overridden if necessary. + * The default is "jsp" which means that, for example, a JSP named + * "front_page.jsp" would eventually be translated into a class file + * "[webroot]/WEB-INF/classes/jsp/front_page_jsp.class" where "jsp/" is the JSP + * package name and "front_page_jsp.class" the normalized class name derived + * from the source JSP file's name. + * + * @author Lasse Koskela + */ +public class JasperCompiler { + + private static final Log log = LogFactory + .getLog(JasperCompiler.class); + + private static JavaCompiler COMPILER = determineJavaCompiler(); + + private String webRoot; + + private String classOutputBaseDir; + + private String jspPackageName; + + public JasperCompiler() { + webRoot = "."; + classOutputBaseDir = "."; + } + + /** + * Sets the "web root", i.e. the root directory of your exploded J2EE web + * application. In other words, this is the directory under which you should + * have a subdirectory named "WEB-INF". + */ + public void setWebRoot(String webRoot) { + this.webRoot = webRoot; + } + + /** + * Sets the directory where generated .class file(s) should be written.. + */ + public void setClassOutputBaseDir(String directory) { + this.classOutputBaseDir = directory; + } + + /** + * Compile the specified JSP source file into bytecode. + * + * @param mockTaglibs + * Mapping of tagnames to tag handler classes + * @param jspPath + * The path to the JSP source file to compile, given relative + * to the web root. + */ + public JspCompilationInfo compile(String path, Map mockTaglibs) + throws Exception { + JspCompilationInfo info = createJspCompilationInfo(path, + mockTaglibs); + if (info.jspCompilationRequired()) { + compileJsp(info); + compileJavaToBytecode(info); + } else { + log.debug(" No compilation needed for " + + info.getJspSource()); + } + return info; + } + + /** + * Sets the package name for the generated Java classes. The default package + * name is "jsp". + */ + public void setJspPackageName(String packageName) { + this.jspPackageName = packageName; + } + + /** + * Returns the package name for the generated Java class. + */ + private String getJspPackageName() { + if (jspPackageName != null) { + return jspPackageName; + } else { + return "jsp"; + } + } + + private JspCompilationInfo createJspCompilationInfo(String jsp, + Map mockTaglibs) { + JspCompilationInfo info = new JspCompilationInfo(); + info.setJspPath(jsp); + info.setClassOutputDir(classOutputBaseDir); + info.setJspSource(resolveJspSourceFile(jsp)); + info.setWebRoot(getWebRoot()); + info.setTaglibs(mockTaglibs); + resolveJavaSourceFile(info); + resolveClassFileLocation(info); + resolveClassName(info); + return info; + } + + private String getWebRoot() { + File root = new File(webRoot); + if (root.exists() && root.isDirectory()) { + return root.getAbsolutePath(); + } else { + return resolveWebRootFromClassPath(); + } + } + + private String resolveWebRootFromClassPath() { + String path = webRoot; + if (path.startsWith("./")) { + path = path.substring(2); + } + URL url = getClass().getClassLoader().getResource(path); + if (url == null) { + return webRoot; + } + if (!url.toExternalForm().startsWith("file:")) { + log + .info("Web root referenced a non-filesystem resource: " + + url); + return webRoot; + } + return new File(url.toExternalForm().substring( + "file:".length())).getAbsolutePath(); + } + + private void compileJsp(JspCompilationInfo info) throws Exception { + assertTrue("Source file " + + new File(info.getJspSource()).getAbsolutePath() + + " does not exist", new File(info.getJspSource()) + .exists()); + PrintWriter logWriter = new PrintWriter(new StringWriter()); + URL baseUrl = new File(info.getWebRoot()).toURL(); + ServletContext sContext = new JspCServletContext(logWriter, + baseUrl); + ServletConfig sConfig = new MockServletConfig(sContext); + Options options = createOptions(sContext, sConfig, info); + JspRuntimeContext rtContext = new JspRuntimeContext(sContext, + options); + JspServletWrapper sWrapper = makeWrapper(sContext, options, + rtContext, sConfig, baseUrl.toString()); + JspCompilationContext cContext = createJspCompilationContext( + info, sContext, options, rtContext, sWrapper, + new StringWriter()); + logCompilation(info.getJspSource(), info.getClassOutputDir()); + compileJspToJava(sWrapper, cContext); + File javaFile = new File(info.getJavaSource()); + assertTrue("Failed to generate .java source code to " + + javaFile.getAbsolutePath(), javaFile.exists()); + info.compilationWasSuccessful(); + } + + private void compileJspToJava( + JspServletWrapper jspServletWrapper, + JspCompilationContext jspCompilationContext) + throws FileNotFoundException, JasperException, Exception { + Compiler compiler = new Compiler(jspCompilationContext, jspServletWrapper); + compiler.compile(); + } + + private JspCompilationContext createJspCompilationContext( + JspCompilationInfo info, ServletContext servletContext, + Options options, JspRuntimeContext jspRuntimeContext, + JspServletWrapper jspServletWrapper, + StringWriter stringWriter) { + boolean isErrorPage = false; + JspCompilationContext cContext = new JspCompilationContext( + info.getJspPath(), isErrorPage, options, + servletContext, jspServletWrapper, jspRuntimeContext); + cContext.getOutputDir(); // forces creation of the directory tree + cContext.setServletJavaFileName(info.getJavaSource()); + String packageName = getJspPackageName(); + String subPackageName = getSubDirPackagePrefix(info); + if (subPackageName.length() > 0) { + packageName = packageName+"."+subPackageName; + } + if (packageName.endsWith(".")) { + packageName = packageName.substring(0, packageName.length()-1); + } + cContext.setServletPackageName(packageName); + cContext.setWriter(new ServletWriter(new PrintWriter( + stringWriter))); + createPathToGeneratedJavaSource(info); + return cContext; + } + + private void createPathToGeneratedJavaSource( + JspCompilationInfo info) { + new File(info.getJavaSource()).getParentFile().mkdirs(); + } + + private JspServletWrapper makeWrapper( + ServletContext servletContext, Options options, + JspRuntimeContext jspRuntimeContext, ServletConfig servletConfig, String jspUri) + throws MalformedURLException, JasperException { + TagInfo tagInfo = new MockTagInfo(); + String tagFilePath = "/"; + URL tagFileJarUrl = new File(".").toURL(); + // FIXME + boolean isErrorPage = false; + JspServletWrapper wrapper = new JspServletWrapperWrapper( + servletConfig, options, jspUri, isErrorPage, jspRuntimeContext); + /* + servletContext, options, tagFilePath, tagInfo, + jspRuntimeContext, tagFileJarUrl); + */ + return wrapper; + } + + private Options createOptions(ServletContext ctx, + ServletConfig cfg, JspCompilationInfo info) { + Options options = new EmbededServletOptions(cfg, ctx); + return new MockEmbeddedServletOptions(options, ctx, info + .getTaglibs()); + } + + private void resolveJavaSourceFile(JspCompilationInfo info) { + File dir = new File(info.getClassOutputDir()); + if (getJspPackageName().length() > 0) { + dir = new File(dir, convertPackageToPath(getJspPackageName())); + } + File subdir = new File(dir.getAbsolutePath()); + String subPackage = getSubDirPackagePrefix(info); + if (subPackage.length() > 0) { + subdir = new File(subdir, convertPackageToPath(subPackage)); + } + subdir.mkdirs(); + String name = resolveJavaSourceFileName(info.getJspPath()); + info.setJavaSource(new File(dir, name).getPath()); + } + + private String convertPackageToPath(String packageName) { + return packageName.replace('.', '/'); + } + + private String resolveJavaSourceFileName(String jspPath) { + String name = encodeSpecialCharacters(jspPath); + name = replace(name, ".jsp", "_jsp.java"); + if (name.startsWith("/")) { + name = name.substring(1); + } + return name; + } + + private String replace(String string, String target, String replacement) { +// string = string.replace(target, replacement); + return StringUtils.replace(string, target, replacement); + } + + private String encodeSpecialCharacters(String name) { + return name; + } + + private String resolveJspSourceFile(String jsp) { + if (jsp.startsWith("/")) { + jsp = jsp.substring(1); + } + return new File(getWebRoot(), jsp).getPath(); + } + + private void resolveClassName(JspCompilationInfo info) { + String baseName = new File(info.getJavaSource()).getName(); + baseName = baseName.substring(0, baseName.indexOf(".")); + info.setClassName(getPackagePrefix() + + getSubDirPackagePrefix(info) + baseName); + } + + private String getPackagePrefix() { + String packagePrefix = getJspPackageName(); + if (packagePrefix != null && packagePrefix.length() > 0) { + packagePrefix = packagePrefix + "."; + } + return packagePrefix; + } + + private String getSubDirPackagePrefix(JspCompilationInfo info) { + String dirPrefix = info.getJspPath(); + if (dirPrefix.startsWith("/")) { + dirPrefix = dirPrefix.substring(1); + } + if (dirPrefix.lastIndexOf("/") != -1) { + dirPrefix = dirPrefix.substring(0, dirPrefix + .lastIndexOf("/")); + dirPrefix = convertPathToPackage(dirPrefix) + "."; + } else { + dirPrefix = ""; + } + return dirPrefix; + } + + private String convertPathToPackage(String path) { + return path.replace('/', '.'); + } + + private void compileJavaToBytecode(JspCompilationInfo info) + throws Exception { + File classFile = new File(info.getClassFile()); + classFile.delete(); + logCompilation(info.getJavaSource(), info.getClassOutputDir()); + boolean ok = javac().compile(info.getJavaSource(), + info.getClassOutputDir(), getClassPath()); + assertTrue("javac failed", ok); + assertTrue("Failed to compile .java file to " + + classFile.getAbsolutePath(), classFile.exists()); + } + + private String[] getClassPath() { + Path cp = new Path(); + cp.addSystemProperty("java.class.path"); +//FIXME cp.addContainer(javax.servlet.jsp.tagext.JspTag.class); + cp.addContainer(javax.servlet.jsp.jstl.core.LoopTag.class); + cp.addContainer(javax.servlet.http.HttpServlet.class); +//FIXME cp.addContainer(org.apache.taglibs.standard.Version.class); + cp.addContainer(org.apache.jasper.JspC.class); + cp.addContainer(org.apache.jasper.compiler.Compiler.class); + cp.addContainer(org.apache.jasper.runtime.HttpJspBase.class); + cp.add(new File("target", "test-classes")); + cp.add(new File("target", "classes").getAbsolutePath()); + return cp.toStringArray(); + } + + private void resolveClassFileLocation(JspCompilationInfo info) { + String file = StringUtils.replace(info.getJavaSource(), ".java", ".class"); + info.setClassFile(file); + } + + private static void assertTrue(String errorMessage, + boolean condition) { + if (!condition) { + throw new RuntimeException(errorMessage); + } + } + + private static JavaCompiler determineJavaCompiler() { + List compilers = new ArrayList(); + // this doesn't work because with Maven we need to set the classpath + // explicitly as the "current" classpath does not include our + // dependencies + // compilers.add(new SunJavac()); + compilers.add(new CommandLineJavac()); + for (Iterator i = compilers.iterator(); i.hasNext();) { + JavaCompiler compiler = (JavaCompiler) i.next(); + if (compiler.isAvailable()) { + log.debug("Using JavaCompiler: " + + compiler.getClass().getName()); + return compiler; + } + } + throw new RuntimeException( + "No JavaCompiler implementation available on the system"); + } + + private static JavaCompiler javac() { + return COMPILER; + } + + private void logCompilation(String src, String dst) { + log.debug(" Compiling " + src + " to " + dst); + } +} Modified: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java 2007-10-05 18:33:38 UTC (rev 175) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspCompilerImpl.java 2007-10-05 18:34:06 UTC (rev 176) @@ -1,19 +1,59 @@ package net.sf.jsptest.compiler.jsp12; +import java.io.File; import java.util.Map; +import net.sf.jsptest.compiler.JspCompilationInfo; import net.sf.jsptest.compiler.api.Jsp; import net.sf.jsptest.compiler.api.JspCompiler; +import net.sf.jsptest.compiler.jsp12.JasperCompiler; +import net.sf.jsptest.compiler.jsp12.JspImpl; +import net.sf.jsptest.utils.CustomClassLoader; public class JspCompilerImpl implements JspCompiler { + private String outputDirectory = new File(System + .getProperty("java.io.tmpdir"), "jsptest-classes") + .getAbsolutePath(); + private String webRoot; - public Jsp compile(String path, Map taglibs) { - throw new RuntimeException("Not implemented"); + public void setOutputDirectory(String directory) { + outputDirectory = directory; } - public void setOutputDirectory(String directory) { + protected String getOutputDirectory() { + return outputDirectory; } public void setWebRoot(String directory) { + this.webRoot = directory; } + + protected String getWebRoot() { + return webRoot; + } + + public Jsp compile(String jspPath, Map taglibs) { + try { + JasperCompiler compiler = new JasperCompiler(); + compiler.setWebRoot(getWebRoot()); + compiler.setClassOutputBaseDir(getOutputDirectory()); + JspCompilationInfo info = compiler.compile(jspPath, + taglibs); + final Class servletClass = compileToClass(info); + return new JspImpl(servletClass); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private Class compileToClass(JspCompilationInfo info) + throws Exception, ClassNotFoundException { + return loadJspClass(info.getClassName()); + } + + private Class loadJspClass(String jspClassName) + throws ClassNotFoundException { + ClassLoader cl = new CustomClassLoader(getOutputDirectory()); + return cl.loadClass(jspClassName); + } } Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspExecutionImpl.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspExecutionImpl.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspExecutionImpl.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,18 @@ +package net.sf.jsptest.compiler.jsp12; + +import java.io.File; + +import net.sf.jsptest.compiler.api.JspExecution; + +public class JspExecutionImpl implements JspExecution { + + private final File renderedOutput; + + public JspExecutionImpl(File renderedOutput) { + this.renderedOutput = renderedOutput; + } + + public File getRenderedResponse() { + return renderedOutput; + } +} Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspImpl.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspImpl.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/JspImpl.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,161 @@ +package net.sf.jsptest.compiler.jsp12; + +import java.io.File; +import java.io.IOException; +import java.util.Map; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.JspFactory; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import net.sf.jsptest.compiler.api.Jsp; +import net.sf.jsptest.compiler.api.JspExecution; +import net.sf.jsptest.compiler.jsp12.mock.MockHttpServletRequest; +import net.sf.jsptest.compiler.jsp12.mock.MockHttpServletResponse; +import net.sf.jsptest.compiler.jsp12.mock.MockHttpSession; +import net.sf.jsptest.compiler.jsp12.mock.MockJspFactory; +import net.sf.jsptest.compiler.jsp12.mock.MockJspWriter; +import net.sf.jsptest.compiler.jsp12.mock.MockPageContext; +import net.sf.jsptest.compiler.jsp12.mock.MockServletConfig; +import net.sf.jsptest.compiler.jsp12.mock.MockServletContext; +import net.sf.jsptest.utils.IO; + +public class JspImpl implements Jsp { + + private static final Log log = LogFactory.getLog(JspImpl.class); + + private final Class servletClass; + + private MockPageContext pageContext; + + public JspImpl(Class servletClass) { + this.servletClass = servletClass; + } + + public JspExecution request(String httpMethod, + Map requestAttributes, Map sessionAttributes) { + ServletContext servletContext = new MockServletContext(); + ServletConfig servletConfig = new MockServletConfig( + servletContext); + + MockHttpSession httpSession = new MockHttpSession(); + httpSession.setAttributes(sessionAttributes); + + MockHttpServletRequest request = new MockHttpServletRequest(); + request.setSession(httpSession); + request.setMethod(httpMethod); + request.setAttributes(requestAttributes); + + MockHttpServletResponse response = new MockHttpServletResponse(); + + MockJspWriter jspWriter = configureJspFactory(servletContext, + request, httpSession); + + initializeAndInvokeJsp(servletClass, servletConfig, request, + response); + + return writeOutputToTempFile(jspWriter.getContents()); + } + + protected MockJspWriter configureJspFactory( + ServletContext httpContext, + HttpServletRequest httpRequest, HttpSession httpSession) { + pageContext = new MockPageContext(); + pageContext.setRequest(httpRequest); + pageContext.setServletContext(httpContext); + pageContext.setSession(httpSession); + MockJspWriter jspWriter = new MockJspWriter(); + pageContext.setJspWriter(jspWriter); + JspFactory.setDefaultFactory(new MockJspFactory(pageContext)); + return jspWriter; + } + + protected void initializeAndInvokeJsp(Class jspClass, + ServletConfig servletConfig, HttpServletRequest request, + HttpServletResponse response) { + try { + log.debug("Instantiating Servlet: " + jspClass.getName()); + HttpServlet servlet = (HttpServlet) jspClass + .newInstance(); + log.debug("Initializing Servlet: " + jspClass.getName()); + servlet.init(servletConfig); + log.debug("Invoking Servlet: " + jspClass.getName()); + servlet.service(request, response); + if (pageContext.getException() != null) { + log.debug("An exception was stored into PageContext. Rethrowing it..."); + throw new RuntimeException(pageContext.getException()); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + protected JspExecution writeOutputToTempFile(String output) { + try { + File temp = File.createTempFile("generated_html_", + ".html"); + temp.createNewFile(); + log.debug("Writing " + output.length() + " bytes to " + + temp.getAbsolutePath()); + IO.write(output, temp); + return new JspExecutionImpl(temp); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + // public JspExecution request(String httpMethod, + // Map requestAttributes, Map sessionAttributes) { + // try { + // final File responseFile = File.createTempFile( + // "jsptest-response", ".txt"); + // HttpServlet servlet = (HttpServlet) servletClass + // .newInstance(); + // servlet.init(new MockServletConfig( + // new MockServletContext())); + // + // ServletRequest request = createServletRequest(httpMethod, + // requestAttributes, sessionAttributes); + // ServletResponse response = createServletResponse(responseFile); + // + // servlet.service(request, response); + // + // response.flushBuffer(); + // + // return createJspExecution(responseFile); + // } catch (Exception e) { + // throw new RuntimeException(e); + // } + // } + // + // protected JspExecution createJspExecution(final File responseFile) { + // return new JspExecution() { + // public File getRenderedResponse() { + // return responseFile; + // } + // }; + // } + // + // protected ServletResponse createServletResponse(File output) + // throws FileNotFoundException { + // return new MockHttpServletResponse(output); + // } + // + // private ServletRequest createServletRequest(String httpMethod, + // Map requestAttributes, Map sessionAttributes) { + // MockHttpSession session = new MockHttpSession(); + // session.setAttributes(sessionAttributes); + // MockHttpServletRequest request = new MockHttpServletRequest(); + // request.setMethod(httpMethod); + // request.setAttributes(requestAttributes); + // request.setSession(session); + // return request; + // } +} Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/JspTestServletOutputStream.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/JspTestServletOutputStream.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/JspTestServletOutputStream.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,19 @@ +package net.sf.jsptest.compiler.jsp12.mock; + +import java.io.IOException; +import java.io.OutputStream; + +import javax.servlet.ServletOutputStream; + +public class JspTestServletOutputStream extends ServletOutputStream { + + private final OutputStream stream; + + public JspTestServletOutputStream(OutputStream stream) { + this.stream = stream; + } + + public void write(int b) throws IOException { + stream.write(b); + } +} Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockEmbeddedServletOptions.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockEmbeddedServletOptions.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockEmbeddedServletOptions.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,113 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.jsp12.mock; + +import java.io.File; +import java.util.Map; + +import javax.servlet.ServletContext; + +import org.apache.jasper.Options; +//import org.apache.jasper.compiler.JspConfig; +//import org.apache.jasper.compiler.MockTagPluginManager; +//import org.apache.jasper.compiler.TagPluginManager; +import org.apache.jasper.compiler.TldLocationsCache; + +/** + * @author Lasse Koskela + */ +public class MockEmbeddedServletOptions implements Options { + + private Options options; + + private ServletContext servletContext; + + private Map taglibs; + + public MockEmbeddedServletOptions(Options options, + ServletContext context, Map taglibs) { + this.options = options; + this.servletContext = context; + this.taglibs = taglibs; + } + + public int getCheckInterval() { + return options.getCheckInterval(); + } + + public boolean getClassDebugInfo() { + return options.getClassDebugInfo(); + } + + public String getClassPath() { + return options.getClassPath(); + } + + public String getCompiler() { + return options.getCompiler(); + } + + public boolean getDevelopment() { + return options.getDevelopment(); + } + + public boolean getFork() { + return options.getFork(); + } + + public String getIeClassId() { + return options.getIeClassId(); + } + + public String getJavaEncoding() { + return options.getJavaEncoding(); + } + + public boolean getKeepGenerated() { + return options.getKeepGenerated(); + } + + public boolean getLargeFile() { + return options.getLargeFile(); + } + + public boolean getMappedFile() { + return options.getMappedFile(); + } + + public boolean getReloading() { + return options.getReloading(); + } + + public File getScratchDir() { + return options.getScratchDir(); + } + + public boolean getSendErrorToClient() { + return options.getSendErrorToClient(); + } + + public TldLocationsCache getTldLocationsCache() { + TldLocationsCache realCache = options.getTldLocationsCache(); + return new MockTldLocationsCache(realCache, servletContext); + } + + public boolean isPoolingEnabled() { + return options.isPoolingEnabled(); + } + +} \ No newline at end of file Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletRequest.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletRequest.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletRequest.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,354 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.jsp12.mock; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.security.Principal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Vector; + +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +public class MockHttpServletRequest implements HttpServletRequest { + + private Map headers = new HashMap(); + + private Map parameters = new HashMap(); + + private Map attributes = new HashMap(); + + private MockHttpSession httpSession = null; + + private byte[] body; + + private String httpMethod; + + private String characterEncoding; + + public MockHttpServletRequest() { + this((MockHttpSession) null); + } + + public MockHttpServletRequest(MockHttpSession httpSession) { + setSession(httpSession); + } + + public MockHttpServletRequest(byte[] body) { + this.body = body; + characterEncoding = "UTF-8"; + this.headers.put("Content-type", + "multipart/form-data; boundary=XXXBOUNDARYXXX"); + } + + public String getAuthType() { + return null; + } + + public Cookie[] getCookies() { + return new Cookie[0]; + } + + public long getDateHeader(String s) { + try { + // TODO: use the HTTP date format pattern + return new SimpleDateFormat().parse( + (String) headers.get(s)).getTime(); + } catch (ParseException e) { + return 0; + } + } + + public String getHeader(String reference) { + return (String) headers.get(reference); + } + + public Enumeration getHeaders(String s) { + return new Vector().elements(); + } + + public Enumeration getHeaderNames() { + return new Vector(headers.keySet()).elements(); + } + + public int getIntHeader(String s) { + return Integer.parseInt(getHeader(s)); + } + + public void setMethod(String httpMethod) { + this.httpMethod = httpMethod; + } + + public String getMethod() { + return httpMethod; + } + + public String getPathInfo() { + return "/"; + } + + public String getPathTranslated() { + return "/"; + } + + public String getContextPath() { + return "/"; + } + + public String getQueryString() { + return null; + } + + public String getRemoteUser() { + return null; + } + + public boolean isUserInRole(String s) { + return false; + } + + public Principal getUserPrincipal() { + return null; + } + + public String getRequestedSessionId() { + return "JSPTESTSESSIONID"; + } + + public String getRequestURI() { + return "/"; + } + + public StringBuffer getRequestURL() { + return new StringBuffer("/"); + } + + public String getServletPath() { + return "/"; + } + + public HttpSession getSession(boolean flag) { + if (flag && httpSession == null) { + httpSession = new MockHttpSession(); + } + return httpSession; + } + + public HttpSession getSession() { + return httpSession; + } + + public boolean isRequestedSessionIdValid() { + return true; + } + + public boolean isRequestedSessionIdFromCookie() { + return true; + } + + public boolean isRequestedSessionIdFromURL() { + return false; + } + + public boolean isRequestedSessionIdFromUrl() { + return false; + } + + public Object getAttribute(String name) { + return attributes.get(name); + } + + public Enumeration getAttributeNames() { + return new Vector(attributes.keySet()).elements(); + } + + public String getCharacterEncoding() { + return characterEncoding; + } + + public void setCharacterEncoding(String env) { + characterEncoding = env; + } + + public int getContentLength() { + return body.length; + } + + public String getContentType() { + return "multipart/form-data; boundary=xxx"; + } + + public ServletInputStream getInputStream() throws IOException { + return new MockServletInputStream(body); + } + + public String getParameter(String name) { + String values[] = (String[]) parameters.get(name); + if (values != null) { + return (values[0]); + } else { + return (null); + } + } + + public Map getParameterMap() { + return parameters; + } + + public String getProtocol() { + return "http"; + } + + public String getScheme() { + return "http://"; + } + + public String getServerName() { + return "servername"; + } + + public int getServerPort() { + return 8080; + } + + public BufferedReader getReader() throws IOException { + return null; + } + + public String getRemoteAddr() { + return null; + } + + public String getRemoteHost() { + return null; + } + + public void setAttributes(Map attributes) { + this.attributes.putAll(attributes); + } + + public void setAttribute(String name, Object o) { + attributes.put(name, o); + } + + public void removeAttribute(String name) { + attributes.remove(name); + } + + public Locale getLocale() { + return Locale.getDefault(); + } + + public Enumeration getLocales() { + return new Vector(Arrays.asList(Locale.getAvailableLocales())) + .elements(); + } + + public boolean isSecure() { + return false; + } + + public RequestDispatcher getRequestDispatcher(String s) { + return new RequestDispatcher() { + + public void forward(ServletRequest request, + ServletResponse response) + throws ServletException, IOException { + } + + public void include(ServletRequest request, + ServletResponse response) + throws ServletException, IOException { + } + }; + } + + public String getRealPath(String s) { + File tmpDir = new File(System.getProperty("java.io.tmpdir")); + File jsptestTmpDir = new File(tmpDir, "jsptest"); + return new File(jsptestTmpDir, s).getAbsolutePath(); + } + + public int getRemotePort() { + return 11111; + } + + public String getLocalName() { + return null; + } + + public String getLocalAddr() { + return null; + } + + public int getLocalPort() { + return 22222; + } + + public void addParameter(String name, String values[]) { + parameters.put(name, values); + } + + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append(getClass().getName()).append("{"); + Enumeration enumeration = getParameterNames(); + while (enumeration.hasMoreElements()) { + String key = (String) enumeration.nextElement(); + String[] values = getParameterValues(key); + buffer.append("parameter:"); + buffer.append(key); + buffer.append("=["); + for (int i = 0; i < values.length; i++) { + String value = values[i]; + buffer.append(value); + if (i < values.length - 1) { + buffer.append(","); + } + } + buffer.append("]\n"); + } + buffer.append("}"); + return buffer.toString(); + } + + public Enumeration getParameterNames() { + return new Vector(parameters.keySet()).elements(); + } + + public String[] getParameterValues(String name) { + return (String[]) parameters.get(name); + } + + public void setSession(MockHttpSession session) { + this.httpSession = session; + } +} \ No newline at end of file Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletResponse.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletResponse.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpServletResponse.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,178 @@ +package net.sf.jsptest.compiler.jsp12.mock; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.util.Locale; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; + +public class MockHttpServletResponse implements HttpServletResponse { + + private ServletOutputStream servletOutputStream; + + private String description; + + private PrintWriter writer; + + public MockHttpServletResponse() { + this(new ByteArrayOutputStream()); + description = "(in-memory)"; + } + + public MockHttpServletResponse(File output) + throws FileNotFoundException { + this(new FileOutputStream(output)); + description = "(output file: " + output.getAbsolutePath() + + ")"; + } + + private MockHttpServletResponse(final OutputStream output) { + this.servletOutputStream = new JspTestServletOutputStream( + output); + writer = new PrintWriter(servletOutputStream) { + }; + } + + public String toString() { + return super.toString() + " " + description; + } + + public void addCookie(Cookie cookie) { + } + + public void addDateHeader(String s, long l) { + } + + public void addHeader(String s, String s1) { + } + + public void addIntHeader(String s, int i) { + } + + public boolean containsHeader(String s) { + return false; + } + + public String encodeRedirectURL(String s) { + return null; + } + + /** @deprecated */ + public String encodeRedirectUrl(String s) { + return null; + } + + public String encodeURL(String s) { + return s; + } + + /** @deprecated */ + public String encodeUrl(String s) { + return s; + } + + public void flushBuffer() throws IOException { + getOutputStream().flush(); + } + + public int getBufferSize() { + return 0; + } + + public String getCharacterEncoding() { + return null; + } + + public Locale getLocale() { + return null; + } + + public ServletOutputStream getOutputStream() throws IOException { + return servletOutputStream; + } + + public PrintWriter getWriter() throws IOException { + return writer; + } + + public boolean isCommitted() { + return false; + } + + public void reset() { + } + + public void resetBuffer() { + } + + public void sendError(int i) throws IOException { + throw new RuntimeException("Not implemented"); + } + + public void sendError(int i, String s) throws IOException { + throw new RuntimeException("Not implemented"); + } + + public void sendRedirect(String s) throws IOException { + throw new RuntimeException("Not implemented"); + } + + public void setBufferSize(int i) { + } + + public void setContentLength(int i) { + } + + public void setContentType(String s) { + } + + public void setDateHeader(String s, long l) { + } + + public void setHeader(String s, String s1) { + } + + public void setIntHeader(String s, int i) { + } + + public void setLocale(Locale locale) { + } + + /** @deprecated */ + public void setStatus(int i) { + } + + public void setStatus(int i, String s) { + } + + public String getContentType() { + return null; + } + + public void setCharacterEncoding(String reference) { + } +} \ No newline at end of file Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpSession.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpSession.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockHttpSession.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,106 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.jsp12.mock; + +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Vector; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpSessionContext; + +/** + * @author Lasse Koskela + */ +public class MockHttpSession implements HttpSession { + + private Map attributes = new HashMap(); + + public Object getAttribute(String s) { + return attributes.get(s); + } + + public Enumeration getAttributeNames() { + return new Vector(attributes.keySet()).elements(); + } + + public long getCreationTime() { + return 0; + } + + public String getId() { + return "JSPTESTSESSIONID"; + } + + public long getLastAccessedTime() { + return 0; + } + + public int getMaxInactiveInterval() { + return 0; + } + + public HttpSessionContext getSessionContext() { + return null; + } + + public Object getValue(String s) { + return null; + } + + public String[] getValueNames() { + return new String[0]; + } + + public void invalidate() { + } + + public boolean isNew() { + return false; + } + + public void putValue(String s, Object o) { + } + + public void removeAttribute(String s) { + attributes.remove(s); + } + + public void removeValue(String s) { + } + + public void setAttribute(String s, Object o) { + attributes.put(s, o); + } + + public void setMaxInactiveInterval(int i) { + } + + public ServletContext getServletContext() { + return null; + } + + /** + * For the purposes of jsptest. + */ + public void setAttributes(Map attributes) { + this.attributes.putAll(attributes); + } + +} Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspFactory.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspFactory.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspFactory.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,54 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.jsp12.mock; + +import javax.servlet.Servlet; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.jsp.JspEngineInfo; +import javax.servlet.jsp.JspFactory; +import javax.servlet.jsp.PageContext; + +/** + * @author Lasse Koskela + */ +public class MockJspFactory extends JspFactory { + + private PageContext pageContext; + + public MockJspFactory(PageContext pageContext) { + this.pageContext = pageContext; + } + + public PageContext getPageContext(Servlet servlet, ServletRequest request, + ServletResponse response, String errorPageURL, + boolean needsSession, int buffer, boolean autoflush) { + return pageContext; + } + + public void releasePageContext(PageContext pageContext) { + } + + public JspEngineInfo getEngineInfo() { + return new JspEngineInfo() { + + public String getSpecificationVersion() { + return "2.0"; + } + }; + } +} Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspWriter.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspWriter.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockJspWriter.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,159 @@ +/* + * Copyright 2007 Lasse Koskela. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.jsptest.compiler.jsp12.mock; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; + +import javax.servlet.jsp.JspWriter; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author Lasse Koskela + */ +public class MockJspWriter extends JspWriter { + + private Log log; + + private PrintWriter writer; + + private StringWriter stringWriter; + + public String getContents() { + return stringWriter.toString(); + } + + public MockJspWriter() { + super(1024, true); + log = LogFactory.getLog(getClass()); + stringWriter = new StringWriter(); + writer = new PrintWriter(stringWriter, true); + } + + public void newLine() throws IOException { + writer.println(); + } + + public void print(boolean x) throws IOException { + writer.print(x); + } + + public void print(char x) throws IOException { + writer.print(x); + } + + public void print(int x) throws IOException { + writer.print(x); + } + + public void print(long x) throws IOException { + writer.print(x); + } + + public void print(float x) throws IOException { + writer.print(x); + } + + public void print(double x) throws IOException { + writer.print(x); + } + + public void print(char[] x) throws IOException { + writer.print(x); + } + + public void print(String x) throws IOException { + writer.print(x); + } + + public void print(Object x) throws IOException { + writer.print(x); + } + + public void println() throws IOException { + writer.println(); + } + + public void println(boolean x) throws IOException { + writer.println(x); + } + + public void println(char x) throws IOException { + writer.println(x); + } + + public void println(int x) throws IOException { + writer.println(x); + } + + public void println(long x) throws IOException { + writer.println(x); + } + + public void println(float x) throws IOException { + writer.println(x); + } + + public void println(double x) throws IOException { + writer.println(x); + } + + public void println(char[] x) throws IOException { + writer.println(x); + } + + public void println(String x) throws IOException { + writer.println(x); + } + + public void println(Object x) throws IOException { + writer.println(x); + } + + public void clear() throws IOException { + notImplemented("clear()"); + } + + + public void clearBuffer() throws IOException { + notImplemented("clearBuffer()"); + } + + public void flush() throws IOException { + writer.flush(); + } + + public void close() throws IOException { + writer.close(); + } + + public int getRemaining() { + notImplemented("getRemaining()"); + return 0; + } + + public void write(char[] x, int start, int length) throws IOException { + writer.write(x, start, length); + } + + private void notImplemented(String methodSignature) { + log.error(getClass().getName() + "#" + methodSignature + " not implemented"); + } +} Added: branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockPageContext.java =================================================================== --- branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockPageContext.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-jsp12/src/main/java/net/sf/jsptest/compiler/jsp12/mock/MockPageContext.java 2007-10-05 18:34:06 UTC (rev 176) @@ -0,0 +1,286 @@ +package net.sf.jsptest.compiler.jsp12.mock; + +import java.io.IOException; +import java.util.Collection; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Vector; + +import javax.servlet.Servlet; +import javax.servlet... [truncated message content] |
From: <gdi...@us...> - 2007-10-05 18:33:42
|
Revision: 175 http://jsptest.svn.sourceforge.net/jsptest/?rev=175&view=rev Author: gdinwiddie Date: 2007-10-05 11:33:38 -0700 (Fri, 05 Oct 2007) Log Message: ----------- initial work toward getting jsptest to work for JSP 1.2 spec. So far the strategy has been to duplicate things for JSP 2.0 and hack them until the tests pass. The thought is that the duplication can be removed afterwards. Modified Paths: -------------- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c.tld trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/fmt.tld trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/web.xml trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/x.tld Added Paths: ----------- branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/jsptest/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/jsptest/acceptance/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/jsptest/acceptance/jsp/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/log4j.properties branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/index.jsp branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/name$_test-file2.jsp branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/sub/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/sub/dir/ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/sub/dir/page_in_subdir.jsp Added: branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java =================================================================== --- branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java (rev 0) +++ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/java/net/sf/jsptest/acceptance/jsp/BasicJspTest.java 2007-10-05 18:33:38 UTC (rev 175) @@ -0,0 +1,58 @@ +package net.sf.jsptest.acceptance.jsp; + +import junit.framework.AssertionFailedError; +import net.sf.jsptest.HtmlTestCase; + +/** + * @author Lasse Koskela + */ +public class BasicJspTest extends HtmlTestCase { + + protected String getWebRoot() { + return "src/test/resources/websrc"; + } + + public void testRenderingTrivialJsp() throws Exception { + get("/index.jsp"); + output().shouldContain("Hello from Jasper"); + } + + public void testOutputAssertion() throws Exception { + get("/index.jsp"); + output().shouldContain("Hello from Jasper"); + try { + output().shouldContain("No such content"); + throw new RuntimeException("Assertion should've failed"); + } catch (AssertionFailedError expected) { + } + } + + public void testRenderingSameJspMultipleTimes() throws Exception { + for (int i = 0; i < 5; i++) { + get("/index.jsp"); + output().shouldContain("Hello from Jasper"); + } + } + + public void testJspFileWithSpecialCharactersInName() + throws Exception { + get("/name$_test-file2.jsp"); + output().shouldContain("Hello from Jasper"); + } + + public void testJspFileInSubDirectory() throws Exception { + get("/sub/dir/page_in_subdir.jsp"); + output().shouldContain("Hello from Jasper"); + } + + public void testJspPathNotStartingWithSlash() throws Exception { + try { + get("sub/dir/page_in_subdir.jsp"); + fail("JSP path not starting with a slash should raise an exception"); + } catch (AssertionFailedError pass) { + throw pass; + } catch (Throwable e) { + assertEquals(IllegalArgumentException.class, e.getClass()); + } + } +} Added: branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/log4j.properties =================================================================== --- branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/log4j.properties (rev 0) +++ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/log4j.properties 2007-10-05 18:33:38 UTC (rev 175) @@ -0,0 +1,8 @@ +log4j.rootCategory=INFO, CONSOLE + +log4j.category.org.apache.commons.logging=WARN +log4j.category.net.sf.jsptest=DEBUG + +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%d{ISO8601}]%8.8p: %30.50c{6} -- %m%n Added: branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/index.jsp =================================================================== --- branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/index.jsp (rev 0) +++ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/index.jsp 2007-10-05 18:33:38 UTC (rev 175) @@ -0,0 +1,3 @@ +<%@ page language="Java" %> +Hello <%= "from" %> Jasper +The time is <%= new java.util.Date().toString() %> \ No newline at end of file Added: branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/name$_test-file2.jsp =================================================================== --- branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/name$_test-file2.jsp (rev 0) +++ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/name$_test-file2.jsp 2007-10-05 18:33:38 UTC (rev 175) @@ -0,0 +1,7 @@ +<%@ page language="Java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> +<html> + <body> + <p>Hello <%= "from" %> Jasper</p> + </body> +</html> \ No newline at end of file Added: branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/sub/dir/page_in_subdir.jsp =================================================================== --- branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/sub/dir/page_in_subdir.jsp (rev 0) +++ branches/multispecsupport.1.2/jsptest-acceptance/jsptest-acceptance-jsp12/src/test/resources/websrc/sub/dir/page_in_subdir.jsp 2007-10-05 18:33:38 UTC (rev 175) @@ -0,0 +1,7 @@ +<%@ page language="Java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> +<html> + <body> + <p>Hello <%= "from" %> Jasper</p> + </body> +</html> \ No newline at end of file Modified: trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld 2007-10-03 04:18:06 UTC (rev 174) +++ trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c-rt.tld 2007-10-05 18:33:38 UTC (rev 175) @@ -1,393 +1,393 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> -<!DOCTYPE taglib - PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" - "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> -<taglib> - <tlib-version>1.0</tlib-version> - <jsp-version>1.2</jsp-version> - <short-name>c_rt</short-name> - <uri>http://java.sun.com/jstl/core_rt</uri> - <display-name>JSTL core RT</display-name> - <description>JSTL 1.0 core library</description> - - <validator> - <validator-class> - org.apache.taglibs.standard.tlv.JstlCoreTLV - </validator-class> - <description> - Provides core validation features for JSTL tags. - </description> - </validator> - - <tag> - <name>catch</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class> - <body-content>JSP</body-content> - <description> - Catches any Throwable that occurs in its body and optionally - exposes it. - </description> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>choose</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> - <body-content>JSP</body-content> - <description> - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - </description> - </tag> - - <tag> - <name>if</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class> - <body-content>JSP</body-content> - <description> - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - </description> - <attribute> - <name>test</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>boolean</type> - </attribute> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>import</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class> - <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class> - <body-content>JSP</body-content> - <description> - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - </description> - <attribute> - <name>url</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>varReader</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>context</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>charEncoding</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>forEach</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class> - <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class> - <body-content>JSP</body-content> - <description> - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - </description> - <attribute> - <name>items</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>java.lang.Object</type> - </attribute> - <attribute> - <name>begin</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <name>end</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <name>step</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>varStatus</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>forTokens</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class> - <body-content>JSP</body-content> - <description> - Iterates over tokens, separated by the supplied delimeters - </description> - <attribute> - <name>items</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>java.lang.String</type> - </attribute> - <attribute> - <name>delims</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>java.lang.String</type> - </attribute> - <attribute> - <name>begin</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <name>end</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <name>step</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>varStatus</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>out</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class> - <body-content>JSP</body-content> - <description> - Like <%= ... >, but for expressions. - </description> - <attribute> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>default</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>escapeXml</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - - <tag> - <name>otherwise</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> - <body-content>JSP</body-content> - <description> - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - </description> - </tag> - - <tag> - <name>param</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class> - <body-content>JSP</body-content> - <description> - Adds a parameter to a containing 'import' tag's URL. - </description> - <attribute> - <name>name</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>value</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>redirect</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class> - <body-content>JSP</body-content> - <description> - Redirects to a new URL. - </description> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>url</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>context</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>remove</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class> - <body-content>empty</body-content> - <description> - Removes a scoped variable (from a particular scope, if specified). - </description> - <attribute> - <name>var</name> - <required>true</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>set</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class> - <body-content>JSP</body-content> - <description> - Sets the result of an expression evaluation in a 'scope' - </description> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>value</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>target</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>property</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>url</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class> - <body-content>JSP</body-content> - <description> - Creates a URL with optional query parameters. - </description> - <attribute> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <name>value</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <name>context</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <name>when</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class> - <body-content>JSP</body-content> - <description> - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - </description> - <attribute> - <name>test</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>boolean</type> - </attribute> - </tag> - -</taglib> +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE taglib + PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" + "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> +<taglib> + <tlib-version>1.0</tlib-version> + <jsp-version>1.2</jsp-version> + <short-name>c_rt</short-name> + <uri>http://java.sun.com/jstl/core_rt</uri> + <display-name>JSTL core RT</display-name> + <description>JSTL 1.0 core library</description> + + <validator> + <validator-class> + org.apache.taglibs.standard.tlv.JstlCoreTLV + </validator-class> + <description> + Provides core validation features for JSTL tags. + </description> + </validator> + + <tag> + <name>catch</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class> + <body-content>JSP</body-content> + <description> + Catches any Throwable that occurs in its body and optionally + exposes it. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>choose</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + </description> + </tag> + + <tag> + <name>if</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + </description> + <attribute> + <name>test</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>boolean</type> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>import</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class> + <body-content>JSP</body-content> + <description> + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + </description> + <attribute> + <name>url</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varReader</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>charEncoding</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forEach</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class> + <body-content>JSP</body-content> + <description> + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + </description> + <attribute> + <name>items</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object</type> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forTokens</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class> + <body-content>JSP</body-content> + <description> + Iterates over tokens, separated by the supplied delimeters + </description> + <attribute> + <name>items</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.String</type> + </attribute> + <attribute> + <name>delims</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.String</type> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>int</type> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>out</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class> + <body-content>JSP</body-content> + <description> + Like <%= ... >, but for expressions. + </description> + <attribute> + <name>value</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>default</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>escapeXml</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + + <tag> + <name>otherwise</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + </description> + </tag> + + <tag> + <name>param</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class> + <body-content>JSP</body-content> + <description> + Adds a parameter to a containing 'import' tag's URL. + </description> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>redirect</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class> + <body-content>JSP</body-content> + <description> + Redirects to a new URL. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>url</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>remove</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class> + <body-content>empty</body-content> + <description> + Removes a scoped variable (from a particular scope, if specified). + </description> + <attribute> + <name>var</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>set</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class> + <body-content>JSP</body-content> + <description> + Sets the result of an expression evaluation in a 'scope' + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>target</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>property</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>url</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class> + <body-content>JSP</body-content> + <description> + Creates a URL with optional query parameters. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>when</name> + <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + </description> + <attribute> + <name>test</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + <type>boolean</type> + </attribute> + </tag> + +</taglib> Modified: trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c.tld =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c.tld 2007-10-03 04:18:06 UTC (rev 174) +++ trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/c.tld 2007-10-05 18:33:38 UTC (rev 175) @@ -1,563 +1,416 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<taglib xmlns="http://java.sun.com/xml/ns/j2ee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" - version="2.0"> - - <description>JSTL 1.1 core library</description> - <display-name>JSTL core</display-name> - <tlib-version>1.1</tlib-version> - <short-name>c</short-name> - <uri>http://java.sun.com/jsp/jstl/core</uri> - - <validator> - <description> - Provides core validation features for JSTL tags. - </description> - <validator-class> - org.apache.taglibs.standard.tlv.JstlCoreTLV - </validator-class> - </validator> - - <tag> - <description> - Catches any Throwable that occurs in its body and optionally - exposes it. - </description> - <name>catch</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - </description> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - </description> - <name>choose</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> - <body-content>JSP</body-content> - </tag> - - <tag> - <description> - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - </description> - <name>if</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -The test condition that determines whether or -not the body content should be processed. - </description> - <name>test</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>boolean</type> - </attribute> - <attribute> - <description> -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - </description> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Scope for var. - </description> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - </description> - <name>import</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class> - <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class> - <body-content>JSP</body-content> - <attribute> - <description> -The URL of the resource to import. - </description> - <name>url</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - </description> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Scope for var. - </description> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - </description> - <name>varReader</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - </description> - <name>context</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Character encoding of the content at the input -resource. - </description> - <name>charEncoding</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - </description> - <name>forEach</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class> - <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class> - <body-content>JSP</body-content> - <attribute> - <description> -Collection of items to iterate over. - </description> - <name>items</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>java.lang.Object</type> - </attribute> - <attribute> - <description> -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - </description> - <name>begin</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <description> -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - </description> - <name>end</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <description> -Iteration will only process every step items of -the collection, starting with the first one. - </description> - <name>step</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <description> -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - </description> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - </description> - <name>varStatus</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Iterates over tokens, separated by the supplied delimeters - </description> - <name>forTokens</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -String of tokens to iterate over. - </description> - <name>items</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>java.lang.String</type> - </attribute> - <attribute> - <description> -The set of delimiters (the characters that -separate the tokens in the string). - </description> - <name>delims</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>java.lang.String</type> - </attribute> - <attribute> - <description> -Iteration begins at the token located at the -specified index. First token has index 0. - </description> - <name>begin</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <description> -Iteration ends at the token located at the -specified index (inclusive). - </description> - <name>end</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <description> -Iteration will only process every step tokens -of the string, starting with the first one. - </description> - <name>step</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - <type>int</type> - </attribute> - <attribute> - <description> -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - </description> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -javax.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - </description> - <name>varStatus</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Like <%= ... >, but for expressions. - </description> - <name>out</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -Expression to be evaluated. - </description> - <name>value</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Default value if the resulting value is null. - </description> - <name>default</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - </description> - <name>escapeXml</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - - <tag> - <description> - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - </description> - <name>otherwise</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> - <body-content>JSP</body-content> - </tag> - - <tag> - <description> - Adds a parameter to a containing 'import' tag's URL. - </description> - <name>param</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -Name of the query string parameter. - </description> - <name>name</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Value of the parameter. - </description> - <name>value</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Redirects to a new URL. - </description> - <name>redirect</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -The URL of the resource to redirect to. - </description> - <name>url</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - </description> - <name>context</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Removes a scoped variable (from a particular scope, if specified). - </description> - <name>remove</name> - <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class> - <body-content>empty</body-content> - <attribute> - <description> -Name of the scoped variable to be removed. - </description> - <name>var</name> - <required>true</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Scope for var. - </description> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Sets the result of an expression evaluation in a 'scope' - </description> - <name>set</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - </description> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Expression to be evaluated. - </description> - <name>value</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - </description> - <name>target</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the property to be set in the target object. - </description> - <name>property</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Scope for var. - </description> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Creates a URL with optional query parameters. - </description> - <name>url</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - </description> - <name>var</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -Scope for var. - </description> - <name>scope</name> - <required>false</required> - <rtexprvalue>false</rtexprvalue> - </attribute> - <attribute> - <description> -URL to be processed. - </description> - <name>value</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - <attribute> - <description> -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - </description> - <name>context</name> - <required>false</required> - <rtexprvalue>true</rtexprvalue> - </attribute> - </tag> - - <tag> - <description> - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - </description> - <name>when</name> - <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class> - <body-content>JSP</body-content> - <attribute> - <description> -The test condition that determines whether or not the -body content should be processed. - </description> - <name>test</name> - <required>true</required> - <rtexprvalue>true</rtexprvalue> - <type>boolean</type> - </attribute> - </tag> - -</taglib> +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!DOCTYPE taglib + PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" + "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> +<taglib> + <tlib-version>1.0</tlib-version> + <jsp-version>1.2</jsp-version> + <short-name>c</short-name> + <uri>http://java.sun.com/jstl/core</uri> + <display-name>JSTL core</display-name> + <description>JSTL 1.0 core library</description> + + <validator> + <validator-class> + org.apache.taglibs.standard.tlv.JstlCoreTLV + </validator-class> + <init-param> + <param-name>expressionAttributes</param-name> + <param-value> + out:value + out:default + out:escapeXml + if:test + import:url + import:context + import:charEncoding + forEach:items + forEach:begin + forEach:end + forEach:step + forTokens:items + forTokens:begin + forTokens:end + forTokens:step + param:encode + param:name + param:value + redirect:context + redirect:url + set:property + set:target + set:value + url:context + url:value + when:test + </param-value> + <description> + Whitespace-separated list of colon-separated token pairs + describing tag:attribute combinations that accept expressions. + The validator uses this information to determine which + attributes need their syntax validated. + </description> + </init-param> + </validator> + + <tag> + <name>catch</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class> + <body-content>JSP</body-content> + <description> + Catches any Throwable that occurs in its body and optionally + exposes it. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>choose</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag that establishes a context for + mutually exclusive conditional operations, marked by + <when> and <otherwise> + </description> + </tag> + + <tag> + <name>out</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.OutTag</tag-class> + <body-content>JSP</body-content> + <description> + Like <%= ... >, but for expressions. + </description> + <attribute> + <name>value</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>default</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>escapeXml</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>if</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.IfTag</tag-class> + <body-content>JSP</body-content> + <description> + Simple conditional tag, which evalutes its body if the + supplied condition is true and optionally exposes a Boolean + scripting variable representing the evaluation of this condition + </description> + <attribute> + <name>test</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>import</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ImportTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class> + <body-content>JSP</body-content> + <description> + Retrieves an absolute or relative URL and exposes its contents + to either the page, a String in 'var', or a Reader in 'varReader'. + </description> + <attribute> + <name>url</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varReader</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>charEncoding</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forEach</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ForEachTag</tag-class> + <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class> + <body-content>JSP</body-content> + <description> + The basic iteration tag, accepting many different + collection types and supporting subsetting and other + functionality + </description> + <attribute> + <name>items</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>forTokens</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ForTokensTag</tag-class> + <body-content>JSP</body-content> + <description> + Iterates over tokens, separated by the supplied delimeters + </description> + <attribute> + <name>items</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>delims</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>begin</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>end</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>step</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>varStatus</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>otherwise</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that follows <when> tags + and runs only if all of the prior conditions evaluated to + 'false' + </description> + </tag> + + <tag> + <name>param</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.ParamTag</tag-class> + <body-content>JSP</body-content> + <description> + Adds a parameter to a containing 'import' tag's URL. + </description> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>redirect</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.RedirectTag</tag-class> + <body-content>JSP</body-content> + <description> + Redirects to a new URL. + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>url</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>remove</name> + <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class> + <body-content>empty</body-content> + <description> + Removes a scoped variable (from a particular scope, if specified). + </description> + <attribute> + <name>var</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>set</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.SetTag</tag-class> + <body-content>JSP</body-content> + <description> + Sets the result of an expression evaluation in a 'scope' + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>target</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>property</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>url</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.UrlTag</tag-class> + <body-content>JSP</body-content> + <description> + Prints or exposes a URL with optional query parameters + (via the c:param tag). + </description> + <attribute> + <name>var</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>scope</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>value</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + <attribute> + <name>context</name> + <required>false</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>when</name> + <tag-class>org.apache.taglibs.standard.tag.el.core.WhenTag</tag-class> + <body-content>JSP</body-content> + <description> + Subtag of <choose> that includes its body if its + condition evalutes to 'true' + </description> + <attribute> + <name>test</name> + <required>true</required> + <rtexprvalue>false</rtexprvalue> + </attribute> + </tag> + +</taglib> \ No newline at end of file Modified: trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/fmt.tld =================================================================== --- trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/fmt.tld 2007-10-03 04:18:06 UTC (rev 174) +++ trunk/jsptest-acceptance/jsptest-acceptance-jsp20/src/test/resources/websrc/WEB-INF/fmt.tld 2007-10-05 18:33:38 UTC (rev 175) @@ -1,671 +1,442 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<taglib xmlns="http://java.sun.com/xml/ns/j2ee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" - version="2.0"> - - <description>JSTL 1.1 i18n-capable formatting library</description> - <display-name>JSTL fmt</display-name> - <tlib-version>1.1</tlib-version> - <short-name>fmt</short-name> - <uri>http://java.sun.com/jsp/jstl/fmt</uri> - - <validator> - <description> - Provides core validation features for JSTL tags. - <... [truncated message content] |
From: <lko...@us...> - 2007-10-03 04:18:11
|
Revision: 174 http://jsptest.svn.sourceforge.net/jsptest/?rev=174&view=rev Author: lkoskela Date: 2007-10-02 21:18:06 -0700 (Tue, 02 Oct 2007) Log Message: ----------- Temporary solution for building all components. Added Paths: ----------- trunk/build.sh Added: trunk/build.sh =================================================================== --- trunk/build.sh (rev 0) +++ trunk/build.sh 2007-10-03 04:18:06 UTC (rev 174) @@ -0,0 +1,8 @@ +#!/bin/sh +eval 'cd jsptest-generic/jsptest-common;eval "mvn install";cd ../..' +eval 'cd jsptest-generic/jsptest-compiler-api;eval "mvn install";cd ../..' +eval 'cd jsptest-generic;eval "mvn install";cd ..' +eval 'cd jsptest-jsp12;eval "mvn install";cd ..' +eval 'cd jsptest-jsp20;eval "mvn install";cd ..' +eval 'cd jsptest-jsp21;eval "mvn install";cd ..' +eval 'mvn install' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gdi...@us...> - 2007-10-02 21:22:27
|
Revision: 173 http://jsptest.svn.sourceforge.net/jsptest/?rev=173&view=rev Author: gdinwiddie Date: 2007-10-02 14:22:24 -0700 (Tue, 02 Oct 2007) Log Message: ----------- branch to get JSP spec 1.2 working Added Paths: ----------- branches/multispecsupport.1.2/ Copied: branches/multispecsupport.1.2 (from rev 172, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |