JBossWeb SVN: r1668 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-02-25 06:01:17 -0500 (Fri, 25 Feb 2011)
New Revision: 1668
Added:
tags/JBOSSWEB_7_0_0_BETA3/
Log:
- Beta3, drops extension validator component.
13 years, 10 months
JBossWeb SVN: r1667 - sandbox/webapps/src.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-02-23 16:05:41 -0500 (Wed, 23 Feb 2011)
New Revision: 1667
Modified:
sandbox/webapps/src/TestSnoop.java
Log:
Add port/host related stuff.
Modified: sandbox/webapps/src/TestSnoop.java
===================================================================
--- sandbox/webapps/src/TestSnoop.java 2011-02-23 11:14:40 UTC (rev 1666)
+++ sandbox/webapps/src/TestSnoop.java 2011-02-23 21:05:41 UTC (rev 1667)
@@ -99,8 +99,10 @@
out.println("<br>RequestURI: " + request.getRequestURI());
out.println("<br>RequestURL: " + request.getRequestURL());
out.println("<br>QueryString: " + request.getQueryString());
+ out.println("<br>LocalPort: " + request.getLocalPort());
+ out.println("<br>LocalAddr: " + request.getLocalAddr());
+ out.println("<br>LocalName: " + request.getLocalName());
-
}
public void doPost(HttpServletRequest request,
13 years, 10 months
JBossWeb SVN: r1666 - in trunk: java/org/apache/catalina/util and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-02-23 06:14:40 -0500 (Wed, 23 Feb 2011)
New Revision: 1666
Removed:
trunk/java/org/apache/catalina/util/Extension.java
trunk/java/org/apache/catalina/util/ExtensionValidator.java
trunk/java/org/apache/catalina/util/ManifestResource.java
Modified:
trunk/java/org/apache/catalina/core/StandardContext.java
trunk/webapps/docs/changelog.xml
Log:
- Drop extension validator, now taken over by AS.
Modified: trunk/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- trunk/java/org/apache/catalina/core/StandardContext.java 2011-02-21 10:33:59 UTC (rev 1665)
+++ trunk/java/org/apache/catalina/core/StandardContext.java 2011-02-23 11:14:40 UTC (rev 1666)
@@ -87,7 +87,6 @@
import org.apache.catalina.deploy.jsp.TagLibraryInfo;
import org.apache.catalina.session.StandardManager;
import org.apache.catalina.util.CharsetMapper;
-import org.apache.catalina.util.ExtensionValidator;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.URLEncoder;
import org.apache.naming.resources.BaseDirContext;
@@ -3703,26 +3702,10 @@
// Post work directory
postWorkDirectory();
- // Validate required extensions
- boolean dependencyCheck = true;
- try {
- dependencyCheck = ExtensionValidator.validateApplication
- (getResources(), this);
- } catch (IOException ioe) {
- log.error("Error in dependencyCheck", ioe);
- dependencyCheck = false;
- }
-
- if (!dependencyCheck) {
- // do not make application available if depency check fails
- ok = false;
- }
-
// Standard container startup
if (log.isDebugEnabled())
log.debug("Processing standard container startup");
-
// Binding thread
ClassLoader oldCCL = bindThread();
Deleted: trunk/java/org/apache/catalina/util/Extension.java
===================================================================
--- trunk/java/org/apache/catalina/util/Extension.java 2011-02-21 10:33:59 UTC (rev 1665)
+++ trunk/java/org/apache/catalina/util/Extension.java 2011-02-23 11:14:40 UTC (rev 1666)
@@ -1,304 +0,0 @@
-/*
- * 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.
- */
-
-
-package org.apache.catalina.util;
-
-
-import java.util.StringTokenizer;
-
-
-/**
- * Utility class that represents either an available "Optional Package"
- * (formerly known as "Standard Extension") as described in the manifest
- * of a JAR file, or the requirement for such an optional package. It is
- * used to support the requirements of the Servlet Specification, version
- * 2.3, related to providing shared extensions to all webapps.
- * <p>
- * In addition, static utility methods are available to scan a manifest
- * and return an array of either available or required optional modules
- * documented in that manifest.
- * <p>
- * For more information about optional packages, see the document
- * <em>Optional Package Versioning</em> in the documentation bundle for your
- * Java2 Standard Edition package, in file
- * <code>guide/extensions/versioning.html</code>.
- *
- * @author Craig McClanahan
- * @author Justyna Horwat
- * @author Greg Murray
- * @version $Revision$ $Date$
- */
-
-public final class Extension {
-
-
- // ------------------------------------------------------------- Properties
-
-
- /**
- * The name of the optional package being made available, or required.
- */
- private String extensionName = null;
-
-
- public String getExtensionName() {
- return (this.extensionName);
- }
-
- public void setExtensionName(String extensionName) {
- this.extensionName = extensionName;
- }
-
- /**
- * The URL from which the most recent version of this optional package
- * can be obtained if it is not already installed.
- */
- private String implementationURL = null;
-
- public String getImplementationURL() {
- return (this.implementationURL);
- }
-
- public void setImplementationURL(String implementationURL) {
- this.implementationURL = implementationURL;
- }
-
-
- /**
- * The name of the company or organization that produced this
- * implementation of this optional package.
- */
- private String implementationVendor = null;
-
- public String getImplementationVendor() {
- return (this.implementationVendor);
- }
-
- public void setImplementationVendor(String implementationVendor) {
- this.implementationVendor = implementationVendor;
- }
-
-
- /**
- * The unique identifier of the company that produced the optional
- * package contained in this JAR file.
- */
- private String implementationVendorId = null;
-
- public String getImplementationVendorId() {
- return (this.implementationVendorId);
- }
-
- public void setImplementationVendorId(String implementationVendorId) {
- this.implementationVendorId = implementationVendorId;
- }
-
-
- /**
- * The version number (dotted decimal notation) for this implementation
- * of the optional package.
- */
- private String implementationVersion = null;
-
- public String getImplementationVersion() {
- return (this.implementationVersion);
- }
-
- public void setImplementationVersion(String implementationVersion) {
- this.implementationVersion = implementationVersion;
- }
-
-
- /**
- * The name of the company or organization that originated the
- * specification to which this optional package conforms.
- */
- private String specificationVendor = null;
-
- public String getSpecificationVendor() {
- return (this.specificationVendor);
- }
-
- public void setSpecificationVendor(String specificationVendor) {
- this.specificationVendor = specificationVendor;
- }
-
-
- /**
- * The version number (dotted decimal notation) of the specification
- * to which this optional package conforms.
- */
- private String specificationVersion = null;
-
- public String getSpecificationVersion() {
- return (this.specificationVersion);
- }
-
- public void setSpecificationVersion(String specificationVersion) {
- this.specificationVersion = specificationVersion;
- }
-
-
- /**
- * fulfilled is true if all the required extension dependencies have been
- * satisfied
- */
- private boolean fulfilled = false;
-
- public void setFulfilled(boolean fulfilled) {
- this.fulfilled = fulfilled;
- }
-
- public boolean isFulfilled() {
- return fulfilled;
- }
-
- // --------------------------------------------------------- Public Methods
-
- /**
- * Return <code>true</code> if the specified <code>Extension</code>
- * (which represents an optional package required by this application)
- * is satisfied by this <code>Extension</code> (which represents an
- * optional package that is already installed. Otherwise, return
- * <code>false</code>.
- *
- * @param required Extension of the required optional package
- */
- public boolean isCompatibleWith(Extension required) {
-
- // Extension Name must match
- if (extensionName == null)
- return (false);
- if (!extensionName.equals(required.getExtensionName()))
- return (false);
-
- // If specified, available specification version must be >= required
- if (required.getSpecificationVersion() != null) {
- if (!isNewer(specificationVersion,
- required.getSpecificationVersion()))
- return (false);
- }
-
- // If specified, Implementation Vendor ID must match
- if (required.getImplementationVendorId() != null) {
- if (implementationVendorId == null)
- return (false);
- if (!implementationVendorId.equals(required
- .getImplementationVendorId()))
- return (false);
- }
-
- // If specified, Implementation version must be >= required
- if (required.getImplementationVersion() != null) {
- if (!isNewer(implementationVersion,
- required.getImplementationVersion()))
- return (false);
- }
-
- // This available optional package satisfies the requirements
- return (true);
-
- }
-
- /**
- * Return a String representation of this object.
- */
- public String toString() {
-
- StringBuilder sb = new StringBuilder("Extension[");
- sb.append(extensionName);
- if (implementationURL != null) {
- sb.append(", implementationURL=");
- sb.append(implementationURL);
- }
- if (implementationVendor != null) {
- sb.append(", implementationVendor=");
- sb.append(implementationVendor);
- }
- if (implementationVendorId != null) {
- sb.append(", implementationVendorId=");
- sb.append(implementationVendorId);
- }
- if (implementationVersion != null) {
- sb.append(", implementationVersion=");
- sb.append(implementationVersion);
- }
- if (specificationVendor != null) {
- sb.append(", specificationVendor=");
- sb.append(specificationVendor);
- }
- if (specificationVersion != null) {
- sb.append(", specificationVersion=");
- sb.append(specificationVersion);
- }
- sb.append("]");
- return (sb.toString());
-
- }
-
-
- // -------------------------------------------------------- Private Methods
-
-
-
- /**
- * Return <code>true</code> if the first version number is greater than
- * or equal to the second; otherwise return <code>false</code>.
- *
- * @param first First version number (dotted decimal)
- * @param second Second version number (dotted decimal)
- *
- * @exception NumberFormatException on a malformed version number
- */
- private boolean isNewer(String first, String second)
- throws NumberFormatException {
-
- if ((first == null) || (second == null))
- return (false);
- if (first.equals(second))
- return (true);
-
- StringTokenizer fTok = new StringTokenizer(first, ".", true);
- StringTokenizer sTok = new StringTokenizer(second, ".", true);
- int fVersion = 0;
- int sVersion = 0;
- while (fTok.hasMoreTokens() || sTok.hasMoreTokens()) {
- if (fTok.hasMoreTokens())
- fVersion = Integer.parseInt(fTok.nextToken());
- else
- fVersion = 0;
- if (sTok.hasMoreTokens())
- sVersion = Integer.parseInt(sTok.nextToken());
- else
- sVersion = 0;
- if (fVersion < sVersion)
- return (false);
- else if (fVersion > sVersion)
- return (true);
- if (fTok.hasMoreTokens()) // Swallow the periods
- fTok.nextToken();
- if (sTok.hasMoreTokens())
- sTok.nextToken();
- }
-
- return (true); // Exact match
-
- }
-
-
-}
Deleted: trunk/java/org/apache/catalina/util/ExtensionValidator.java
===================================================================
--- trunk/java/org/apache/catalina/util/ExtensionValidator.java 2011-02-21 10:33:59 UTC (rev 1665)
+++ trunk/java/org/apache/catalina/util/ExtensionValidator.java 2011-02-23 11:14:40 UTC (rev 1666)
@@ -1,427 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.catalina.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.NoSuchElementException;
-import java.util.StringTokenizer;
-import java.util.jar.JarInputStream;
-import java.util.jar.Manifest;
-
-import javax.naming.Binding;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-
-import org.apache.catalina.core.StandardContext;
-import org.apache.naming.resources.Resource;
-
-
-/**
- * Ensures that all extension dependies are resolved for a WEB application
- * are met. This class builds a master list of extensions available to an
- * applicaiton and then validates those extensions.
- *
- * See http://java.sun.com/j2se/1.4/docs/guide/extensions/spec.html for
- * a detailed explanation of the extension mechanism in Java.
- *
- * @author Greg Murray
- * @author Justyna Horwat
- * @version $Revision$ $Date$
- *
- */
-public final class ExtensionValidator {
-
- private static org.jboss.logging.Logger log=
- org.jboss.logging.Logger.getLogger(ExtensionValidator.class);
-
- /**
- * The string resources for this package.
- */
- private static StringManager sm =
- StringManager.getManager("org.apache.catalina.util");
-
- private static ArrayList containerAvailableExtensions = null;
- private static ArrayList containerManifestResources = new ArrayList();
-
-
- // ----------------------------------------------------- Static Initializer
-
-
- /**
- * This static initializer loads the container level extensions that are
- * available to all web applications. This method scans all extension
- * directories available via the "java.ext.dirs" System property.
- *
- * The System Class-Path is also scanned for jar files that may contain
- * available extensions.
- */
- static {
-
- // check for container level optional packages
- String systemClasspath = System.getProperty("java.class.path");
-
- StringTokenizer strTok = new StringTokenizer(systemClasspath,
- File.pathSeparator);
-
- // build a list of jar files in the classpath
- while (strTok.hasMoreTokens()) {
- String classpathItem = strTok.nextToken();
- if (classpathItem.toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
- File item = new File(classpathItem);
- if (item.exists()) {
- try {
- addSystemResource(item);
- } catch (IOException e) {
- log.error(sm.getString
- ("extensionValidator.failload", item), e);
- }
- }
- }
- }
-
- // add specified folders to the list
- addFolderList("java.ext.dirs");
- addFolderList("catalina.ext.dirs");
-
- }
-
-
- // --------------------------------------------------------- Public Methods
-
-
- /**
- * Runtime validation of a Web Applicaiton.
- *
- * This method uses JNDI to look up the resources located under a
- * <code>DirContext</code>. It locates Web Application MANIFEST.MF
- * file in the /META-INF/ directory of the application and all
- * MANIFEST.MF files in each JAR file located in the WEB-INF/lib
- * directory and creates an <code>ArrayList</code> of
- * <code>ManifestResorce<code> objects. These objects are then passed
- * to the validateManifestResources method for validation.
- *
- * @param dirContext The JNDI root of the Web Application
- * @param context The context from which the Logger and path to the
- * application
- *
- * @return true if all required extensions satisfied
- */
- public static synchronized boolean validateApplication(
- DirContext dirContext,
- StandardContext context)
- throws IOException {
-
- String appName = context.getPath();
- ArrayList appManifestResources = new ArrayList();
- // If the application context is null it does not exist and
- // therefore is not valid
- if (dirContext == null) return false;
- // Find the Manifest for the Web Applicaiton
- InputStream inputStream = null;
- try {
- NamingEnumeration wne = dirContext.listBindings("/META-INF/");
- Binding binding = (Binding) wne.nextElement();
- if (binding.getName().toUpperCase(Locale.ENGLISH).equals("MANIFEST.MF")) {
- Resource resource = (Resource)dirContext.lookup
- ("/META-INF/" + binding.getName());
- inputStream = resource.streamContent();
- Manifest manifest = new Manifest(inputStream);
- inputStream.close();
- inputStream = null;
- ManifestResource mre = new ManifestResource
- (sm.getString("extensionValidator.web-application-manifest"),
- manifest, ManifestResource.WAR);
- appManifestResources.add(mre);
- }
- } catch (NamingException nex) {
- // Application does not contain a MANIFEST.MF file
- } catch (NoSuchElementException nse) {
- // Application does not contain a MANIFEST.MF file
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (Throwable t) {
- // Ignore
- }
- }
- }
-
- // Locate the Manifests for all bundled JARs
- NamingEnumeration ne = null;
- try {
- if (dirContext != null) {
- ne = dirContext.listBindings("WEB-INF/lib/");
- }
- while ((ne != null) && ne.hasMoreElements()) {
- Binding binding = (Binding)ne.nextElement();
- if (!binding.getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
- continue;
- }
- Object resourceObject = dirContext.lookup("/WEB-INF/lib/" + binding.getName());
- if (resourceObject instanceof Resource) {
- Resource resource = (Resource) resourceObject;
- Manifest jmanifest = getManifest(resource.streamContent());
- if (jmanifest != null) {
- ManifestResource mre = new ManifestResource(
- binding.getName(),
- jmanifest,
- ManifestResource.APPLICATION);
- appManifestResources.add(mre);
- }
- }
- }
- } catch (NamingException nex) {
- // Jump out of the check for this application because it
- // has no resources
- }
-
- return validateManifestResources(appName, appManifestResources);
- }
-
-
- /**
- * Checks to see if the given system JAR file contains a MANIFEST, and adds
- * it to the container's manifest resources.
- *
- * @param jarFile The system JAR whose manifest to add
- */
- public static void addSystemResource(File jarFile) throws IOException {
- Manifest manifest = getManifest(new FileInputStream(jarFile));
- if (manifest != null) {
- ManifestResource mre
- = new ManifestResource(jarFile.getAbsolutePath(),
- manifest,
- ManifestResource.SYSTEM);
- containerManifestResources.add(mre);
- }
- }
-
-
- // -------------------------------------------------------- Private Methods
-
-
- /**
- * Validates a <code>ArrayList</code> of <code>ManifestResource</code>
- * objects. This method requires an application name (which is the
- * context root of the application at runtime).
- *
- * <code>false</false> is returned if the extension dependencies
- * represented by any given <code>ManifestResource</code> objects
- * is not met.
- *
- * This method should also provide static validation of a Web Applicaiton
- * if provided with the necessary parameters.
- *
- * @param appName The name of the Application that will appear in the
- * error messages
- * @param resources A list of <code>ManifestResource</code> objects
- * to be validated.
- *
- * @return true if manifest resource file requirements are met
- */
- private static boolean validateManifestResources(String appName,
- ArrayList resources) {
- boolean passes = true;
- int failureCount = 0;
- ArrayList availableExtensions = null;
-
- Iterator it = resources.iterator();
- while (it.hasNext()) {
- ManifestResource mre = (ManifestResource)it.next();
- ArrayList requiredList = mre.getRequiredExtensions();
- if (requiredList == null) {
- continue;
- }
-
- // build the list of available extensions if necessary
- if (availableExtensions == null) {
- availableExtensions = buildAvailableExtensionsList(resources);
- }
-
- // load the container level resource map if it has not been built
- // yet
- if (containerAvailableExtensions == null) {
- containerAvailableExtensions
- = buildAvailableExtensionsList(containerManifestResources);
- }
-
- // iterate through the list of required extensions
- Iterator rit = requiredList.iterator();
- while (rit.hasNext()) {
- boolean found = false;
- Extension requiredExt = (Extension)rit.next();
- // check the applicaion itself for the extension
- if (availableExtensions != null) {
- Iterator ait = availableExtensions.iterator();
- while (ait.hasNext()) {
- Extension targetExt = (Extension) ait.next();
- if (targetExt.isCompatibleWith(requiredExt)) {
- requiredExt.setFulfilled(true);
- found = true;
- break;
- }
- }
- }
- // check the container level list for the extension
- if (!found && containerAvailableExtensions != null) {
- Iterator cit = containerAvailableExtensions.iterator();
- while (cit.hasNext()) {
- Extension targetExt = (Extension) cit.next();
- if (targetExt.isCompatibleWith(requiredExt)) {
- requiredExt.setFulfilled(true);
- found = true;
- break;
- }
- }
- }
- if (!found) {
- // Failure
- log.info(sm.getString(
- "extensionValidator.extension-not-found-error",
- appName, mre.getResourceName(),
- requiredExt.getExtensionName()));
- passes = false;
- failureCount++;
- }
- }
- }
-
- if (!passes) {
- log.info(sm.getString(
- "extensionValidator.extension-validation-error", appName,
- failureCount + ""));
- }
-
- return passes;
- }
-
- /*
- * Build this list of available extensions so that we do not have to
- * re-build this list every time we iterate through the list of required
- * extensions. All available extensions in all of the
- * <code>MainfestResource</code> objects will be added to a
- * <code>HashMap</code> which is returned on the first dependency list
- * processing pass.
- *
- * The key is the name + implementation version.
- *
- * NOTE: A list is built only if there is a dependency that needs
- * to be checked (performance optimization).
- *
- * @param resources A list of <code>ManifestResource</code> objects
- *
- * @return HashMap Map of available extensions
- */
- private static ArrayList buildAvailableExtensionsList(ArrayList resources) {
-
- ArrayList availableList = null;
-
- Iterator it = resources.iterator();
- while (it.hasNext()) {
- ManifestResource mre = (ManifestResource)it.next();
- ArrayList list = mre.getAvailableExtensions();
- if (list != null) {
- Iterator values = list.iterator();
- while (values.hasNext()) {
- Extension ext = (Extension) values.next();
- if (availableList == null) {
- availableList = new ArrayList();
- availableList.add(ext);
- } else {
- availableList.add(ext);
- }
- }
- }
- }
-
- return availableList;
- }
-
- /**
- * Return the Manifest from a jar file or war file
- *
- * @param inStream Input stream to a WAR or JAR file
- * @return The WAR's or JAR's manifest
- */
- private static Manifest getManifest(InputStream inStream)
- throws IOException {
-
- Manifest manifest = null;
- JarInputStream jin = null;
-
- try {
- jin = new JarInputStream(inStream);
- manifest = jin.getManifest();
- jin.close();
- jin = null;
- } finally {
- if (jin != null) {
- try {
- jin.close();
- } catch (Throwable t) {
- // Ignore
- }
- }
- }
-
- return manifest;
- }
-
-
- /**
- * Add the JARs specified to the extension list.
- */
- private static void addFolderList(String property) {
-
- // get the files in the extensions directory
- String extensionsDir = System.getProperty(property);
- if (extensionsDir != null) {
- StringTokenizer extensionsTok
- = new StringTokenizer(extensionsDir, File.pathSeparator);
- while (extensionsTok.hasMoreTokens()) {
- File targetDir = new File(extensionsTok.nextToken());
- if (!targetDir.exists() || !targetDir.isDirectory()) {
- continue;
- }
- File[] files = targetDir.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].getName().toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
- try {
- addSystemResource(files[i]);
- } catch (IOException e) {
- log.error
- (sm.getString
- ("extensionValidator.failload", files[i]), e);
- }
- }
- }
- }
- }
-
- }
-
-
-}
Deleted: trunk/java/org/apache/catalina/util/ManifestResource.java
===================================================================
--- trunk/java/org/apache/catalina/util/ManifestResource.java 2011-02-21 10:33:59 UTC (rev 1665)
+++ trunk/java/org/apache/catalina/util/ManifestResource.java 2011-02-23 11:14:40 UTC (rev 1666)
@@ -1,242 +0,0 @@
-/*
- * 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.
- */
-package org.apache.catalina.util;
-
-import java.util.Iterator;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes;
-import java.util.ArrayList;
-
-/**
- * Representation of a Manifest file and its available extensions and
- * required extensions
- *
- * @author Greg Murray
- * @author Justyna Horwat
- * @version $Revision$ $Date$
- *
- */
-public class ManifestResource {
-
- // ------------------------------------------------------------- Properties
-
- // These are the resource types for determining effect error messages
- public static final int SYSTEM = 1;
- public static final int WAR = 2;
- public static final int APPLICATION = 3;
-
- private ArrayList availableExtensions = null;
- private ArrayList requiredExtensions = null;
-
- private String resourceName = null;
- private int resourceType = -1;
-
- public ManifestResource(String resourceName, Manifest manifest,
- int resourceType) {
- this.resourceName = resourceName;
- this.resourceType = resourceType;
- processManifest(manifest);
- }
-
- /**
- * Gets the name of the resource
- *
- * @return The name of the resource
- */
- public String getResourceName() {
- return resourceName;
- }
-
- /**
- * Gets the list of available extensions
- *
- * @return List of available extensions
- */
- public ArrayList getAvailableExtensions() {
- return availableExtensions;
- }
-
- /**
- * Gets the list of required extensions
- *
- * @return List of required extensions
- */
- public ArrayList getRequiredExtensions() {
- return requiredExtensions;
- }
-
- // --------------------------------------------------------- Public Methods
-
- /**
- * Gets the number of available extensions
- *
- * @return The number of available extensions
- */
- public int getAvailableExtensionCount() {
- return (availableExtensions != null) ? availableExtensions.size() : 0;
- }
-
- /**
- * Gets the number of required extensions
- *
- * @return The number of required extensions
- */
- public int getRequiredExtensionCount() {
- return (requiredExtensions != null) ? requiredExtensions.size() : 0;
- }
-
- /**
- * Convienience method to check if this <code>ManifestResource</code>
- * has an requires extensions.
- *
- * @return true if required extensions are present
- */
- public boolean requiresExtensions() {
- return (requiredExtensions != null) ? true : false;
- }
-
- /**
- * Returns <code>true</code> if all required extension dependencies
- * have been meet for this <code>ManifestResource</code> object.
- *
- * @return boolean true if all extension dependencies have been satisfied
- */
- public boolean isFulfilled() {
- if (requiredExtensions == null) {
- return true;
- }
- Iterator it = requiredExtensions.iterator();
- while (it.hasNext()) {
- Extension ext = (Extension)it.next();
- if (!ext.isFulfilled()) return false;
- }
- return true;
- }
-
- public String toString() {
-
- StringBuilder sb = new StringBuilder("ManifestResource[");
- sb.append(resourceName);
-
- sb.append(", isFulfilled=");
- sb.append(isFulfilled() +"");
- sb.append(", requiredExtensionCount =");
- sb.append(getRequiredExtensionCount());
- sb.append(", availableExtensionCount=");
- sb.append(getAvailableExtensionCount());
- switch (resourceType) {
- case SYSTEM : sb.append(", resourceType=SYSTEM"); break;
- case WAR : sb.append(", resourceType=WAR"); break;
- case APPLICATION : sb.append(", resourceType=APPLICATION"); break;
- }
- sb.append("]");
- return (sb.toString());
- }
-
-
- // -------------------------------------------------------- Private Methods
-
- private void processManifest(Manifest manifest) {
- availableExtensions = getAvailableExtensions(manifest);
- requiredExtensions = getRequiredExtensions(manifest);
- }
-
- /**
- * Return the set of <code>Extension</code> objects representing optional
- * packages that are required by the application associated with the
- * specified <code>Manifest</code>.
- *
- * @param manifest Manifest to be parsed
- *
- * @return List of required extensions, or null if the application
- * does not require any extensions
- */
- private ArrayList getRequiredExtensions(Manifest manifest) {
-
- Attributes attributes = manifest.getMainAttributes();
- String names = attributes.getValue("Extension-List");
- if (names == null)
- return null;
-
- ArrayList extensionList = new ArrayList();
- names += " ";
-
- while (true) {
-
- int space = names.indexOf(' ');
- if (space < 0)
- break;
- String name = names.substring(0, space).trim();
- names = names.substring(space + 1);
-
- String value =
- attributes.getValue(name + "-Extension-Name");
- if (value == null)
- continue;
- Extension extension = new Extension();
- extension.setExtensionName(value);
- extension.setImplementationURL
- (attributes.getValue(name + "-Implementation-URL"));
- extension.setImplementationVendorId
- (attributes.getValue(name + "-Implementation-Vendor-Id"));
- String version = attributes.getValue(name + "-Implementation-Version");
- extension.setImplementationVersion(version);
- extension.setSpecificationVersion
- (attributes.getValue(name + "-Specification-Version"));
- extensionList.add(extension);
- }
- return extensionList;
- }
-
- /**
- * Return the set of <code>Extension</code> objects representing optional
- * packages that are bundled with the application associated with the
- * specified <code>Manifest</code>.
- *
- * @param manifest Manifest to be parsed
- *
- * @return List of available extensions, or null if the web application
- * does not bundle any extensions
- */
- private ArrayList getAvailableExtensions(Manifest manifest) {
-
- Attributes attributes = manifest.getMainAttributes();
- String name = attributes.getValue("Extension-Name");
- if (name == null)
- return null;
-
- ArrayList extensionList = new ArrayList();
-
- Extension extension = new Extension();
- extension.setExtensionName(name);
- extension.setImplementationURL(
- attributes.getValue("Implementation-URL"));
- extension.setImplementationVendor(
- attributes.getValue("Implementation-Vendor"));
- extension.setImplementationVendorId(
- attributes.getValue("Implementation-Vendor-Id"));
- extension.setImplementationVersion(
- attributes.getValue("Implementation-Version"));
- extension.setSpecificationVersion(
- attributes.getValue("Specification-Version"));
-
- extensionList.add(extension);
-
- return extensionList;
- }
-
-}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-02-21 10:33:59 UTC (rev 1665)
+++ trunk/webapps/docs/changelog.xml 2011-02-23 11:14:40 UTC (rev 1666)
@@ -16,6 +16,16 @@
<body>
+<section name="JBoss Web 7.0.0.Beta3 (remm)">
+ <subsection name="Catalina">
+ <changelog>
+ <update>
+ Drop extension validator, now taken over in the embedding application server. (markt)
+ </update>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 7.0.0.Beta2 (remm)">
<subsection name="General">
<changelog>
13 years, 10 months
JBossWeb SVN: r1665 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-02-21 05:33:59 -0500 (Mon, 21 Feb 2011)
New Revision: 1665
Added:
tags/JBOSSWEB_7_0_0_BETA2/
Log:
- Web beta 2.
13 years, 10 months
JBossWeb SVN: r1664 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-02-18 12:06:25 -0500 (Fri, 18 Feb 2011)
New Revision: 1664
Modified:
trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
trunk/java/org/apache/coyote/ajp/AjpProcessor.java
trunk/webapps/docs/changelog.xml
Log:
- 50189: AJP corruption fix when reading IS after closing OS.
Modified: trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2011-02-15 17:42:04 UTC (rev 1663)
+++ trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2011-02-18 17:06:25 UTC (rev 1664)
@@ -1214,6 +1214,9 @@
if (endOfStream) {
return false;
}
+ if (finished) {
+ return false;
+ }
// Request more data immediately
Socket.sendb(socket, getBodyMessageBuffer, 0,
Modified: trunk/java/org/apache/coyote/ajp/AjpProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2011-02-15 17:42:04 UTC (rev 1663)
+++ trunk/java/org/apache/coyote/ajp/AjpProcessor.java 2011-02-18 17:06:25 UTC (rev 1664)
@@ -1181,6 +1181,9 @@
if (endOfStream) {
return false;
}
+ if (finished) {
+ return false;
+ }
// Request more data immediately
output.write(getBodyMessageArray);
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-02-15 17:42:04 UTC (rev 1663)
+++ trunk/webapps/docs/changelog.xml 2011-02-18 17:06:25 UTC (rev 1664)
@@ -43,6 +43,10 @@
<fix>
<bug>47319</bug>: Fix getRemoteHost() with APR when name cannot be resolved. (markt)
</fix>
+ <fix>
+ <bug>50189</bug>: Fix AJP protocol corruption if a webapp reads from the request after closing
+ the response. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">
13 years, 10 months
JBossWeb SVN: r1663 - in trunk: webapps/docs and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-02-15 12:42:04 -0500 (Tue, 15 Feb 2011)
New Revision: 1663
Modified:
trunk/build.properties.default
trunk/webapps/docs/changelog.xml
Log:
- Update to the JDT 3.7 branch.
Modified: trunk/build.properties.default
===================================================================
--- trunk/build.properties.default 2011-02-15 13:02:07 UTC (rev 1662)
+++ trunk/build.properties.default 2011-02-15 17:42:04 UTC (rev 1663)
@@ -33,10 +33,10 @@
base-sf.loc=http://downloads.sourceforge.net
# ----- Eclipse JDT, version 3.2 or later -----
-jdt.home=${base.path}/eclipse/plugins
+jdt.home=${base.path}/plugins
jdt.lib=${jdt.home}
-jdt.jar=${jdt.lib}/org.eclipse.jdt.core_3.5.2.v_981_R35x.jar
-jdt.loc=http://download.eclipse.org/eclipse/downloads/drops/R-3.5.2-201002111343/eclipse-JDT-3.5.2.zip
+jdt.jar=${jdt.lib}/org.eclipse.jdt.core_3.7.0.v_B35.jar
+jdt.loc=http://download.eclipse.org/eclipse/downloads/drops/S-3.7M5-201101272034/org.eclipse.jdt-3.7M5.zip
# ----- Dojo Toolkit (for test webapp) -----
dojo-js.home=${base.path}/dojo-release-1.4.3
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-02-15 13:02:07 UTC (rev 1662)
+++ trunk/webapps/docs/changelog.xml 2011-02-15 17:42:04 UTC (rev 1663)
@@ -17,6 +17,13 @@
<body>
<section name="JBoss Web 7.0.0.Beta2 (remm)">
+ <subsection name="General">
+ <changelog>
+ <fix>
+ Update to the JDT 3.7 branch. (remm)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Catalina">
<changelog>
<fix>
@@ -127,7 +134,7 @@
</section>
<section name="JBoss Web 3.0.0.Beta7 (remm)">
- <subsection name="Genral">
+ <subsection name="General">
<changelog>
<fix>
Use a more standard fileupload and update to 1.2. (markt)
13 years, 10 months
JBossWeb SVN: r1662 - in sandbox/ajp: src/main/java/org/apache/protocol/ajp and 1 other directory.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-02-15 08:02:07 -0500 (Tue, 15 Feb 2011)
New Revision: 1662
Added:
sandbox/ajp/src/main/java/org/apache/protocol/ajp/Serv.java
Removed:
sandbox/ajp/build.xml
Modified:
sandbox/ajp/src/main/java/org/apache/protocol/ajp/SendBodyChunkMessage.java
Log:
Add a test corresponding to a commun error message.
Deleted: sandbox/ajp/build.xml
===================================================================
--- sandbox/ajp/build.xml 2011-02-14 14:03:48 UTC (rev 1661)
+++ sandbox/ajp/build.xml 2011-02-15 13:02:07 UTC (rev 1662)
@@ -1,294 +0,0 @@
-<?xml version="1.0"?>
-<!-- Build file for Apache AJP Protocol -->
-<project name="Apache AJP Protocol" default="compile" basedir=".">
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it
- -->
- <property file="${user.home}/.ant.properties" />
- <property file="${user.home}/build.properties" />
- <property file="build.properties" />
- <property file=".ant.properties" />
-
- <!-- Initialization properties -->
- <property name="name" value="Apache AJP Protocol"/>
- <property name="title" value="Apache AJP Protocol Library"/>
- <property name="version" value="1.4.0"/>
- <property name="version.number" value="140"/>
- <property name="project" value="ajp"/>
- <property name="build.dir" value="./dist"/>
- <property name="build.src" value="${build.dir}/src"/>
- <property name="build.dest" value="${build.dir}/bin"/>
- <property name="src.dir" value="."/>
- <property name="final.name" value="${project}-${version}"/>
- <property name="dist.root" value="./dist"/>
- <property name="ant.home" value="."/>
-
- <property name="debug" value="off"/>
- <property name="optimize" value="on"/>
- <property name="deprecation" value="on"/>
- <property name="compile.source" value="1.4"/>
-
- <property name="docs.src" value="./xdocs"/>
- <property name="docs.dest" value="${dist.root}/doc"/>
- <property name="docs.dest.print" value="${dist.root}/doc/printable"/>
- <property name="test.runner" value="junit.textui.TestRunner"/>
- <property name="test.dir" value="${build.dest}/test"/>
- <property name="examples.dir" value="${build.dest}/examples"/>
- <property name="junit.home" value="/usr/local/junit3.8"/>
- <property name="junit.jar" value="${junit.home}/junit.jar"/>
-
- <!-- The base directory for component sources -->
- <property name="source.home" value="classes"/>
-
- <!-- Build classpath -->
- <path id="classpath">
- <pathelement location="${build.dest}/classes"/>
- </path>
-
- <!-- Test classpath -->
- <path id="test.classpath">
- <pathelement location="${build.dest}/classes"/>
- <pathelement location="${build.dest}/test"/>
- <pathelement location="${junit.jar}"/>
- </path>
-
- <!-- Examples classpath -->
- <path id="examples.classpath">
- <pathelement location="${build.dest}/classes"/>
- <pathelement location="${build.dest}/examples"/>
- </path>
-
- <!-- =================================================================== -->
- <!-- prints the environment -->
- <!-- =================================================================== -->
- <target name="env">
- <echo message="java.home = ${java.home}"/>
- <echo message="user.home = ${user.home}"/>
- <!--
- <echo message="java.class.path = ${java.class.path}"/>
- -->
- <echo message=""/>
- </target>
-
- <target name="prepare" depends="env">
- <mkdir dir="${build.dir}"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- Creates the API documentation -->
- <!-- =================================================================== -->
- <target name="javadocs" description="Java documentation">
- <mkdir dir="${docs.dest}"/>
- <mkdir dir="${docs.dest}/api"/>
- <javadoc sourcepath="${build.src}/classes"
- destdir="${docs.dest}/api"
- author="true"
- version="true"
- overview="${src.dir}/classes/overview.html"
- packagenames="org.apache.protocol.ajp.*"
- windowtitle="${title} (Version ${version})"
- doctitle="<h2>${title}</h2>"
- bottom="Copyright © 2000-2006 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.-->">
- <classpath refid="classpath"/>
- </javadoc>
- </target>
-
- <!-- =================================================================== -->
- <!-- Cleans up the build directory -->
- <!-- =================================================================== -->
- <target name="clean">
- <delete dir="${build.dir}"/>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles the source directory -->
- <!-- =================================================================== -->
- <target name="compile" depends="prepare">
- <mkdir dir="${build.dest}"/>
- <mkdir dir="${build.dest}/classes"/>
- <mkdir dir="${build.src}"/>
- <mkdir dir="${build.src}/classes"/>
- <tstamp>
- <format property="TODAY" pattern="MMM d yyyy" locale="en"/>
- <format property="TSTAMP" pattern="hh:mm:ss"/>
- </tstamp>
- <!-- Copy static resource files -->
- <filter token="VERSION" value="${version}"/>
- <filter token="VERSION_NUMBER" value="${version.number}"/>
- <filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
- <copy todir="${build.src}/classes" filtering="yes">
- <fileset dir="${src.dir}/classes">
- <include name="**/*.java"/>
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
-
- <javac srcdir="${build.src}/classes"
- destdir="${build.dest}/classes"
- debug="${debug}"
- deprecation="${deprecation}"
- failonerror="false"
- source="${compile.source}"
- optimize="${optimize}">
- <classpath refid="classpath"/>
- <compilerarg line="-Xmaxerrs 1000"/>
- </javac>
- <copy todir="${build.dest}/classes" filtering="yes">
- <fileset dir="${build.src}/classes">
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- </target>
-
- <target name="compile-only"
- description="Compile shareable components">
-
- <javac srcdir="${source.home}"
- destdir="${build.home}/classes"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- source="${compile.source}"
- optimize="${compile.optimize}">
- <classpath refid="classpath"/>
- </javac>
- <copy todir="${build.home}/classes" filtering="on">
- <fileset dir="${source.home}" excludes="**/*.java"/>
- </copy>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles the examples directory -->
- <!-- =================================================================== -->
- <target name="examples" depends="compile">
- <mkdir dir="${build.dest}"/>
- <mkdir dir="${build.dest}/examples"/>
- <mkdir dir="${build.src}"/>
- <mkdir dir="${build.src}/examples"/>
- <tstamp>
- <format property="TODAY" pattern="MMM d yyyy" locale="en"/>
- <format property="TSTAMP" pattern="hh:mm:ss"/>
- </tstamp>
- <!-- Copy static resource files -->
- <filter token="VERSION" value="${version}"/>
- <filter token="VERSION_NUMBER" value="${version.number}"/>
- <filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
- <copy todir="${build.src}/examples" filtering="yes">
- <fileset dir="${src.dir}/examples">
- <include name="**/*.java"/>
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
-
- <javac srcdir="${build.src}/examples"
- destdir="${build.dest}/examples"
- debug="${debug}"
- deprecation="${deprecation}"
- source="${compile.source}"
- optimize="${optimize}">
- <classpath refid="examples.classpath"/>
- </javac>
- <copy todir="${build.dest}/examples" filtering="yes">
- <fileset dir="${build.src}/examples">
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- </target>
-
- <!-- ================================================================== -->
- <!-- Make AJP jar -->
- <!-- ================================================================== -->
- <target name="jar" depends="compile"
- description="Generates the Jar file">
- <jar
- destfile="${build.dir}/${final.name}.jar"
- basedir="${build.dir}/bin/classes"
- excludes="**/*.java">
- <manifest>
- <section name="org/apache/protocol/ajp">
- <attribute name="Specification-Title" value="Apache AJP Protocol"/>
- <attribute name="Specification-Version" value="${version}"/>
- <attribute name="Specification-Vendor" value="Apache Software Foundation"/>
- <attribute name="Implementation-Title" value="org.apache.protocol.ajp"/>
- <attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
- <attribute name="Implementation-Vendor-Id" value="org.apache"/>
- <attribute name="Implementation-Version" value="${version} (build ${DSTAMP} ${TSTAMP})"/>
- </section>
- </manifest>
- </jar>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles the test directory -->
- <!-- =================================================================== -->
- <target name="compile-tests" depends="compile">
- <mkdir dir="${build.dest}/test"/>
- <mkdir dir="${build.src}/test"/>
- <copy todir="${build.src}/test" filtering="yes">
- <fileset dir="${src.dir}/test">
- <include name="**/*.java"/>
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- <javac srcdir="${build.src}/test"
- destdir="${build.dest}/test"
- debug="${debug}"
- deprecation="${deprecation}"
- source="${compile.source}"
- optimize="${optimize}">
-
- <classpath refid="test.classpath"/>
- </javac>
- </target>
-
- <!-- =================================================================== -->
- <!-- Junit tests -->
- <!-- =================================================================== -->
- <target name="test.file" depends="compile-tests">
- <echo message="Running Tomcat Native package tests ..."/>
- <java dir="${test.dir}" classname="${test.runner}" fork="yes" failonerror="${test.failonerror}">
- <arg value="org.jboss.clr.ObjectTestSuite"/>
- <classpath refid="test.classpath"/>
- </java>
- </target>
-
- <!-- =================================================================== -->
- <!-- Compiles the examples directory -->
- <!-- =================================================================== -->
- <target name="compile-examples" depends="compile">
- <mkdir dir="${build.dest}/examples"/>
- <mkdir dir="${build.src}/examples"/>
- <copy todir="${build.src}/examples" filtering="yes">
- <fileset dir="${src.dir}/examples">
- <include name="**/*.java"/>
- <include name="**/*.xml"/>
- <include name="**/*.properties"/>
- </fileset>
- </copy>
- <javac srcdir="${build.src}/examples"
- destdir="${build.dest}/examples"
- debug="${debug}"
- deprecation="${deprecation}"
- source="${compile.source}"
- optimize="${optimize}">
-
- <classpath refid="examples.classpath"/>
- </javac>
- </target>
-</project>
Modified: sandbox/ajp/src/main/java/org/apache/protocol/ajp/SendBodyChunkMessage.java
===================================================================
--- sandbox/ajp/src/main/java/org/apache/protocol/ajp/SendBodyChunkMessage.java 2011-02-14 14:03:48 UTC (rev 1661)
+++ sandbox/ajp/src/main/java/org/apache/protocol/ajp/SendBodyChunkMessage.java 2011-02-15 13:02:07 UTC (rev 1662)
@@ -31,6 +31,7 @@
size = data.length;
pos = len = Ajp.HEADER_LENGTH;
Encode.W(buf, 0, dir);
+ Encode.W(buf, 2, size-4);
buf[4] = Ajp.SEND_BODY_CHUNK;
}
Added: sandbox/ajp/src/main/java/org/apache/protocol/ajp/Serv.java
===================================================================
--- sandbox/ajp/src/main/java/org/apache/protocol/ajp/Serv.java (rev 0)
+++ sandbox/ajp/src/main/java/org/apache/protocol/ajp/Serv.java 2011-02-15 13:02:07 UTC (rev 1662)
@@ -0,0 +1,74 @@
+/* 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.
+ */
+
+package org.apache.protocol.ajp;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/*
+ * Allow to test AJP of mod_jk/mod_proxy_ajp.
+ */
+class Serv {
+ public static void main(String[] argv) {
+ ServerSocket serverSocket = null;
+ try {
+ serverSocket = new ServerSocket(8009);
+ } catch (IOException e1) {
+ System.out.println("ServerSocket failed: " + e1);
+ System.exit(-1);
+ }
+ Socket clientSocket = null;
+
+ try {
+ clientSocket = serverSocket.accept();
+ } catch (IOException e) {
+ System.out.println("Accept failed");
+ System.exit(-1);
+ }
+ AjpMessageReader ajp = null;
+ try {
+ ajp = new AjpMessageReader(clientSocket.getInputStream());
+ } catch (IOException e) {
+ System.out.println("AjpMessageReader failed");
+ System.exit(-1);
+ } catch (Exception e) {
+ System.out.println("AjpMessageReader failed " + e);
+ System.exit(-1);
+ }
+ System.out.println(ajp.dump());
+ /* Normal behaviour
+ if (ajp.getByte() == Ajp.CPING_REQUEST) {
+ CpongMessage msg = new CpongMessage();
+ try {
+ clientSocket.getOutputStream().write(msg.buf, 0, msg.len);
+ } catch (IOException e) {
+ System.out.println("write failed: " + e);
+ }
+ }
+ */
+ if (ajp.getByte() == Ajp.CPING_REQUEST) {
+ SendBodyChunkMessage msg = new SendBodyChunkMessage("12345BAD ME!!!".getBytes());
+ try {
+ clientSocket.getOutputStream().write(msg.buf, 0, msg.size);
+ System.out.println("sending: " + msg.len);
+ } catch (IOException e) {
+ System.out.println("write failed: " + e);
+ }
+ }
+ }
+}
13 years, 10 months
JBossWeb SVN: r1661 - sandbox/ajp.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-02-14 09:03:48 -0500 (Mon, 14 Feb 2011)
New Revision: 1661
Removed:
sandbox/ajp/classes/
Log:
unused.
13 years, 10 months