[jboss-cvs] JBossAS SVN: r93046 - in trunk: server/src/etc/deployers and 13 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 31 14:26:09 EDT 2009
Author: remy.maucherat at jboss.com
Date: 2009-08-31 14:26:08 -0400 (Mon, 31 Aug 2009)
New Revision: 93046
Added:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextJarRepository.java
Removed:
trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/JspServletOptions.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/TagLibCache.java
Modified:
trunk/component-matrix/pom.xml
trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SetNewSessionCookieUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java
trunk/testsuite/src/main/org/jboss/test/web/security/authenticators/HeaderAuthenticator.java
trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossDelegatingInjectionProvider.java
trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossScanningInjectionProvider.java
trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedFormAuthenticator.java
trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedRealm.java
trunk/tomcat/src/main/org/jboss/web/tomcat/security/FormAuthenticator.java
trunk/tomcat/src/main/org/jboss/web/tomcat/security/JBossExtendedSecurityMgrRealm.java
trunk/tomcat/src/main/org/jboss/web/tomcat/security/authenticators/JASPIFormAuthenticator.java
trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/TomcatJASPIAuthenticator.java
trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/modules/HTTPFormServerAuthModule.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/WebCtxLoader.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java
trunk/tomcat/src/resources/web.xml
Log:
- Update to the JBoss Web 3 branch.
- Some operations are delegated to Catalina until they are implemented in AS. This includes
TLD parsing.
- Emulate the TLD processing for JSTL and JSF using a hack. This could be made configurable,
but is normally very temporary (another component will need to handle shared TLD metadata
and servlet container initializer).
- A few API changes (in particular cookies and security).
Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/component-matrix/pom.xml 2009-08-31 18:26:08 UTC (rev 93046)
@@ -42,7 +42,7 @@
<version.jboss.jbossws>3.2.0.GA</version.jboss.jbossws>
<version.jboss.jms-integration-tests>1.0.1.GA</version.jboss.jms-integration-tests>
<version.jboss.messaging>1.4.1.GA</version.jboss.messaging>
- <version.jboss.web>2.1.2.GA</version.jboss.web>
+ <version.jboss.web>3.0.0.alpha-2</version.jboss.web>
<version.jgroups>2.6.12.GA</version.jgroups>
<version.junit>3.8.2</version.junit>
<version.org.hibernate.annotations>3.4.0.GA</version.org.hibernate.annotations>
Modified: trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml
===================================================================
--- trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/server/src/etc/deployers/metadata-deployer-jboss-beans.xml 2009-08-31 18:26:08 UTC (rev 93046)
@@ -269,11 +269,11 @@
<!-- WebMetaData -->
<entry>
<key>web-app</key>
- <value>org.jboss.metadata.web.spec.Web23MetaData</value>
+ <value>org.jboss.metadata.web.spec.Web22MetaData</value>
</entry>
<entry>
<key>web-app_2_2.dtd</key>
- <value>org.jboss.metadata.web.spec.Web23MetaData</value>
+ <value>org.jboss.metadata.web.spec.Web22MetaData</value>
</entry>
<entry>
<key>web-app_2_3.dtd</key>
@@ -287,6 +287,35 @@
<key>web-app_2_5.xsd</key>
<value>org.jboss.metadata.web.spec.Web25MetaData</value>
</entry>
+ <entry>
+ <key>web-app_3_0.xsd</key>
+ <value>org.jboss.metadata.web.spec.Web30MetaData</value>
+ </entry>
+
+ <!-- WebFragmentMetaData -->
+ <entry>
+ <key>web-fragment_3_0.xsd</key>
+ <value>org.jboss.metadata.web.spec.WebFragment30MetaData</value>
+ </entry>
+
+ <!-- TldMetaData -->
+ <entry>
+ <key>web-jsptaglibrary_1_1.dtd</key>
+ <value>org.jboss.metadata.web.spec.Tld11MetaData</value>
+ </entry>
+ <entry>
+ <key>web-jsptaglibrary_1_2.dtd</key>
+ <value>org.jboss.metadata.web.spec.Tld12MetaData</value>
+ </entry>
+ <entry>
+ <key>web-jsptaglibrary_2_0.xsd</key>
+ <value>org.jboss.metadata.web.spec.Tld20MetaData</value>
+ </entry>
+ <entry>
+ <key>web-jsptaglibrary_2_1.xsd</key>
+ <value>org.jboss.metadata.web.spec.Tld21MetaData</value>
+ </entry>
+
<!-- JBossWebMetaData -->
<entry>
<key>jboss-web</key>
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SetNewSessionCookieUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SetNewSessionCookieUnitTestCase.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/SetNewSessionCookieUnitTestCase.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -31,7 +31,6 @@
import org.apache.catalina.connector.Response;
import org.apache.catalina.core.StandardContext;
import org.apache.catalina.deploy.SessionCookie;
-import org.apache.tomcat.util.http.TomcatCookie;
import org.jboss.test.cluster.web.mocks.MockConnector;
import org.jboss.test.cluster.web.mocks.MockEngine;
import org.jboss.test.cluster.web.mocks.MockHost;
@@ -202,10 +201,7 @@
assertEquals("comment", cookieComment, cookie.getComment());
assertEquals("domain", cookieDomain, cookie.getDomain());
assertEquals("secure", secure, cookie.getSecure());
- if (cookie instanceof TomcatCookie)
- {
- assertEquals("httpOnly", httpOnly, ((TomcatCookie) cookie).getHttpOnly());
- }
+ assertEquals("httpOnly", httpOnly, cookie.isHttpOnly());
}
private void basicValidation(Cookie cookie)
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/mocks/MockLoader.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -58,6 +58,12 @@
return null;
}
+ public String[] findLoaderRepositories()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
public ClassLoader getClassLoader()
{
return container == null ? getClass().getClassLoader()
Modified: trunk/testsuite/src/main/org/jboss/test/web/security/authenticators/HeaderAuthenticator.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/security/authenticators/HeaderAuthenticator.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/testsuite/src/main/org/jboss/test/web/security/authenticators/HeaderAuthenticator.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -70,7 +70,7 @@
* @exception IOException if an input/output error occurs
*/
protected boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException
{
Modified: trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossDelegatingInjectionProvider.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossDelegatingInjectionProvider.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossDelegatingInjectionProvider.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -24,7 +24,7 @@
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
-import org.apache.InstanceManager;
+import org.apache.tomcat.InstanceManager;
import org.jboss.logging.Logger;
import org.jboss.web.tomcat.service.TomcatInjectionContainer;
Modified: trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossScanningInjectionProvider.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossScanningInjectionProvider.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/jsf/integration/injection/JBossScanningInjectionProvider.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -30,7 +30,7 @@
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
-import org.apache.InstanceManager;
+import org.apache.tomcat.InstanceManager;
import org.jboss.logging.Logger;
import org.jboss.web.tomcat.service.TomcatInjectionContainer;
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedFormAuthenticator.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedFormAuthenticator.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedFormAuthenticator.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -24,6 +24,7 @@
import java.io.IOException;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Session;
import org.apache.catalina.authenticator.Constants;
@@ -79,7 +80,7 @@
*
* @exception IOException if an input/output error occurs
*/
- public boolean authenticate(Request request, Response response, LoginConfig config) throws IOException
+ public boolean authenticate(Request request, HttpServletResponse response, LoginConfig config) throws IOException
{
boolean didPopulate = false;
@@ -118,7 +119,7 @@
* @param config Login configuration describing how authentication should
* be performed
*/
- protected void forwardToErrorPage(Request request, Response response, LoginConfig config)
+ protected void forwardToErrorPage(Request request, HttpServletResponse response, LoginConfig config)
{
if (trace)
log.trace("forwardToErrorPage");
@@ -135,7 +136,7 @@
* @param config Login configuration describing how authentication should
* be performed
*/
- protected void forwardToLoginPage(Request request, Response response, LoginConfig config)
+ protected void forwardToLoginPage(Request request, HttpServletResponse response, LoginConfig config)
{
if (trace)
log.trace("forwardToLoginPage");
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedRealm.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedRealm.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/ExtendedRealm.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -25,7 +25,7 @@
import org.apache.catalina.Realm;
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
+import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.deploy.LoginConfig;
//$Id$
@@ -39,6 +39,6 @@
*/
public interface ExtendedRealm extends Realm
{
- public Principal authenticate(Request request, Response response,
+ public Principal authenticate(Request request, HttpServletResponse response,
LoginConfig loginConfig) throws Exception;
}
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/FormAuthenticator.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/FormAuthenticator.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/FormAuthenticator.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -121,7 +121,7 @@
* @exception IOException if an input/output error occurs
*/
public boolean authenticate(Request request,
- Response response,
+ HttpServletResponse response,
LoginConfig config)
throws IOException {
@@ -220,7 +220,6 @@
uriCC.setLimit(-1);
String contextPath = request.getContextPath();
String requestURI = request.getDecodedRequestURI();
- response.setContext(request.getContext());
// Is this the action request from the login page?
boolean loginAction =
@@ -290,26 +289,25 @@
// ------------------------------------------------------ Protected Methods
- protected void forwardToErrorPage(Request request, Response response, LoginConfig config)
+ protected void forwardToErrorPage(Request request, HttpServletResponse response, LoginConfig config)
{
RequestDispatcher disp =
context.getServletContext().getRequestDispatcher
(config.getErrorPage());
try {
- disp.forward(request.getRequest(), response.getResponse());
+ disp.forward(request.getRequest(), response);
} catch (Throwable t) {
log.warn("Unexpected error forwarding to error page", t);
}
}
- protected void forwardToLoginPage(Request request, Response response, LoginConfig config)
+ protected void forwardToLoginPage(Request request, HttpServletResponse response, LoginConfig config)
{
RequestDispatcher disp =
context.getServletContext().getRequestDispatcher
(config.getLoginPage());
try {
- disp.forward(request.getRequest(), response.getResponse());
- response.finishResponse();
+ disp.forward(request.getRequest(), response);
} catch (Throwable t) {
log.warn("Unexpected error forwarding to login page", t);
}
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/JBossExtendedSecurityMgrRealm.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/JBossExtendedSecurityMgrRealm.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/JBossExtendedSecurityMgrRealm.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -128,11 +128,11 @@
/**
* @see ExtendedRealm#authenticate(Request, Response, LoginConfig)
*/
- public Principal authenticate(Request request, Response response,
+ public Principal authenticate(Request request, HttpServletResponse response,
LoginConfig config) throws Exception
{
log.debug("ExtendedSecurityMgrRealm:authenticate");
- MessageInfo authParam = new GenericMessageInfo(request,response);
+ MessageInfo authParam = new GenericMessageInfo(request, request.getResponse());
GeneralizedAuthenticationManager gam = getAuthenticationManager();
Subject clientSubject = new Subject();
Subject serviceSubject = new Subject();
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/authenticators/JASPIFormAuthenticator.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/authenticators/JASPIFormAuthenticator.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/authenticators/JASPIFormAuthenticator.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -57,7 +57,7 @@
* @see FormAuthenticator#authenticate(org.apache.catalina.connector.Request,
* org.apache.catalina.connector.Response, org.apache.catalina.deploy.LoginConfig)
*/
- public boolean authenticate(Request request, Response response,
+ public boolean authenticate(Request request, HttpServletResponse response,
LoginConfig config) throws IOException
{
//References to objects we will need later
@@ -165,7 +165,6 @@
uriCC.setLimit(-1);
String contextPath = request.getContextPath();
String requestURI = request.getDecodedRequestURI();
- response.setContext(request.getContext());
// Is this the action request from the login page?
boolean loginAction =
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/TomcatJASPIAuthenticator.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/TomcatJASPIAuthenticator.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/TomcatJASPIAuthenticator.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -28,12 +28,12 @@
import javax.security.auth.message.callback.CallerPrincipalCallback;
import javax.security.auth.message.callback.PasswordValidationCallback;
import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Session;
import org.apache.catalina.authenticator.AuthenticatorBase;
import org.apache.catalina.authenticator.Constants;
import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
import org.apache.catalina.deploy.LoginConfig;
import org.jboss.logging.Logger;
import org.jboss.security.ServerAuthenticationManager;
@@ -54,7 +54,7 @@
protected String serverAuthenticationManagerClass = JASPIServerAuthenticationManager.class.getName();
@Override
- protected boolean authenticate(Request request, Response response, LoginConfig config) throws IOException
+ protected boolean authenticate(Request request, HttpServletResponse response, LoginConfig config) throws IOException
{
boolean result = false;
@@ -91,7 +91,8 @@
GenericMessageInfo messageInfo = new GenericMessageInfo();
messageInfo.setRequestMessage(request);
- messageInfo.setResponseMessage(response);
+ // FIXME: Change message info to operate on HttpServletResponse, to align with Servlet 3.0
+ messageInfo.setResponseMessage(request.getResponse());
//Put bits of information needed by tomcat server auth modules
messageInfo.getMap().put("CACHE", cache);
@@ -167,7 +168,7 @@
* @param username Username used to authenticate (if any)
* @param password Password used to authenticate (if any)
*/
- protected void register(Request request, Response response,
+ protected void register(Request request, HttpServletResponse response,
Principal principal, String authType,
String username, String password) {
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/modules/HTTPFormServerAuthModule.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/modules/HTTPFormServerAuthModule.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/jaspi/modules/HTTPFormServerAuthModule.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -183,7 +183,6 @@
uriCC.setLimit(-1);
String contextPath = request.getContextPath();
String requestURI = request.getDecodedRequestURI();
- response.setContext(request.getContext());
// Is this the action request from the login page?
boolean loginAction =
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/TomcatInjectionContainer.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -45,7 +45,7 @@
import java.util.Set;
import java.util.Collections;
-import org.apache.InstanceManager;
+import org.apache.tomcat.InstanceManager;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.deployment.MappedReferenceMetaDataResolverDeployer;
@@ -264,6 +264,14 @@
return newInstance(className, loader);
}
+ public Object newInstance(Class<?> clazz) throws IllegalAccessException, InvocationTargetException, NamingException, InstantiationException
+ {
+ checkAccess(clazz);
+ Object instance = clazz.newInstance();
+ newInstance(instance);
+ return instance;
+ }
+
public Object newInstance(String className, ClassLoader classLoader) throws IllegalAccessException, InvocationTargetException, NamingException,
InstantiationException, ClassNotFoundException
{
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/WebCtxLoader.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/WebCtxLoader.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/WebCtxLoader.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -240,6 +240,10 @@
setClassPath();
}
+ public String[] findLoaderRepositories() {
+ return findRepositories();
+ }
+
public String[] findRepositories()
{
String[] tmp = new String[repositories.size()];
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextConfig.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -31,16 +31,24 @@
import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import java.util.jar.JarFile;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
import javax.xml.namespace.QName;
+import org.apache.catalina.JarRepository;
+import org.apache.catalina.core.ContextJarRepository;
import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.deploy.JspPropertyGroup;
import org.apache.catalina.deploy.SessionCookie;
import org.apache.catalina.startup.ContextConfig;
+import org.apache.catalina.startup.WebAnnotationSet;
import org.apache.tomcat.util.IntrospectionUtils;
+import org.apache.naming.resources.JARDirContext;
+import org.apache.naming.resources.ProxyDirContext;
+
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.kernel.Kernel;
@@ -152,6 +160,8 @@
// Metadata complete
context.setIgnoreAnnotations(metaData.isMetadataComplete());
+ // Version
+ context.setVersion(metaData.getVersion());
// SetPublicId
if (metaData.is25())
@@ -162,7 +172,7 @@
context.setPublicId(org.apache.catalina.startup.Constants.WebDtdPublicId_23);
else
context.setPublicId(org.apache.catalina.startup.Constants.WebDtdPublicId_22);
-
+
// processContextParameters() provides a merged view of the context params
// Display name
@@ -393,15 +403,36 @@
JspConfigMetaData config = metaData.getJspConfig();
if (config != null)
{
+ // Property groups
List<JspPropertyGroupMetaData> groups = config.getPropertyGroups();
if (groups != null)
{
for (JspPropertyGroupMetaData group : groups)
{
+ org.apache.catalina.deploy.JspPropertyGroup jspPropertyGroup =
+ new org.apache.catalina.deploy.JspPropertyGroup();
for (String pattern : group.getUrlPatterns())
{
- context.addJspMapping(pattern);
+ jspPropertyGroup.addUrlPattern(pattern);
}
+ jspPropertyGroup.setElIgnored(group.getElIgnored());
+ jspPropertyGroup.setPageEncoding(group.getPageEncoding());
+ jspPropertyGroup.setScriptingInvalid(group.isScriptingInvalid());
+ jspPropertyGroup.setIsXml(group.getXml());
+ for (String includePrelude : group.getIncludePrelude())
+ {
+ jspPropertyGroup.addIncludePrelude(includePrelude);
+ }
+ for (String includeCoda : group.getIncludeCoda())
+ {
+ jspPropertyGroup.addIncludeCoda(includeCoda);
+ }
+ jspPropertyGroup.setDeferredSyntaxAllowedAsLiteral(group.getDeferredSyntaxAllowedAsLiteral());
+ jspPropertyGroup.setTrimDirectiveWhitespaces(group.getTrimDirectiveWhitespaces());
+ jspPropertyGroup.setDefaultContentType(group.getDefaultContentType());
+ jspPropertyGroup.setBuffer(group.getBuffer());
+ jspPropertyGroup.setErrorOnUndeclaredNamespace(group.getErrorOnUndeclaredNamespace());
+ context.addJspPropertyGroup(jspPropertyGroup);
}
}
// Taglib
@@ -528,6 +559,12 @@
*/
protected void init()
{
+ // FIXME: remove when AS takes over TLD parsing
+ if (tldDigester == null) {
+ tldDigester = createTldDigester();
+ tldDigester.getParser();
+ }
+
context.setConfigured(false);
ok = true;
@@ -538,8 +575,68 @@
}
// This should come from the deployment unit
processContextConfig(context.getConfigFile(), true);
+
+ // FIXME: some operations will be delegated to JBoss Web until AS implements them
+ // Includes: fragment processing, overlay, TLD processing
+ if (context.getJarRepository() == null) {
+ context.setJarRepository(new JBossContextJarRepository("jsf-libs/jsf-impl.jar,jstl.jar"));
+ }
+
}
+ /**
+ * @deprecated Temporary override to disable annotation scanning which uses EE6 classes
+ */
+ protected void completeConfig() {
+ // Called from StandardContext.start()
+
+ // Scan all Servlet API related annotations
+ /*
+ if (ok && !context.getIgnoreAnnotations()) {
+ try {
+ org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(context);
+ } catch (Throwable t) {
+ log.error("Error: " + t.getMessage());
+ }
+ }*/
+ if (ok) {
+ validateSecurityRoles();
+ }
+
+ // Configure an authenticator if we need one
+ if (ok) {
+ authenticatorConfig();
+ }
+
+ // Find and configure overlays
+ if (ok) {
+ JarRepository jarRepository = context.getJarRepository();
+ JarFile[] jars = jarRepository.findJars();
+ for (int i = 0; i < jars.length; i++) {
+ if (jars[i].getEntry(org.apache.catalina.Globals.OVERLAY_PATH) != null) {
+ if (context.getResources() instanceof ProxyDirContext) {
+ ProxyDirContext resources = (ProxyDirContext) context.getResources();
+ JARDirContext overlay = new JARDirContext();
+ overlay.setJarFile(jars[i], org.apache.catalina.Globals.OVERLAY_PATH);
+ resources.addOverlay(overlay);
+ } else {
+ // Error, overlays need a ProxyDirContext to compose results
+ log.error(sm.getString("contextConfig.noOverlay", jars[i].getName()));
+ ok = false;
+ }
+ overlays.add(jars[i].getName());
+ }
+ }
+ }
+
+ // Make our application unavailable if problems were encountered
+ if (!ok) {
+ log.error(sm.getString("contextConfig.unavailable"));
+ context.setConfigured(false);
+ }
+
+ }
+
protected void processContextConfig(String resourceName, boolean local)
{
ContextMetaData contextMetaData = null;
Added: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextJarRepository.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextJarRepository.java (rev 0)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/JBossContextJarRepository.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.web.tomcat.service.deployers;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+import java.util.jar.JarFile;
+
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.core.ContextJarRepository;
+import org.jboss.logging.Logger;
+
+/**
+ * Temporary class to add shared JARs to the webapp. This will allow supporting
+ * TLDs and other features by delegating them to Catalina.
+ *
+ * @author remm
+ * @deprecated To remove ...
+ */
+public class JBossContextJarRepository extends ContextJarRepository
+{
+ private static Logger log = Logger.getLogger(JBossContextJarRepository.class);
+ ArrayList<String> tagLibJars = new ArrayList<String>();
+
+ public JBossContextJarRepository(String tagLibJars)
+ {
+ super();
+ StringTokenizer tokenizer = new StringTokenizer(tagLibJars, ",");
+ while (tokenizer.hasMoreTokens())
+ {
+ this.tagLibJars.add(tokenizer.nextToken().trim());
+ }
+ }
+
+ public synchronized void start() throws LifecycleException
+ {
+ super.start();
+
+ ArrayList<JarFile> jarFilesArrayList = new ArrayList<JarFile>();
+ for (JarFile jarFile: jarFilesArray)
+ {
+ jarFilesArrayList.add(jarFile);
+ }
+
+ try
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ URL web = loader.getResource("server.xml");
+ URL sarURL = new URL(web, ".");
+ for(int n = 0; n < tagLibJars.size(); n ++)
+ {
+ String jarPath = (String) tagLibJars.get(n);
+ URL url = new URL(sarURL, jarPath);
+ String resourcePath = url.toString();
+ log.debug("Scanning for tlds in: "+resourcePath);
+ URLConnection conn = url.openConnection();
+ conn.setUseCaches(false);
+ InputStream is = null;
+ OutputStream os = null;
+ try {
+ is = conn.getInputStream();
+ File tempJar = File.createTempFile(jarPath, ".tmp");
+ os = new FileOutputStream(tempJar);
+ byte[] buf = new byte[4096];
+ int numRead;
+ while ( (numRead = is.read(buf) ) >= 0) {
+ os.write(buf, 0, numRead);
+ }
+ JarFile jarFile = new JarFile(tempJar);
+ jarFilesArrayList.add(jarFile);
+ }
+ catch (Exception e)
+ {
+ log.debug("Failed to process shared JAR: " + jarPath, e);
+ }
+ finally
+ {
+ if (is != null) is.close();
+ if (os != null) os.close();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.debug("Failed to process shared libs", e);
+ }
+
+ jarFilesArray = jarFilesArrayList.toArray(new JarFile[0]);
+
+ }
+
+}
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/deployers/TomcatDeployment.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -219,7 +219,6 @@
}
context.setJavaVMs(javaVMs);
context.setServer(serverName);
- context.setSaveConfig(false);
if (webLoader != null)
{
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/JspServletOptions.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/JspServletOptions.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/JspServletOptions.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -1,830 +0,0 @@
-/*
- * Copyright 1999,2004 The Apache Software Foundation.
- *
- * 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 org.jboss.web.tomcat.service.jasper;
-
-import java.util.Properties;
-import java.util.Enumeration;
-import java.util.ArrayList;
-import java.util.Map;
-import java.io.File;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-
-import org.apache.jasper.Options;
-import org.apache.jasper.Constants;
-import org.apache.jasper.xmlparser.ParserUtils;
-import org.apache.jasper.compiler.TldLocationsCache;
-import org.apache.jasper.compiler.JspConfig;
-import org.apache.jasper.compiler.TagPluginManager;
-import org.apache.jasper.compiler.Localizer;
-import org.jboss.logging.Logger;
-import org.jboss.web.jsf.integration.config.JBossJSFConfigureListener;
-
-/**
- * Override the default JspServletOptions to externalize the jsp layer
- * configuration. This overrides the default TagLibCache to the jboss version.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class JspServletOptions
- implements Options
-{
- static Logger log = Logger.getLogger(JspServletOptions.class);
-
- private Properties settings = new Properties();
-
- /**
- * Is Jasper being used in development mode?
- */
- private boolean development = true;
-
- /**
- * Should we include a source fragment in exception messages, which could be displayed
- * to the developer ?
- */
- private boolean displaySourceFragment = true;
-
- /**
- * Should Ant fork its java compiles of JSP pages.
- */
- public boolean fork = true;
-
- /**
- * Do you want to keep the generated Java files around?
- */
- private boolean keepGenerated = true;
-
- /**
- * Should white spaces between directives or actions be trimmed?
- */
- private boolean trimSpaces = false;
-
- /**
- * Determines whether tag handler pooling is enabled.
- */
- private boolean isPoolingEnabled = true;
-
- /**
- * Do you want support for "mapped" files? This will generate servlet that
- * has a print statement per line of the JSP file. This seems like a really
- * nice feature to have for debugging.
- */
- private boolean mappedFile = true;
-
- /**
- * Do you want stack traces and such displayed in the client's browser? If
- * this is false, such messages go to the standard error or a log file if the
- * standard error is redirected.
- */
- private boolean sendErrorToClient = false;
-
- /**
- * Do we want to include debugging information in the class file?
- */
- private boolean classDebugInfo = true;
-
- /**
- * Background compile thread check interval in seconds.
- */
- private int checkInterval = 0;
-
- /**
- * Is the generation of SMAP info for JSR45 debuggin suppressed?
- */
- private boolean isSmapSuppressed = false;
-
- /**
- * Should SMAP info for JSR45 debugging be dumped to a file?
- */
- private boolean isSmapDumped = false;
-
- /**
- * Are Text strings to be generated as char arrays?
- */
- private boolean genStringAsCharArray = false;
-
- private boolean errorOnUseBeanInvalidClassAttribute = true;
-
- /**
- * I want to see my generated servlets. Which directory are they in?
- */
- private File scratchDir;
-
- /**
- * Need to have this as is for versions 4 and 5 of IE. Can be set from the
- * initParams so if it changes in the future all that is needed is to have a
- * jsp initParam of type ieClassId="<value>"
- */
- private String ieClassId = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93";
-
- /**
- * What classpath should I use while compiling generated servlets?
- */
- private String classpath = null;
-
- /**
- * Compiler to use.
- */
- private String compiler = null;
-
- /**
- * The compiler class name.
- */
- private String compilerClassName = null;
-
- /**
- * Compiler target VM.
- */
- private String compilerTargetVM = "1.5";
-
- /**
- * The compiler source VM.
- */
- private String compilerSourceVM = "1.5";
-
- /**
- * Cache for the TLD locations
- */
- private TldLocationsCache tldLocationsCache = null;
-
- /**
- * Jsp config information
- */
- private JspConfig jspConfig = null;
-
- /**
- * TagPluginManager
- */
- private TagPluginManager tagPluginManager = null;
-
- /**
- * Java platform encoding to generate the JSP page servlet.
- */
- private String javaEncoding = "UTF8";
-
- /**
- * Modification test interval.
- */
- private int modificationTestInterval = 4;
-
- private boolean ignoreAnnotations;
-
-
-
- /**
- * Is generation of X-Powered-By response header enabled/disabled?
- */
- private boolean xpoweredBy;
-
-
- public boolean getIgnoreAnnotations()
- {
- return ignoreAnnotations;
- }
-
- public void setIgnoreAnnotations(boolean ignoreAnnotations)
- {
- this.ignoreAnnotations = ignoreAnnotations;
- }
-
- public String getProperty(String name)
- {
- return settings.getProperty(name);
- }
-
- public void setProperty(String name, String value)
- {
- if (name != null && value != null)
- {
- settings.setProperty(name, value);
- }
- }
-
- /**
- * Are we keeping generated code around?
- */
- public boolean getKeepGenerated()
- {
- return keepGenerated;
- }
-
- /**
- * Should white spaces between directives or actions be trimmed?
- */
- public boolean getTrimSpaces()
- {
- return trimSpaces;
- }
-
- public boolean isPoolingEnabled()
- {
- return isPoolingEnabled;
- }
-
- /**
- * Are we supporting HTML mapped servlets?
- */
- public boolean getMappedFile()
- {
- return mappedFile;
- }
-
- /**
- * Should errors be sent to client or thrown into stderr?
- */
- public boolean getSendErrorToClient()
- {
- return sendErrorToClient;
- }
-
- /**
- * Should class files be compiled with debug information?
- */
- public boolean getClassDebugInfo()
- {
- return classDebugInfo;
- }
-
- /**
- * Background JSP compile thread check intervall
- */
- public int getCheckInterval()
- {
- return checkInterval;
- }
-
- /**
- * Modification test interval.
- */
- public int getModificationTestInterval()
- {
- return modificationTestInterval;
- }
-
- /**
- * Is Jasper being used in development mode?
- */
- public boolean getDevelopment()
- {
- return development;
- }
-
- public boolean getDisplaySourceFragment()
- {
- // TODO Auto-generated method stub
- return displaySourceFragment;
- }
-
- /**
- * Is the generation of SMAP info for JSR45 debuggin suppressed?
- */
- public boolean isSmapSuppressed()
- {
- return isSmapSuppressed;
- }
-
- /**
- * Should SMAP info for JSR45 debugging be dumped to a file?
- */
- public boolean isSmapDumped()
- {
- return isSmapDumped;
- }
-
- /**
- * Are Text strings to be generated as char arrays?
- */
- public boolean genStringAsCharArray()
- {
- return this.genStringAsCharArray;
- }
-
- /**
- * Class ID for use in the plugin tag when the browser is IE.
- */
- public String getIeClassId()
- {
- return ieClassId;
- }
-
- /**
- * What is my scratch dir?
- */
- public File getScratchDir()
- {
- return scratchDir;
- }
-
- /**
- * What classpath should I use while compiling the servlets generated from
- * JSP files?
- */
- public String getClassPath()
- {
- return classpath;
- }
-
- /**
- * Is generation of X-Powered-By response header enabled/disabled?
- */
- public boolean isXpoweredBy()
- {
- return xpoweredBy;
- }
-
- /**
- * Compiler to use.
- */
- public String getCompiler()
- {
- return compiler;
- }
-
- /**
- * @see Options#getCompilerClassName
- */
- public String getCompilerClassName()
- {
- return compilerClassName;
- }
-
- /**
- * @see Options#getCompilerTargetVM
- */
- public String getCompilerTargetVM()
- {
- return compilerTargetVM;
- }
-
- /**
- * @see Options#getCompilerSourceVM
- */
- public String getCompilerSourceVM()
- {
- return compilerSourceVM;
- }
-
- public boolean getErrorOnUseBeanInvalidClassAttribute()
- {
- return errorOnUseBeanInvalidClassAttribute;
- }
-
- public void setErrorOnUseBeanInvalidClassAttribute(boolean b)
- {
- errorOnUseBeanInvalidClassAttribute = b;
- }
-
- public TldLocationsCache getTldLocationsCache()
- {
- return tldLocationsCache;
- }
-
- public void setTldLocationsCache(TldLocationsCache tldC)
- {
- tldLocationsCache = tldC;
- }
-
- public String getJavaEncoding()
- {
- return javaEncoding;
- }
-
- public boolean getFork()
- {
- return fork;
- }
-
- public JspConfig getJspConfig()
- {
- return jspConfig;
- }
-
- public TagPluginManager getTagPluginManager()
- {
- return tagPluginManager;
- }
-
- /**
- * Is caching enabled (used for precompilation).
- */
- public boolean isCaching()
- {
- return false;
- }
-
- /**
- * The web-application wide cache for the returned TreeNode
- * by parseXMLDocument in TagLibraryInfoImpl.parseTLD,
- * if isCaching returns true.
- *
- * @return the Map(String uri, TreeNode tld) instance.
- */
- public Map getCache()
- {
- return null;
- }
-
- /**
- * Create an EmbeddedServletOptions object using data available from
- * ServletConfig and ServletContext.
- */
- public JspServletOptions(ServletConfig config, ServletContext context)
- {
-
- Enumeration enumeration = config.getInitParameterNames();
- while (enumeration.hasMoreElements())
- {
- String k = (String) enumeration.nextElement();
- String v = config.getInitParameter(k);
- setProperty(k, v);
- }
-
- // quick hack
- String validating = config.getInitParameter("validating");
- if ("false".equals(validating)) ParserUtils.validating = false;
-
- String keepgen = config.getInitParameter("keepgenerated");
- if (keepgen != null)
- {
- if (keepgen.equalsIgnoreCase("true"))
- {
- this.keepGenerated = true;
- }
- else if (keepgen.equalsIgnoreCase("false"))
- {
- this.keepGenerated = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.keepgen"));
- }
- }
-
-
- String trimsp = config.getInitParameter("trimSpaces");
- if (trimsp != null)
- {
- if (trimsp.equalsIgnoreCase("true"))
- {
- trimSpaces = true;
- }
- else if (trimsp.equalsIgnoreCase("false"))
- {
- trimSpaces = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.trimspaces"));
- }
- }
-
- this.isPoolingEnabled = true;
- String poolingEnabledParam
- = config.getInitParameter("enablePooling");
- if (poolingEnabledParam != null
- && !poolingEnabledParam.equalsIgnoreCase("true"))
- {
- if (poolingEnabledParam.equalsIgnoreCase("false"))
- {
- this.isPoolingEnabled = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.enablePooling"));
- }
- }
-
- String mapFile = config.getInitParameter("mappedfile");
- if (mapFile != null)
- {
- if (mapFile.equalsIgnoreCase("true"))
- {
- this.mappedFile = true;
- }
- else if (mapFile.equalsIgnoreCase("false"))
- {
- this.mappedFile = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.mappedFile"));
- }
- }
-
- String senderr = config.getInitParameter("sendErrToClient");
- if (senderr != null)
- {
- if (senderr.equalsIgnoreCase("true"))
- {
- this.sendErrorToClient = true;
- }
- else if (senderr.equalsIgnoreCase("false"))
- {
- this.sendErrorToClient = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.sendErrToClient"));
- }
- }
-
- String debugInfo = config.getInitParameter("classdebuginfo");
- if (debugInfo != null)
- {
- if (debugInfo.equalsIgnoreCase("true"))
- {
- this.classDebugInfo = true;
- }
- else if (debugInfo.equalsIgnoreCase("false"))
- {
- this.classDebugInfo = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.classDebugInfo"));
- }
- }
-
- String checkInterval = config.getInitParameter("checkInterval");
- if (checkInterval != null)
- {
- try
- {
- this.checkInterval = Integer.parseInt(checkInterval);
- if (this.checkInterval == 0)
- {
- this.checkInterval = 300;
- log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
- }
- }
- catch (NumberFormatException ex)
- {
- log.warn(Localizer.getMessage("jsp.warning.checkInterval"));
- }
- }
-
- String modificationTestInterval = config.getInitParameter("modificationTestInterval");
- if (modificationTestInterval != null)
- {
- try
- {
- this.modificationTestInterval = Integer.parseInt(modificationTestInterval);
- }
- catch (NumberFormatException ex)
- {
- log.warn(Localizer.getMessage("jsp.warning.modificationTestInterval"));
- }
- }
-
- String development = config.getInitParameter("development");
- if (development != null)
- {
- if (development.equalsIgnoreCase("true"))
- {
- this.development = true;
- }
- else if (development.equalsIgnoreCase("false"))
- {
- this.development = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.development"));
- }
- }
-
- String displaySourceFragment = config.getInitParameter("displaySourceFragment");
- if (displaySourceFragment != null)
- {
- if (displaySourceFragment.equalsIgnoreCase("true"))
- {
- this.displaySourceFragment = true;
- }
- else if (displaySourceFragment.equalsIgnoreCase("false"))
- {
- this.displaySourceFragment = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.displaySourceFragment"));
- }
- }
-
- String suppressSmap = config.getInitParameter("suppressSmap");
- if (suppressSmap != null)
- {
- if (suppressSmap.equalsIgnoreCase("true"))
- {
- isSmapSuppressed = true;
- }
- else if (suppressSmap.equalsIgnoreCase("false"))
- {
- isSmapSuppressed = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.suppressSmap"));
- }
- }
-
- String dumpSmap = config.getInitParameter("dumpSmap");
- if (dumpSmap != null)
- {
- if (dumpSmap.equalsIgnoreCase("true"))
- {
- isSmapDumped = true;
- }
- else if (dumpSmap.equalsIgnoreCase("false"))
- {
- isSmapDumped = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.dumpSmap"));
- }
- }
-
- String genCharArray = config.getInitParameter("genStrAsCharArray");
- if (genCharArray != null)
- {
- if (genCharArray.equalsIgnoreCase("true"))
- {
- genStringAsCharArray = true;
- }
- else if (genCharArray.equalsIgnoreCase("false"))
- {
- genStringAsCharArray = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.genchararray"));
- }
- }
-
- String errBeanClass =
- config.getInitParameter("errorOnUseBeanInvalidClassAttribute");
- if (errBeanClass != null)
- {
- if (errBeanClass.equalsIgnoreCase("true"))
- {
- errorOnUseBeanInvalidClassAttribute = true;
- }
- else if (errBeanClass.equalsIgnoreCase("false"))
- {
- errorOnUseBeanInvalidClassAttribute = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.errBean"));
- }
- }
-
- String ieClassId = config.getInitParameter("ieClassId");
- if (ieClassId != null)
- this.ieClassId = ieClassId;
-
- String classpath = config.getInitParameter("classpath");
- if (classpath != null)
- this.classpath = classpath;
-
- /*
- * scratchdir
- */
- String dir = config.getInitParameter("scratchdir");
- if (dir != null)
- {
- scratchDir = new File(dir);
- }
- else
- {
- // First try the Servlet 2.2 javax.servlet.context.tempdir property
- scratchDir = (File) context.getAttribute(Constants.TMP_DIR);
- if (scratchDir == null)
- {
- // Not running in a Servlet 2.2 container.
- // Try to get the JDK 1.2 java.io.tmpdir property
- dir = System.getProperty("java.io.tmpdir");
- if (dir != null)
- scratchDir = new File(dir);
- }
- }
- if (this.scratchDir == null)
- {
- log.fatal(Localizer.getMessage("jsp.error.no.scratch.dir"));
- return;
- }
-
- if (!(scratchDir.exists() && scratchDir.canRead() &&
- scratchDir.canWrite() && scratchDir.isDirectory()))
- log.fatal(Localizer.getMessage("jsp.error.bad.scratch.dir",
- scratchDir.getAbsolutePath()));
-
- this.compiler = config.getInitParameter("compiler");
-
- String compilerTargetVM = config.getInitParameter("compilerTargetVM");
- if (compilerTargetVM != null)
- {
- this.compilerTargetVM = compilerTargetVM;
- }
-
- String compilerSourceVM = config.getInitParameter("compilerSourceVM");
- if (compilerSourceVM != null)
- {
- this.compilerSourceVM = compilerSourceVM;
- }
-
- String javaEncoding = config.getInitParameter("javaEncoding");
- if (javaEncoding != null)
- {
- this.javaEncoding = javaEncoding;
- }
-
- String compilerClassName = config.getInitParameter("compilerClassName");
- if(compilerClassName != null)
- {
- this.compilerClassName = compilerClassName;
- }
-
- String fork = config.getInitParameter("fork");
- if (fork != null)
- {
- if (fork.equalsIgnoreCase("true"))
- {
- this.fork = true;
- }
- else if (fork.equalsIgnoreCase("false"))
- {
- this.fork = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.fork"));
- }
- }
-
- String xpoweredBy = config.getInitParameter("xpoweredBy");
- if (xpoweredBy != null)
- {
- if (xpoweredBy.equalsIgnoreCase("true"))
- {
- this.xpoweredBy = true;
- }
- else if (xpoweredBy.equalsIgnoreCase("false"))
- {
- this.xpoweredBy = false;
- }
- else
- {
- log.warn(Localizer.getMessage("jsp.warning.xpoweredBy"));
- }
- }
-
- /* Setup the global Tag Libraries location cache for this web app. The
- tagLibJarN entries define the jars the cache should scan.
- */
- String base = "tagLibJar";
- ArrayList tldJars = new ArrayList();
- int count = 0;
- String jarPath = null;
- do
- {
- String name = base + count;
- jarPath = config.getInitParameter(name);
- if( (jarPath != null) && okToAddTagsFromJSFLibs(jarPath, context) )
- tldJars.add(jarPath);
- count ++;
- } while( jarPath != null );
-
- tldLocationsCache = new TagLibCache(context, tldJars);
-
- // Setup the jsp config info for this web app.
- jspConfig = new JspConfig(context);
-
- // Create a Tag plugin instance
- tagPluginManager = new TagPluginManager(context);
- }
-
- private boolean okToAddTagsFromJSFLibs(String jarPath, ServletContext context)
- {
- // if it's not coming from jsf-libs you can always add it
- if (!jarPath.startsWith("jsf-libs")) return true;
-
- return !JBossJSFConfigureListener.warBundlesJSFImpl(context);
- }
-
-}
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/TagLibCache.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/TagLibCache.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/jasper/TagLibCache.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -1,446 +0,0 @@
-/*
- * Copyright 1999,2004 The Apache Software Foundation.
- *
- * 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 org.jboss.web.tomcat.service.jasper;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import javax.servlet.ServletContext;
-
-import org.apache.jasper.Constants;
-import org.apache.jasper.JasperException;
-import org.apache.jasper.compiler.Localizer;
-import org.apache.jasper.compiler.TldLocationsCache;
-import org.apache.jasper.xmlparser.ParserUtils;
-import org.apache.jasper.xmlparser.TreeNode;
-import org.jboss.logging.Logger;
-
-/**
- * A prototype TagLibCache that allows one to obtain shared tlds from the
- * jbossweb sar conf/tlds directory.
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
-public class TagLibCache extends TldLocationsCache
-{
- private static final String WEB_XML = "/WEB-INF/web.xml";
- private static final String JAR_FILE_SUFFIX = ".jar";
-
- private static Logger log = Logger.getLogger(TagLibCache.class);
-
- private ServletContext ctx;
- private HashMap mappings;
- private ArrayList tagLibJars;
-
- public TagLibCache(ServletContext ctx, ArrayList tagLibJars)
- {
- super(ctx, true);
- this.ctx = ctx;
- this.tagLibJars = tagLibJars;
- }
-
- /**
- * Gets the 'location' of the TLD associated with the given taglib 'uri'.
- *
- * Returns null if the uri is not associated with any tag library 'exposed'
- * in the web application. A tag library is 'exposed' either explicitly in
- * web.xml or implicitly via the uri tag in the TLD of a taglib deployed in a
- * jar file (WEB-INF/lib).
- * @param uri The taglib uri
- * @return An array of two Strings: The first element denotes the real path
- * to the TLD. If the path to the TLD points to a jar file, then the
- * second element denotes the name of the TLD entry in the jar file.
- * Returns null if the uri is not associated with any tag library
- * 'exposed' in the web application.
- */
- public String[] getLocation(String uri) throws JasperException
- {
- if (mappings == null)
- init();
- String[] locations = (String[]) mappings.get(uri);
- return locations;
- }
-
- private synchronized void init() throws JasperException
- {
- if (mappings != null)
- {
- return;
- }
-
- HashMap tmpMappings = null;
- try
- {
- tmpMappings = new HashMap();
- processWebDotXml(tmpMappings);
- loadStandardTlds(tmpMappings);
- processTldsInFileSystem("/WEB-INF/", tmpMappings);
- }
- catch (Exception ex)
- {
- String msg = Localizer.getMessage("jsp.error.internal.tldinit", ex.getMessage());
- throw new JasperException(msg, ex);
- }
- finally
- {
- mappings = tmpMappings;
- }
- }
-
- /*
- * Populates taglib map described in web.xml.
- */
- protected void processWebDotXml(Map tmpMappings) throws Exception
- {
-
- InputStream is = null;
-
- try
- {
- // Acquire input stream to web application deployment descriptor
- String altDDName = (String) ctx.getAttribute(Constants.ALT_DD_ATTR);
- if (altDDName != null)
- {
- try
- {
- is = new FileInputStream(altDDName);
- }
- catch (FileNotFoundException e)
- {
- log.warn(Localizer.getMessage("jsp.error.internal.filenotfound",
- altDDName));
- }
- }
- else
- {
- is = ctx.getResourceAsStream(WEB_XML);
- if (is == null)
- {
- log.warn(Localizer.getMessage("jsp.error.internal.filenotfound",
- WEB_XML));
- }
- }
-
- if (is == null)
- {
- return;
- }
-
- // Parse the web application deployment descriptor
- TreeNode webtld = null;
- // altDDName is the absolute path of the DD
- if (altDDName != null)
- {
- webtld = new ParserUtils().parseXMLDocument(altDDName, is);
- }
- else
- {
- webtld = new ParserUtils().parseXMLDocument(WEB_XML, is);
- }
-
- // Allow taglib to be an element of the root or jsp-config (JSP2.0)
- TreeNode jspConfig = webtld.findChild("jsp-config");
- if (jspConfig != null)
- {
- webtld = jspConfig;
- }
- Iterator taglibs = webtld.findChildren("taglib");
- while (taglibs.hasNext())
- {
-
- // Parse the next <taglib> element
- TreeNode taglib = (TreeNode) taglibs.next();
- String tagUri = null;
- String tagLoc = null;
- TreeNode child = taglib.findChild("taglib-uri");
- if (child != null)
- tagUri = child.getBody();
- child = taglib.findChild("taglib-location");
- if (child != null)
- tagLoc = child.getBody();
-
- // Save this location if appropriate
- if (tagLoc == null)
- continue;
- if (uriType(tagLoc) == NOROOT_REL_URI)
- tagLoc = "/WEB-INF/" + tagLoc;
- String tagLoc2 = null;
- if (tagLoc.endsWith(JAR_FILE_SUFFIX))
- {
- tagLoc = ctx.getResource(tagLoc).toString();
- tagLoc2 = "META-INF/taglib.tld";
- }
- tmpMappings.put(tagUri, new String[]{tagLoc, tagLoc2}); // SYNC
- }
- }
- finally
- {
- if (is != null)
- {
- try
- {
- is.close();
- }
- catch (Throwable t)
- {
- }
- }
- }
- }
-
- protected void loadStandardTlds(Map tmpMappings) throws MalformedURLException // SYNC
- {
- if( tagLibJars.size() == 0 )
- return;
-
- // Locate the conf/web.xml
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- URL web = loader.getResource("server.xml");
- URL sarURL = new URL(web, ".");
- for(int n = 0; n < tagLibJars.size(); n ++)
- {
- String jarPath = (String) tagLibJars.get(n);
- try
- {
- URL url = new URL(sarURL, jarPath);
- String resourcePath = url.toString();
- log.debug("Scanning for tlds in: "+resourcePath);
- URLConnection conn = url.openConnection();
- conn.setUseCaches(false);
- scanJar(conn, resourcePath, true, tmpMappings); // SYNC
- }
- catch (Exception e)
- {
- log.debug("Failed to scan: "+jarPath, e);
- }
- }
- }
-
- /*
- * Searches the filesystem under /WEB-INF for any TLD files, and adds
- * an implicit map entry to the taglib map for any TLD that has a <uri>
- * element.
- */
- protected void processTldsInFileSystem(String startPath, Map tmpMappings) // SYNC
- throws Exception
- {
-
- Set dirList = ctx.getResourcePaths(startPath);
- if (dirList != null)
- {
- Iterator it = dirList.iterator();
- while (it.hasNext())
- {
- String path = (String) it.next();
- if (path.endsWith("/"))
- {
- processTldsInFileSystem(path, tmpMappings); // SYNC
- }
- if( path.endsWith(".jar") )
- {
- URL resURL = ctx.getResource(path);
- URLConnection conn = resURL.openConnection();
- conn.setUseCaches(false);
- this.scanJar(conn, resURL.toString(), false, tmpMappings); // SYNC
- }
- else if ( path.endsWith(".tld") == true )
- {
- InputStream stream = ctx.getResourceAsStream(path);
- String uri = null;
- try
- {
- uri = getUriFromTld(path, stream);
- }
- finally
- {
- if (stream != null)
- {
- try
- {
- stream.close();
- }
- catch (Throwable t)
- {
- // do nothing
- }
- }
- }
- // Add implicit map entry only if its uri is not already
- // present in the map
- if (uri != null && tmpMappings.get(uri) == null) // SYNC
- {
- tmpMappings.put(uri, new String[]{path, null}); // SYNC
- }
- }
- }
- }
- }
-
- /**
- * Scans the given JarInputStream for TLD files located in META-INF (or a
- * subdirectory of it), adding an implicit map entry to the taglib map for
- * any TLD that has a <uri> element.
- * @param conn - the
- * @param ignore true if any exceptions raised when processing the given JAR
- * should be ignored, false otherwise
- */
- private void scanJar(URLConnection conn, String resourcePath, boolean ignore, Map tmpMappings) // SYNC
- throws JasperException, IOException
- {
- InputStream connIS = conn.getInputStream();
- JarInputStream jis = new JarInputStream(connIS);
- try
- {
- JarEntry entry = jis.getNextJarEntry();
- while( entry != null )
- {
- String name = entry.getName();
- if( name.endsWith(".tld") == false )
- {
- entry = jis.getNextJarEntry();
- continue;
- }
-
- EntryInputStream eis = new EntryInputStream(jis);
- String uri = getUriFromTld(resourcePath, eis);
- // Add implicit map entry only if its uri is not already
- // present in the map
- if (uri != null && tmpMappings.get(uri) == null) // SYNC
- {
- tmpMappings.put(uri, new String[]{resourcePath, name}); // SYNC
- }
- entry = jis.getNextJarEntry();
- }
- }
- catch (Exception ex)
- {
- if (!ignore)
- {
- throw new JasperException(ex);
- }
- }
- finally
- {
- if( jis != null )
- {
- try
- {
- jis.close();
- }
- catch (Throwable t)
- {
- // ignore
- }
- }
-
- if (connIS != null)
- {
- try
- {
- connIS.close();
- }
- catch (Throwable t)
- {
- // ignore
- }
- }
- }
- }
-
- /*
- * Returns the value of the uri element of the given TLD, or null if the
- * given TLD does not contain any such element.
- */
- private String getUriFromTld(String resourcePath, InputStream in)
- throws JasperException
- {
- // Parse the tag library descriptor at the specified resource path
- TreeNode tld = new ParserUtils().parseXMLDocument(resourcePath, in);
- TreeNode uri = tld.findChild("uri");
- if (uri != null)
- {
- String body = uri.getBody();
- if (body != null)
- return body;
- }
-
- return null;
- }
-
- /**
- * Used to ignore the close on the jar entry input stream since this
- * closes the jar stream, not just the entry.
- */
- static class EntryInputStream extends InputStream
- {
- private JarInputStream jis;
- EntryInputStream(JarInputStream jis)
- {
- this.jis = jis;
- }
-
- public int read() throws IOException
- {
- return jis.read();
- }
-
- public int available() throws IOException
- {
- return jis.available();
- }
-
- public void close() throws IOException
- {
-
- }
-
- public void reset() throws IOException
- {
- jis.reset();
- }
-
- public boolean markSupported()
- {
- return jis.markSupported();
- }
-
- public synchronized void mark(int readlimit)
- {
- jis.mark(readlimit);
- }
-
- public long skip(long n) throws IOException
- {
- return jis.skip(n);
- }
-
- public int read(byte b[], int off, int len) throws IOException
- {
- return jis.read(b, off, len);
- }
- }
-}
Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/service/session/JBossManager.java 2009-08-31 18:26:08 UTC (rev 93046)
@@ -35,6 +35,7 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Container;
@@ -49,7 +50,6 @@
import org.apache.catalina.connector.Response;
import org.apache.catalina.core.ContainerBase;
import org.apache.catalina.util.LifecycleSupport;
-import org.apache.tomcat.util.http.TomcatCookie;
import org.apache.tomcat.util.modeler.Registry;
import org.jboss.logging.Logger;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
@@ -320,7 +320,7 @@
if (context.getCookies())
{
// set a new session cookie
- TomcatCookie cookie = new TomcatCookie(Globals.SESSION_COOKIE_NAME, sessionId);
+ Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME, sessionId);
// JBAS-6206. Configure cookie a la o.a.c.connector.Request.configureSessionCookie()
cookie.setMaxAge(-1);
if (context.getSessionCookie().getPath() != null)
Modified: trunk/tomcat/src/resources/web.xml
===================================================================
--- trunk/tomcat/src/resources/web.xml 2009-08-31 18:20:10 UTC (rev 93045)
+++ trunk/tomcat/src/resources/web.xml 2009-08-31 18:26:08 UTC (rev 93046)
@@ -170,17 +170,9 @@
<!-- to be checked on every access. -->
<!-- Used in development mode only. [4] -->
<!-- -->
- <!-- compiler Which compiler Ant should use to compile JSP -->
- <!-- pages. See the Ant documentation for more -->
- <!-- information. -->
- <!-- -->
<!-- classdebuginfo Should the class file be compiled with -->
<!-- debugging information? [true] -->
<!-- -->
- <!-- classpath What class path should I use while compiling -->
- <!-- generated servlets? [Created dynamically -->
- <!-- based on the current web application] -->
- <!-- -->
<!-- development Is Jasper used in development mode? If true, -->
<!-- the frequency at which JSPs are checked for -->
<!-- modification may be specified via the -->
@@ -189,10 +181,6 @@
<!-- enablePooling Determines whether tag handler pooling is -->
<!-- enabled [true] -->
<!-- -->
- <!-- fork Tell Ant to fork compiles of JSP pages so that -->
- <!-- a separate JVM is used for JSP page compiles -->
- <!-- from the one Tomcat is running in. [true] -->
- <!-- -->
<!-- ieClassId The class-id value to be sent to Internet -->
<!-- Explorer when using <jsp:plugin> tags. -->
<!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] -->
@@ -233,55 +221,14 @@
<!-- xpoweredBy Determines whether X-Powered-By response -->
<!-- header is added by generated servlet [false] -->
<!-- -->
- <!-- If you wish to use Jikes to compile JSP pages: -->
- <!-- Set the init parameter "compiler" to "jikes". Define -->
- <!-- the property "-Dbuild.compiler.emacs=true" when starting Tomcat -->
- <!-- by adding the above to your CATALINA_OPTS environment variable. -->
- <!-- If you get an error reporting that jikes can't use UTF8 encoding, -->
- <!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". -->
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
- <param-name>fork</param-name>
- <param-value>false</param-value>
- </init-param>
- <init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
- <!-- Use jdk1.5 features in jsp pages -->
- <init-param>
- <param-name>compilerSourceVM</param-name>
- <param-value>1.5</param-value>
- </init-param>
- <!-- Use a custom options class to allow the shared tag lib descriptors
- to be loaded from jars in the tomcat sar conf/tlds directory. The
- standard options implementation can only find taglibs based on the
- class loader classpath.
- -->
- <init-param>
- <param-name>engineOptionsClass</param-name>
- <param-value>
- org.jboss.web.tomcat.service.jasper.JspServletOptions</param-value>
- </init-param>
- <!-- Specify the jars relative to the jbossweb-tomcat6.sar that should
- be scanned for common tag lib descriptors to include in every war
- deployment.
- -->
- <init-param>
- <description>JSF standard tlds</description>
- <param-name>tagLibJar0</param-name>
- <param-value>jsf-libs/jsf-impl.jar</param-value>
- </init-param>
- <init-param>
- <description>JSTL standard tlds</description>
- <param-name>tagLibJar1</param-name>
- <param-value>jstl.jar</param-value>
- </init-param>
-
-
<load-on-startup>3</load-on-startup>
</servlet>
More information about the jboss-cvs-commits
mailing list