You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by David Jencks <da...@yahoo.com> on 2010/01/13 18:17:47 UTC
Re: svn commit: r898698 - in /incubator/aries/trunk: application/application-converters/ application/application-converters/src/main/java/org/apache/aries/application/converters/ application/application-converters/src/main/resources/ application/appl
On Jan 13, 2010, at 6:39 AM, Lin Sun wrote:
> Hi Valentin,
>
> Should we check in the .classpath and .project files?
Please don't. They are annoying if you don't use eclipse, and IIUC
will get out of date as soon as a non-eclipse user does any work on
the project.
> I 'd think the
> mvn eclipse:eclipse can generate those on the fly.
I've never seemed to need any eclipse specific files when I try out
eclipse with m2e which appears to work a lot better than mvn
eclipse:eclipse.
thanks
david jencks
>
> Also, there are a few files missing the ASL license header like
> WarToWabConverterService.java.
>
> Thanks
>
> Lin
>
> On Wed, Jan 13, 2010 at 5:19 AM, <ma...@apache.org> wrote:
>> Author: mahrwald
>> Date: Wed Jan 13 10:19:25 2010
>> New Revision: 898698
>>
>> URL: http://svn.apache.org/viewvc?rev=898698&view=rev
>> Log:
>> ARIES-114 Move url handler part to trunk and refactor bundle
>> converter
>>
>> Added:
>> incubator/aries/trunk/application/application-converters/src/main/
>> resources/
>> incubator/aries/trunk/application/application-converters/src/main/
>> resources/OSGI-INF/
>> incubator/aries/trunk/application/application-converters/src/main/
>> resources/OSGI-INF/blueprint/
>> incubator/aries/trunk/application/application-converters/src/main/
>> resources/OSGI-INF/blueprint/aries.xml
>> incubator/aries/trunk/web/ (with props)
>> incubator/aries/trunk/web/.classpath
>> incubator/aries/trunk/web/.project
>> incubator/aries/trunk/web/.settings/
>> incubator/aries/trunk/web/.settings/org.eclipse.jdt.core.prefs
>> incubator/aries/trunk/web/.settings/org.maven.ide.eclipse.prefs
>> incubator/aries/trunk/web/pom.xml
>> incubator/aries/trunk/web/web-urlhandler/ (with props)
>> incubator/aries/trunk/web/web-urlhandler/.classpath
>> incubator/aries/trunk/web/web-urlhandler/.project
>> incubator/aries/trunk/web/web-urlhandler/.settings/
>> incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.eclipse.jdt.core.prefs
>> incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.maven.ide.eclipse.prefs
>> incubator/aries/trunk/web/web-urlhandler/pom.xml
>> incubator/aries/trunk/web/web-urlhandler/src/
>> incubator/aries/trunk/web/web-urlhandler/src/main/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/WarToWabConverter.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/impl/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/impl/ClassPathBuilder.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/impl/JSPImportParser.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/impl/PackageFinder.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/impl/WarToWabConverterImpl.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/converter/impl/WarToWabConverterService.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/url/
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/url/WARConnection.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/
>> aries/web/url/WAR_URLServiceHandler.java
>> incubator/aries/trunk/web/web-urlhandler/src/main/resources/
>> incubator/aries/trunk/web/web-urlhandler/src/main/resources/OSGI-
>> INF/
>> incubator/aries/trunk/web/web-urlhandler/src/main/resources/OSGI-
>> INF/blueprint/
>> incubator/aries/trunk/web/web-urlhandler/src/main/resources/OSGI-
>> INF/blueprint/WARHandler.xml
>> incubator/aries/trunk/web/web-urlhandler/src/test/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/
>> aries/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/
>> aries/web/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/
>> aries/web/converter/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/
>> aries/web/converter/impl/
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/
>> aries/web/converter/impl/JSPImportParserTest.java
>> incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/
>> aries/web/converter/impl/WabConverterTest.java
>> incubator/aries/trunk/web/web-urlhandler/src/test/resources/
>> incubator/aries/trunk/web/web-urlhandler/src/test/resources/JSPs/
>> incubator/aries/trunk/web/web-urlhandler/src/test/resources/JSPs/
>> helloImport.jsp
>> Removed:
>> incubator/aries/trunk/application/application-converters/src/main/
>> java/org/apache/aries/application/converters/Activator.java
>> incubator/aries/trunk/application/application-converters/src/main/
>> java/org/apache/aries/application/converters/ClassPathBuilder.java
>> incubator/aries/trunk/application/application-converters/src/main/
>> java/org/apache/aries/application/converters/JSPImportParser.java
>> incubator/aries/trunk/application/application-converters/src/main/
>> java/org/apache/aries/application/converters/PackageFinder.java
>> incubator/aries/trunk/application/application-converters/src/main/
>> java/org/apache/aries/application/converters/WarToWabConverter.java
>> incubator/aries/trunk/application/application-converters/src/test/
>> java/org/
>> incubator/aries/trunk/application/application-converters/src/test/
>> resources/JSPs/
>> Modified:
>> incubator/aries/trunk/application/application-converters/pom.xml
>> incubator/aries/trunk/application/application-converters/src/main/
>> java/org/apache/aries/application/converters/WabConverterService.java
>>
>> Modified: incubator/aries/trunk/application/application-converters/
>> pom.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-converters/pom.xml?rev=898698&r1=898697&r2=898698&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/application/application-converters/
>> pom.xml (original)
>> +++ incubator/aries/trunk/application/application-converters/
>> pom.xml Wed Jan 13 10:19:25 2010
>> @@ -48,18 +48,17 @@
>> <version>1.0.0-incubating-SNAPSHOT</version>
>> </dependency>
>> <dependency>
>> - <groupId>org.apache.geronimo.testsupport</
>> groupId>
>> - <artifactId>test-war-javaee_5</artifactId>
>> - <version>2.2</version>
>> - <type>war</type>
>> - <scope>test</scope>
>> - </dependency>
>> - <dependency>
>> <groupId>org.apache.aries.testsupport</groupId>
>>
>> <artifactId>org.apache.aries.testsupport.unit</artifactId>
>> <version>1.0.0-incubating-SNAPSHOT</version>
>> <scope>test</scope>
>> </dependency>
>> + <dependency>
>> + <groupId>org.apache.aries.web</groupId>
>> + <artifactId>org.apache.aries.web.urlhandler</artifactId>
>> + <version>1.0.0-incubating-SNAPSHOT</version>
>> + <scope>provided</scope>
>> + </dependency>
>> </dependencies>
>>
>> <build>
>> @@ -74,10 +73,6 @@
>> </Bundle-SymbolicName>
>> <Bundle-
>> Activator>org.apache.aries.application.converters.Activator
>> </Bundle-Activator>
>> - <Export-Package>
>> -
>> org.apache.aries.application;version="${pom.version}",
>> -
>> org.apache.aries.application.filesystem;version="${pom.version}"
>> - </Export-Package>
>> <_versionpolicy>[$
>> (version;==;$(@)),$(version;+;$(@)))
>> </_versionpolicy>
>>
>> <_removeheaders>Ignore-Package,Include-Resource,Private-
>> Package,Bundle-DocURL
>> @@ -85,18 +80,6 @@
>> </instructions>
>> </configuration>
>> </plugin>
>> - <plugin>
>> - <groupId>org.apache.maven.plugins</
>> groupId>
>> - <artifactId>maven-surefire-plugin</
>> artifactId>
>> - <configuration>
>> - <systemProperties>
>> - <property>
>> -
>> <name>maven.repo.local</name>
>> - <value>$
>> {localRepository}</value>
>> - </property>
>> - </systemProperties>
>> - </configuration>
>> - </plugin>
>> </plugins>
>> </build>
>>
>>
>> Modified: incubator/aries/trunk/application/application-converters/
>> src/main/java/org/apache/aries/application/converters/
>> WabConverterService.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java?rev=898698&r1=898697&r2=898698&view=diff
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/application/application-converters/src/
>> main/java/org/apache/aries/application/converters/
>> WabConverterService.java (original)
>> +++ incubator/aries/trunk/application/application-converters/src/
>> main/java/org/apache/aries/application/converters/
>> WabConverterService.java Wed Jan 13 10:19:25 2010
>> @@ -7,14 +7,27 @@
>> import org.apache.aries.application.filesystem.IDirectory;
>> import org.apache.aries.application.filesystem.IFile;
>> import org.apache.aries.application.management.BundleConverter;
>> +import org.apache.aries.web.converter.WarToWabConverter;
>> +import org.apache.aries.web.converter.WarToWabConverter.InputStreamProvider
>> ;
>>
>> public class WabConverterService implements BundleConverter {
>> + private WarToWabConverter wabConverter;
>> +
>> + public WarToWabConverter getWabConverter() {
>> + return wabConverter;
>> + }
>> +
>> + public void setWabConverter(WarToWabConverter wabConverter) {
>> + this.wabConverter = wabConverter;
>> + }
>>
>> - public InputStream convert(IDirectory parentEba, IFile
>> toBeConverted) {
>> + public InputStream convert(IDirectory parentEba, final IFile
>> toBeConverted) {
>> try {
>> - //TODO find the real name of the WAR file
>> - WarToWabConverter converter = new
>> WarToWabConverter(toBeConverted, new Properties());
>> - return converter.getWAB();
>> + return wabConverter.convert(new InputStreamProvider() {
>> + public InputStream getInputStream() throws IOException {
>> + return toBeConverted.open();
>> + }
>> + }, toBeConverted.getName(), new Properties());
>> } catch (IOException e) {
>> // TODO what to do with the Exception
>> return null;
>>
>> Added: incubator/aries/trunk/application/application-converters/src/
>> main/resources/OSGI-INF/blueprint/aries.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/application/application-converters/src/
>> main/resources/OSGI-INF/blueprint/aries.xml (added)
>> +++ incubator/aries/trunk/application/application-converters/src/
>> main/resources/OSGI-INF/blueprint/aries.xml Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,30 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<!--
>> + 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.
>> +-->
>> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> + xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
>> ">
>> +
>> + <reference id="converterService" interface="org.apache.aries.web.converter.WarToWabConverter
>> " />
>> +
>> + <bean id="bundleConverter"
>> class="org.apache.aries.application.converters.WabConverterService">
>> + <property name="wabConverter" value="converterService" />
>> + </bean>
>> +
>> + <service
>> interface="org.apache.aries.application.management.BundleConverter"
>> ref="bundleConverter" />
>> +
>> +</blueprint>
>> \ No newline at end of file
>>
>> Propchange: incubator/aries/trunk/web/
>> ------------------------------------------------------------------------------
>> --- svn:ignore (added)
>> +++ svn:ignore Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1 @@
>> +target
>>
>> Added: incubator/aries/trunk/web/.classpath
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/.classpath?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/.classpath (added)
>> +++ incubator/aries/trunk/web/.classpath Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,8 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<classpath>
>> + <classpathentry kind="src" output="target/classes"
>> path="src/main/java"/>
>> + <classpathentry kind="src" output="target/test-classes"
>> path="src/test/java"/>
>> + <classpathentry kind="con"
>> path="org.eclipse.jdt.launching.JRE_CONTAINER/
>> org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
>> + <classpathentry kind="con"
>> path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
>> + <classpathentry kind="output" path="target/classes"/>
>> +</classpath>
>>
>> Added: incubator/aries/trunk/web/.project
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/.project?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/.project (added)
>> +++ incubator/aries/trunk/web/.project Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,23 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<projectDescription>
>> + <name>web</name>
>> + <comment></comment>
>> + <projects>
>> + </projects>
>> + <buildSpec>
>> + <buildCommand>
>> + <name>org.eclipse.jdt.core.javabuilder</name>
>> + <arguments>
>> + </arguments>
>> + </buildCommand>
>> + <buildCommand>
>> + <name>org.maven.ide.eclipse.maven2Builder</
>> name>
>> + <arguments>
>> + </arguments>
>> + </buildCommand>
>> + </buildSpec>
>> + <natures>
>> + <nature>org.eclipse.jdt.core.javanature</nature>
>> + <nature>org.maven.ide.eclipse.maven2Nature</nature>
>> + </natures>
>> +</projectDescription>
>>
>> Added: incubator/aries/trunk/web/.settings/org.eclipse.jdt.core.prefs
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/.settings/org.eclipse.jdt.core.prefs?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/.settings/org.eclipse.jdt.core.prefs
>> (added)
>> +++ incubator/aries/trunk/web/.settings/org.eclipse.jdt.core.prefs
>> Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,5 @@
>> +#Wed Jan 13 09:03:41 GMT 2010
>> +eclipse.preferences.version=1
>> +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
>> +org.eclipse.jdt.core.compiler.compliance=1.4
>> +org.eclipse.jdt.core.compiler.source=1.4
>>
>> Added: incubator/aries/trunk/web/.settings/
>> org.maven.ide.eclipse.prefs
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/.settings/org.maven.ide.eclipse.prefs?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/.settings/org.maven.ide.eclipse.prefs
>> (added)
>> +++ incubator/aries/trunk/web/.settings/org.maven.ide.eclipse.prefs
>> Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,9 @@
>> +#Wed Jan 13 09:03:41 GMT 2010
>> +activeProfiles=
>> +eclipse.preferences.version=1
>> +fullBuildGoals=process-test-resources
>> +includeModules=false
>> +resolveWorkspaceProjects=true
>> +resourceFilterGoals=process-resources resources\:testResources
>> +skipCompilerPlugin=true
>> +version=1
>>
>> Added: incubator/aries/trunk/web/pom.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/pom.xml?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/pom.xml (added)
>> +++ incubator/aries/trunk/web/pom.xml Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,31 @@
>> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>> " xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
>> ">
>> + <parent>
>> + <artifactId>java5-parent</artifactId>
>> + <groupId>org.apache.aries</groupId>
>> + <version>1.0.0-incubating-SNAPSHOT</version>
>> + </parent>
>> + <modelVersion>4.0.0</modelVersion>
>> + <groupId>org.apache.aries.web</groupId>
>> + <artifactId>web</artifactId>
>> + <packaging>pom</packaging>
>> + <name>Apache Aries Web Component</name>
>> + <version>1.0.0-incubating-SNAPSHOT</version>
>> + <modules>
>> + <module>web-urlhandler</module>
>> + </modules>
>> + <dependencyManagement>
>> + <dependencies>
>> + <dependency>
>> + <groupId>org.osgi</groupId>
>> + <artifactId>org.osgi.core</artifactId>
>> + <version>4.2.0</version>
>> + </dependency>
>> +
>> + <dependency>
>> + <groupId>junit</groupId>
>> + <artifactId>junit</artifactId>
>> + <version>4.5</version>
>> + </dependency>
>> + </dependencies>
>> + </dependencyManagement>
>> +</project>
>> \ No newline at end of file
>>
>> Propchange: incubator/aries/trunk/web/web-urlhandler/
>> ------------------------------------------------------------------------------
>> --- svn:ignore (added)
>> +++ svn:ignore Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1 @@
>> +target
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/.classpath
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/.classpath?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/.classpath (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/.classpath Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,10 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<classpath>
>> + <classpathentry kind="src" output="target/classes"
>> path="src/main/java"/>
>> + <classpathentry kind="src" output="target/test-classes"
>> path="src/test/java"/>
>> + <classpathentry kind="src" path="src/main/resources"/>
>> + <classpathentry kind="src" path="src/test/resources"/>
>> + <classpathentry kind="con"
>> path="org.eclipse.jdt.launching.JRE_CONTAINER/
>> org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
>> + <classpathentry kind="con"
>> path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
>> + <classpathentry kind="output" path="target/classes"/>
>> +</classpath>
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/.project
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/.project?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/.project (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/.project Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,23 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<projectDescription>
>> + <name>web-urlhandler</name>
>> + <comment></comment>
>> + <projects>
>> + </projects>
>> + <buildSpec>
>> + <buildCommand>
>> + <name>org.eclipse.jdt.core.javabuilder</name>
>> + <arguments>
>> + </arguments>
>> + </buildCommand>
>> + <buildCommand>
>> + <name>org.maven.ide.eclipse.maven2Builder</
>> name>
>> + <arguments>
>> + </arguments>
>> + </buildCommand>
>> + </buildSpec>
>> + <natures>
>> + <nature>org.eclipse.jdt.core.javanature</nature>
>> + <nature>org.maven.ide.eclipse.maven2Nature</nature>
>> + </natures>
>> +</projectDescription>
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.eclipse.jdt.core.prefs
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/.settings/org.eclipse.jdt.core.prefs?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.eclipse.jdt.core.prefs (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.eclipse.jdt.core.prefs Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,5 @@
>> +#Wed Jan 13 09:06:49 GMT 2010
>> +eclipse.preferences.version=1
>> +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
>> +org.eclipse.jdt.core.compiler.compliance=1.5
>> +org.eclipse.jdt.core.compiler.source=1.5
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.maven.ide.eclipse.prefs
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/.settings/org.maven.ide.eclipse.prefs?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.maven.ide.eclipse.prefs (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/.settings/
>> org.maven.ide.eclipse.prefs Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,9 @@
>> +#Wed Jan 13 09:06:49 GMT 2010
>> +activeProfiles=
>> +eclipse.preferences.version=1
>> +fullBuildGoals=process-test-resources
>> +includeModules=false
>> +resolveWorkspaceProjects=true
>> +resourceFilterGoals=process-resources resources\:testResources
>> +skipCompilerPlugin=true
>> +version=1
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/pom.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/pom.xml?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/pom.xml (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/pom.xml Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,77 @@
>> +
>> + <!--
>> + 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.
>> + -->
>> +<project>
>> + <parent>
>> + <artifactId>web</artifactId>
>> + <groupId>org.apache.aries.web</groupId>
>> + <version>1.0.0-incubating-SNAPSHOT</version>
>> + </parent>
>> + <modelVersion>4.0.0</modelVersion>
>> +
>> + <artifactId>org.apache.aries.web.urlhandler</artifactId>
>> + <packaging>bundle</packaging>
>> + <name>Apache Aries Web Url handler</name>
>> +
>> + <dependencies>
>> + <dependency>
>> + <groupId>org.osgi</groupId>
>> + <artifactId>org.osgi.core</artifactId>
>> + <scope>provided</scope>
>> + </dependency>
>> + <dependency>
>> + <groupId>junit</groupId>
>> + <artifactId>junit</artifactId>
>> + <scope>provided</scope>
>> + </dependency>
>> + <dependency>
>> + <groupId>asm</groupId>
>> + <artifactId>asm-all</artifactId>
>> + <version>3.1</version>
>> + </dependency>
>> + <dependency>
>> + <groupId>org.apache.aries.testsupport</
>> groupId>
>> +
>> <artifactId>org.apache.aries.testsupport.unit</artifactId>
>> + <version>1.0.0-incubating-SNAPSHOT</version>
>> + <scope>test</scope>
>> + </dependency>
>> + </dependencies>
>> +
>> + <build>
>> + <plugins>
>> + <plugin>
>> + <groupId>org.apache.felix</groupId>
>> + <artifactId>maven-bundle-plugin</
>> artifactId>
>> + <extensions>true</extensions>
>> + <configuration>
>> + <instructions>
>> + <Bundle-
>> SymbolicName>${pom.groupId}.converters
>> + </Bundle-
>> SymbolicName>
>> + <Bundle-
>> Activator>org.apache.aries.application.converters.Activator
>> + </Bundle-Activator>
>> + <Export-
>> Package>org.apache.aries.web.converter;version="${pom.version}",
>> + </Export-Package>
>> + <_versionpolicy>[$
>> (version;==;$(@)),$(version;+;$(@)))
>> + </_versionpolicy>
>> +
>> <_removeheaders>Ignore-Package,Include-Resource,Private-
>> Package,Bundle-DocURL
>> + </_removeheaders>
>> + </instructions>
>> + </configuration>
>> + </plugin>
>> + </plugins>
>> + </build>
>> +
>> +</project>
>> \ No newline at end of file
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/WarToWabConverter.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/WarToWabConverter.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/WarToWabConverter.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/WarToWabConverter.java Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,31 @@
>> +package org.apache.aries.web.converter;
>> +
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.util.Properties;
>> +import java.util.jar.Manifest;
>> +
>> +public interface WarToWabConverter {
>> + public static interface InputStreamProvider {
>> + InputStream getInputStream() throws IOException;
>> + }
>> +
>> + /**
>> + * Generate the new manifest for the
>> + * @param input
>> + * @param name The name of the war file
>> + * @param properties Properties to influence the conversion as
>> defined in RFC66
>> + * @return
>> + */
>> + Manifest generateManifest(InputStreamProvider input, String
>> name, Properties properties) throws IOException;
>> +
>> + /**
>> + * Generate the converter WAB file. This file includes all the
>> files from the input
>> + * and has the new manifest.
>> + * @param input
>> + * @param name The name of the war file
>> + * @param properties Properties to influence the conversion as
>> defined in RFC66
>> + * @return
>> + */
>> + InputStream convert(InputStreamProvider input, String name,
>> Properties properties) throws IOException;
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/ClassPathBuilder.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/ClassPathBuilder.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/ClassPathBuilder.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/ClassPathBuilder.java Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,95 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.converter.impl;
>> +
>> +import java.io.File;
>> +import java.io.IOException;
>> +import java.util.ArrayList;
>> +import java.util.Map;
>> +import java.util.StringTokenizer;
>> +import java.util.jar.Manifest;
>> +
>> +public class ClassPathBuilder
>> +{
>> + private Map<String, Manifest> manifests;
>> +
>> + /**
>> + * This class takes a map of <jarFileName, manifest> pairs which
>> are contained in
>> + * a particular jar file.
>> + * The updatePath method then uses this list to analyse the
>> contents of the manifests
>> + * and looks for any dependencies in the other manifests in the
>> jar.
>> + * @param manifests
>> + */
>> + public ClassPathBuilder(Map<String, Manifest> manifests)
>> + {
>> + this.manifests = manifests;
>> + }
>> +
>> + /**
>> + * We take a full qualified jar file name and search its
>> manifest for any other classpath
>> + * dependencies within the other manifest in the parent jar file.
>> + * @param jarFile
>> + * @param classPath
>> + * @return
>> + * @throws IOException
>> + */
>> + public ArrayList<String> updatePath(String jarFile,
>> ArrayList<String> classPath) throws IOException
>> + {
>> + // Get the classpath entries from this manifest and merge
>> them into ours
>> + Manifest manifest = manifests.get(jarFile);
>> +
>> + if (manifest == null)
>> + return classPath;
>> +
>> + String dependencies =
>> manifest.getMainAttributes().getValue("Class-Path");
>> + if (dependencies == null)
>> + dependencies =
>> manifest.getMainAttributes().getValue("Class-path");
>> +
>> + if (dependencies != null)
>> + {
>> + // Search through the entries in the classpath
>> + StringTokenizer tok = new StringTokenizer(dependencies,
>> ";");
>> + while (tok.hasMoreTokens()) {
>> + String path = jarFile.substring(0,
>> jarFile.lastIndexOf('/'));;
>> + String entry = tok.nextToken();
>> +
>> + // Resolve the path to its canonical form
>> + path = new File("/"+path
>> +"/"+entry).getCanonicalPath().replace('\\','/');
>> + path = path.substring(path.indexOf('/')+1);
>> +
>> + // If we havent already located this dependency before
>> then we add this to our
>> + // list of dependencies
>> + if (entry.endsWith(".jar") &&
>> + manifests.keySet().contains(path) &&
>> + !classPath.contains(path) &&
>> + !path.startsWith("WEB-INF/lib"))
>> + {
>> + classPath.add(path);
>> +
>> + // Recursively search the new classpath entry for more
>> dependencies
>> + classPath = updatePath(path, classPath);
>> +
>> + }
>> + }
>> + }
>> +
>> + return classPath;
>> + }
>> +
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/JSPImportParser.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/JSPImportParser.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/JSPImportParser.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/JSPImportParser.java Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,94 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.converter.impl;
>> +
>> +import java.io.BufferedReader;
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.io.InputStreamReader;
>> +import java.util.Collection;
>> +import java.util.LinkedList;
>> +import java.util.regex.Matcher;
>> +import java.util.regex.Pattern;
>> +
>> +public class JSPImportParser {
>> +
>> + /**
>> + *
>> + * @param is
>> + * An input stream of character-based text. We expect
>> this to be JSP
>> + * source code.
>> + * @return Each java package found within valid JSP import tags
>> + * @throws IOException
>> + */
>> + public static Collection<String> getImports (InputStream is)
>> throws IOException {
>> + Collection<String> importedPackages = new LinkedList<String>();
>> + BufferedReader reader = new BufferedReader(new
>> InputStreamReader(is));
>> + String line = null;
>> + do {
>> + line = reader.readLine();
>> + // searchMatchedGroupForImports could take (line): I've not
>> done that because
>> + // the entry trace, once working, will print out lots of
>> useless information.
>> + if (line != null) {
>> + Matcher hasJSPimport = lineWithJSPimport.matcher(line);
>> + if (hasJSPimport.find()) {
>> + Collection<String> foundImports =
>> searchMatchedGroupForImports (hasJSPimport.group());
>> + for (String found : foundImports) {
>> + if (!importedPackages.contains(found)) {
>> + importedPackages.add(found);
>> + }
>> + }
>> + }
>> + }
>> + } while (line != null);
>> +
>> + return importedPackages;
>> + }
>> +
>> + private static final Pattern lineWithJSPimport =
>> Pattern.compile("<%@\\s*page\\s*import.*%>");
>> + private static final Pattern stanzaEnd = Pattern.compile("%>");
>> + private static final Pattern imports = Pattern.compile("import\
>> \s*=\\s*\"(.*?)\"");
>> +
>> + /**
>> + *
>> + * @param groupExtent a block of text known to contain a JSP
>> import
>> + * @return Each package found within valid JSP import tags
>> + */
>> + private static LinkedList<String> searchMatchedGroupForImports
>> (String groupExtent) {
>> + LinkedList<String> packagesFound = new LinkedList<String>();
>> + String importStanzas[] = stanzaEnd.split(groupExtent);
>> + for (String s: importStanzas){
>> + Matcher oneImport = imports.matcher(s);
>> + if (oneImport.find()) {
>> + String thisStanzasImports = oneImport.group();
>> + String allPackages =
>> thisStanzasImports.substring(thisStanzasImports.indexOf("\"")+1,
>> + thisStanzasImports.lastIndexOf("\""));
>> + String [] imports = allPackages.split(",");
>> + for (String p : imports) {
>> + String thisPackage =
>> p.substring(0,p.lastIndexOf('.')).trim();
>> +
>> + if (!!!thisPackage.startsWith("java."))
>> + packagesFound.add(thisPackage);
>> + }
>> + }
>> + }
>> +
>> + return packagesFound;
>> + }
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/PackageFinder.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/PackageFinder.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/PackageFinder.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/PackageFinder.java Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,454 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.converter.impl;
>> +
>> +import java.util.HashSet;
>> +import java.util.Iterator;
>> +import java.util.Set;
>> +
>> +import org.objectweb.asm.AnnotationVisitor;
>> +import org.objectweb.asm.Attribute;
>> +import org.objectweb.asm.ClassVisitor;
>> +import org.objectweb.asm.FieldVisitor;
>> +import org.objectweb.asm.Label;
>> +import org.objectweb.asm.MethodVisitor;
>> +import org.objectweb.asm.Type;
>> +import org.objectweb.asm.signature.SignatureReader;
>> +import org.objectweb.asm.signature.SignatureVisitor;
>> +
>> +public class PackageFinder implements AnnotationVisitor,
>> SignatureVisitor, ClassVisitor,
>> + FieldVisitor, MethodVisitor
>> +{
>> + private Set<String> packages = new HashSet<String>();
>> + private Set<String> exemptPackages = new HashSet<String>();
>> +
>> + // stored value of the signature class name
>> + private String signatureOuterClass = null;
>> +
>> + public Set<String> getImportPackages()
>> + {
>> + // Remove entries that will be imported by default
>> + for (Iterator<String> i = packages.iterator(); i.hasNext();) {
>> + if (i.next().startsWith("java.")) i.remove();
>> + }
>> +
>> + return packages;
>> + }
>> +
>> + public Set<String> getExemptPackages()
>> + {
>> + return exemptPackages;
>> + }
>> +
>> + private String getPackageName(String name)
>> + {
>> + String packageName = null;
>> + if (name != null) {
>> + int index = name.lastIndexOf('/');
>> + if (index > 0) packageName = name.substring(0, index);
>> + }
>> + return packageName;
>> + }
>> +
>> + private String canonizePackage(String rawPackage)
>> + {
>> + String result = rawPackage.replace('/', '.');
>> +
>> + // handle arrays
>> + return result.replaceFirst("^\\[+L", "");
>> + }
>> +
>> + private void addPackage(String packageName)
>> + {
>> + if (packageName != null) {
>> + packages.add(canonizePackage(packageName));
>> + }
>> + }
>> +
>> + private void addExemptPackage(String packageName)
>> + {
>> + if (packageName != null)
>> + exemptPackages.add(canonizePackage(packageName));
>> + }
>> +
>> + private void addPackages(String[] packageNames)
>> + {
>> + if (packageNames != null) {
>> + for (String s : packageNames)
>> + if (s != null) {
>> + packages.add(canonizePackage(s));
>> + }
>> + }
>> + }
>> +
>> + private String getResolvedPackageName(String name)
>> + {
>> + String resolvedName = null;
>> + if (name != null) resolvedName = getPackageName(name);
>> + return resolvedName;
>> + }
>> +
>> + private String[] getResolvedPackageNames(String[] names)
>> + {
>> + String[] resolvedNames = null;
>> + if (names != null) {
>> + resolvedNames = new String[names.length];
>> + int i = 0;
>> + for (String s : names)
>> + resolvedNames[i++] = getResolvedPackageName(s);
>> + }
>> + return resolvedNames;
>> + }
>> +
>> + private String getDescriptorInfo(String descriptor)
>> + {
>> + String type = null;
>> + if (descriptor != null) type =
>> getType(Type.getType(descriptor));
>> + return type;
>> + }
>> +
>> + private String[] getMethodDescriptorInfo(String descriptor)
>> + {
>> + String[] descriptors = null;
>> + if (descriptor != null) {
>> + Type[] types = Type.getArgumentTypes(descriptor);
>> + descriptors = new String[types.length + 1];
>> + descriptors[0] = getType(Type.getReturnType(descriptor));
>> + int i = 1;
>> + for (Type t : types)
>> + descriptors[i++] = getType(t);
>> + }
>> + return descriptors;
>> + }
>> +
>> + private String getType(Type t)
>> + {
>> + String type = null;
>> + switch (t.getSort())
>> + {
>> + case Type.ARRAY:
>> + type = getType(t.getElementType());
>> + break;
>> + case Type.OBJECT:
>> + type = getPackageName(t.getInternalName());
>> + break;
>> + }
>> + return type;
>> + }
>> +
>> + private void addSignaturePackages(String signature)
>> + {
>> + if (signature != null) new
>> SignatureReader(signature).accept(this);
>> + }
>> +
>> + private void addResolvedSignaturePackages(String signature)
>> + {
>> + if (signature != null) new
>> SignatureReader(signature).acceptType(this);
>> + }
>> +
>> + //
>> + // ClassVisitor methods
>> + //
>> +
>> + public void visit(int arg0, int arg1, String name, String
>> signature, String parent,
>> + String[] interfaces)
>> + {
>> + // We dont want to import our own packages so we add this
>> classes package name to the
>> + // list of exempt packages.
>> + addExemptPackage(getPackageName(name));
>> +
>> + if (signature == null) {
>> + addPackage(getResolvedPackageName(parent));
>> + addPackages(getResolvedPackageNames(interfaces));
>> + } else addSignaturePackages(signature);
>> + }
>> +
>> + public AnnotationVisitor visitAnnotation(String descriptor,
>> boolean visible)
>> + {
>> + addPackage(getDescriptorInfo(descriptor));
>> + return this;
>> + }
>> +
>> + public void visitAttribute(Attribute arg0)
>> + {
>> + // No-op
>> + }
>> +
>> + public FieldVisitor visitField(int access, String name, String
>> descriptor, String signature,
>> + Object value)
>> + {
>> + if (signature == null)
>> addPackage(getDescriptorInfo(descriptor));
>> + else addResolvedSignaturePackages(signature);
>> +
>> + if (value instanceof Type) addPackage(getType((Type) value));
>> + return this;
>> + }
>> +
>> + public void visitInnerClass(String arg0, String arg1, String
>> arg2, int arg3)
>> + {
>> + // no-op
>> + }
>> +
>> + public MethodVisitor visitMethod(int access, String name, String
>> descriptor, String signature,
>> + String[] exceptions)
>> + {
>> + if (signature == null)
>> addPackages(getMethodDescriptorInfo(descriptor));
>> + else addSignaturePackages(signature);
>> +
>> + addPackages(getResolvedPackageNames(exceptions));
>> + return this;
>> +
>> + }
>> +
>> + public void visitOuterClass(String arg0, String arg1, String arg2)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitSource(String arg0, String arg1)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitEnd()
>> + {
>> + // no-op
>> + }
>> +
>> + //
>> + // MethodVisitor methods
>> + //
>> +
>> + public AnnotationVisitor visitAnnotationDefault()
>> + {
>> + return this;
>> + }
>> +
>> + public void visitCode()
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitFieldInsn(int opcode, String owner, String
>> name, String descriptor)
>> + {
>> + addPackage(getResolvedPackageName(owner));
>> + addPackage(getDescriptorInfo(descriptor));
>> + }
>> +
>> + public void visitFrame(int arg0, int arg1, Object[] arg2, int
>> arg3, Object[] arg4)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitIincInsn(int arg0, int arg1)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitInsn(int arg0)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitIntInsn(int arg0, int arg1)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitJumpInsn(int arg0, Label arg1)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitLabel(Label arg0)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitLdcInsn(Object type)
>> + {
>> + if (type instanceof Type) addPackage(getType((Type) type));
>> + }
>> +
>> + public void visitLineNumber(int arg0, Label arg1)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitLocalVariable(String name, String descriptor,
>> String signature, Label start,
>> + Label end, int index)
>> + {
>> + addResolvedSignaturePackages(signature);
>> + }
>> +
>> + public void visitLookupSwitchInsn(Label arg0, int[] arg1,
>> Label[] arg2)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitMaxs(int arg0, int arg1)
>> + {
>> + // no-op
>> + }
>> +
>> + public void visitMethodInsn(int opcode, String owner, String
>> name, String descriptor)
>> + {
>> + addPackage(getResolvedPackageName(owner));
>> + addPackages(getMethodDescriptorInfo(descriptor));
>> + }
>> +
>> + public void visitMultiANewArrayInsn(String descriptor, int arg1)
>> + {
>> + addPackage(getDescriptorInfo(descriptor));
>> + }
>> +
>> + public AnnotationVisitor visitParameterAnnotation(int arg0,
>> String descriptor, boolean arg2)
>> + {
>> + addPackage(getDescriptorInfo(descriptor));
>> + return this;
>> + }
>> +
>> + public void visitTableSwitchInsn(int arg0, int arg1, Label arg2,
>> Label[] arg3)
>> + {
>> + //no-op
>> + }
>> +
>> + public void visitTryCatchBlock(Label arg0, Label arg1, Label
>> arg2, String type)
>> + {
>> + addPackage(getResolvedPackageName(type));
>> + }
>> +
>> + public void visitTypeInsn(int arg0, String type)
>> + {
>> + addPackage(getResolvedPackageName(type));
>> + }
>> +
>> + public void visitVarInsn(int arg0, int arg1)
>> + {
>> + // no-op
>> + }
>> +
>> + //
>> + // AnnotationVisitor Methods
>> + //
>> +
>> + public void visit(String arg0, Object value)
>> + {
>> + if (value instanceof Type) {
>> + addPackage(getType((Type) value));
>> + }
>> + }
>> +
>> + public AnnotationVisitor visitAnnotation(String arg0, String
>> descriptor)
>> + {
>> + addPackage(getDescriptorInfo(descriptor));
>> + return this;
>> + }
>> +
>> + public AnnotationVisitor visitArray(String arg0)
>> + {
>> + return this;
>> + }
>> +
>> + public void visitEnum(String name, String desc, String value)
>> + {
>> + addPackage(getDescriptorInfo(desc));
>> + }
>> +
>> + //
>> + // SignatureVisitor methods
>> + //
>> +
>> + public SignatureVisitor visitArrayType()
>> + {
>> + return this;
>> + }
>> +
>> + public void visitBaseType(char arg0)
>> + {
>> + // no-op
>> + }
>> +
>> + public SignatureVisitor visitClassBound()
>> + {
>> + return this;
>> + }
>> +
>> + public void visitClassType(String name)
>> + {
>> + signatureOuterClass = name;
>> + addPackage(getResolvedPackageName(name));
>> + }
>> +
>> + public void visitInnerClassType(String name)
>> + {
>> + addPackage(getResolvedPackageName(signatureOuterClass + "$" +
>> name));
>> + }
>> +
>> + public SignatureVisitor visitExceptionType()
>> + {
>> + return this;
>> + }
>> +
>> + public void visitFormalTypeParameter(String arg0)
>> + {
>> + // no-op
>> + }
>> +
>> + public SignatureVisitor visitInterface()
>> + {
>> + return this;
>> + }
>> +
>> + public SignatureVisitor visitParameterType()
>> + {
>> + return this;
>> + }
>> +
>> + public SignatureVisitor visitReturnType()
>> + {
>> + return this;
>> + }
>> +
>> + public SignatureVisitor visitSuperclass()
>> + {
>> + return this;
>> + }
>> +
>> + public void visitTypeArgument()
>> + {
>> + // no-op
>> + }
>> +
>> + public SignatureVisitor visitTypeArgument(char arg0)
>> + {
>> + return this;
>> + }
>> +
>> + public void visitTypeVariable(String arg0)
>> + {
>> + // no-op
>> + }
>> +
>> + public SignatureVisitor visitInterfaceBound()
>> + {
>> + return this;
>> + }
>> +
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/WarToWabConverterImpl.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterImpl.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/WarToWabConverterImpl.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/WarToWabConverterImpl.java Wed Jan
>> 13 10:19:25 2010
>> @@ -0,0 +1,409 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.converter.impl;
>> +
>> +import java.io.ByteArrayInputStream;
>> +import java.io.ByteArrayOutputStream;
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.util.ArrayList;
>> +import java.util.Collection;
>> +import java.util.HashMap;
>> +import java.util.HashSet;
>> +import java.util.Map;
>> +import java.util.Properties;
>> +import java.util.Set;
>> +import java.util.StringTokenizer;
>> +import java.util.jar.Attributes;
>> +import java.util.jar.JarInputStream;
>> +import java.util.jar.JarOutputStream;
>> +import java.util.jar.Manifest;
>> +import java.util.regex.Matcher;
>> +import java.util.regex.Pattern;
>> +import java.util.zip.ZipEntry;
>> +
>> +import org.apache.aries.web.converter.WarToWabConverter.InputStreamProvider
>> ;
>> +import org.objectweb.asm.ClassReader;
>> +import org.osgi.framework.Constants;
>> +
>> +public class WarToWabConverterImpl {
>> + private static final String DEFAULT_BUNDLE_VERSION = "1.0";
>> + private static final String DEFAULT_BUNDLE_MANIFESTVERSION = "2";
>> + private static final String INITIAL_CLASSPATH_ENTRY = "WEB-INF/
>> classes/";
>> + private static final String CLASSPATH_LIB_PREFIX = "WEB-INF/lib/";
>> + private static final String DEFAULT_IMPORT_PACKAGE_LIST =
>> "javax.servlet;version=2.5,"
>> + + "javax.servlet.http;version=2.5,"
>> + + "javax.el;version=2.1,"
>> + + "javax.servlet.jsp;version=2.1,"
>> + + "javax.servlet.jsp.el;version=2.1,"
>> + + "javax.servlet.jsp.tagext;version=2.1";
>> +
>> + private static final String DEFAULT_WEB_CONTEXT_PATH = "/";
>> + private static final String DEFAULT_WEB_JSP_EXTRACT_LOCATION =
>> "/";
>> +
>> + // TODO: These constants should be in the framework but at the
>> time of write
>> + // they
>> + // do not exist. When they do we need to point at their values
>> instead.
>> + public static final String WEB_CONTEXT_PATH = "Web-ContextPath";
>> + public static final String WEB_JSP_EXTRACT_LOCATION = "Web-
>> JSPExtractLocation";
>> +
>> + private Properties properties;
>> +
>> + // InputStream for the new WAB file
>> + private byte[] wabFile;
>> + private Manifest wabManifest;
>> + private String warName;
>> + private InputStreamProvider input;
>> +
>> + private boolean converted = false;
>> +
>> + // State used for updating the manifest
>> + private ArrayList<String> fileNames;
>> + private Set<String> importPackages;
>> + private Set<String> exemptPackages;
>> + private Map<String, Manifest> manifests;
>> + private ArrayList<String> classPath;
>> +
>> + public WarToWabConverterImpl(InputStreamProvider warFile, String
>> name, Properties properties) throws IOException {
>> + this.properties = properties;
>> + fileNames = new ArrayList<String>();
>> + classPath = new ArrayList<String>();
>> + importPackages = new HashSet<String>();
>> + exemptPackages = new HashSet<String>();
>> + input = warFile;
>> + this.warName = name;
>> + }
>> +
>> + private void convert() throws IOException {
>> +
>> + ZipEntry entry;
>> + JarInputStream jarInput = null;
>> +
>> + try {
>> + jarInput = new JarInputStream(input.getInputStream());
>> + scanForDependencies(jarInput);
>> +
>> + // Add the new properties to the manifest byte stream
>> + wabManifest = jarInput.getManifest();
>> + wabManifest = updateManifest(wabManifest);
>> + }
>> + finally {
>> + try { if (jarInput != null) jarInput.close(); } catch
>> (IOException e) { e.printStackTrace(); }
>> + }
>> +
>> + // Create a new jar file in memory with the new manifest and
>> the old data
>> + ByteArrayOutputStream output = new ByteArrayOutputStream();
>> + JarOutputStream jarOutput = null;
>> + jarInput = null;
>> +
>> + // Copy across all entries from the original jar
>> + int val;
>> + try {
>> + jarOutput = new JarOutputStream(output, wabManifest);
>> + jarInput = new JarInputStream(input.getInputStream());
>> + while ((entry = jarInput.getNextEntry()) != null) {
>> + jarOutput.putNextEntry(entry);
>> + while ((val = jarInput.read()) != -1)
>> + jarOutput.write(val);
>> + }
>> + }
>> + finally {
>> + if (jarOutput != null)
>> + jarOutput.close();
>> + if (jarInput != null)
>> + jarInput.close();
>> + }
>> +
>> + // Create a stream to the in-memory jar
>> + wabFile = output.toByteArray();
>> + }
>> +
>> + private void scanRecursive(final JarInputStream jarInput,
>> boolean topLevel) throws IOException
>> + {
>> + ZipEntry entry;
>> +
>> + while ((entry = jarInput.getNextEntry()) != null) {
>> + fileNames.add(entry.getName());
>> + if (entry.getName().endsWith(".class")) {
>> + PackageFinder pkgFinder = new PackageFinder();
>> + new ClassReader(jarInput).accept(pkgFinder,
>> ClassReader.SKIP_DEBUG);
>> +
>> + importPackages.addAll(pkgFinder.getImportPackages());
>> + exemptPackages.addAll(pkgFinder.getExemptPackages());
>> + } else if (entry.getName().endsWith(".jsp")) {
>> + Collection<String> thisJSPsImports =
>> JSPImportParser.getImports(jarInput);
>> + importPackages.addAll(thisJSPsImports);
>> + } else if (entry.getName().endsWith(".jar")) {
>> +
>> + JarInputStream newJar = new JarInputStream(new
>> InputStream() {
>> + @Override
>> + public int read() throws IOException
>> + {
>> + return jarInput.read();
>> + }
>> + });
>> +
>> + // discard return, we only care about the top level jars
>> + scanRecursive(newJar,false);
>> +
>> + // do not add jar embedded in already embedded jars
>> + if (topLevel) {
>> + manifests.put(entry.getName(), newJar.getManifest());
>> + }
>> + }
>> + }
>> + }
>> +
>> + /**
>> + *
>> + * Read in the filenames inside the war (used for manifest
>> update) Also
>> + * analyse the bytecode of any .class files in order to find any
>> required
>> + * imports
>> + */
>> + private void scanForDependencies(final JarInputStream jarInput)
>> throws IOException
>> + {
>> + manifests = new HashMap<String, Manifest>();
>> +
>> + scanRecursive(jarInput, true);
>> +
>> + // Process manifests from jars in order to work out classpath
>> dependencies
>> + ClassPathBuilder classPathBuilder = new
>> ClassPathBuilder(manifests);
>> + for (String fileName : manifests.keySet())
>> + if (fileName.startsWith("WEB-INF/lib")) {
>> + classPath.add(fileName);
>> + classPath = classPathBuilder.updatePath(fileName,
>> classPath);
>> + }
>> +
>> + // Remove packages that are part of the classes we searched
>> through
>> + for (String s : exemptPackages)
>> + if (importPackages.contains(s))
>> + importPackages.remove(s);
>> + }
>> +
>> + protected Manifest updateManifest(Manifest manifest) throws
>> IOException
>> + {
>> + // If for some reason no manifest was generated, we start our
>> own so that we don't null pointer later on
>> + if (manifest == null) {
>> + manifest = new Manifest();
>> +
>> manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,
>> "1");
>> + }
>> +
>> + // Compare the manifest and the supplied properties
>> +
>> + //
>> + // Bundle-Version
>> + //
>> +
>> + if
>> (manifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION) ==
>> null
>> + && !properties.containsKey(Constants.BUNDLE_VERSION)) {
>> + properties.put(Constants.BUNDLE_VERSION,
>> DEFAULT_BUNDLE_VERSION);
>> + }
>> +
>> + //
>> + // Bundle-ManifestVersion
>> + //
>> +
>> + if
>> (manifest
>> .getMainAttributes().getValue(Constants.BUNDLE_MANIFESTVERSION) ==
>> null
>> + && !
>> properties.containsKey(Constants.BUNDLE_MANIFESTVERSION)) {
>> + properties.put(Constants.BUNDLE_MANIFESTVERSION,
>> + DEFAULT_BUNDLE_MANIFESTVERSION);
>> + }
>> +
>> + //
>> + // Bundle-SymbolicName
>> + //
>> +
>> + if
>> (manifest
>> .getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME) == null
>> + && !properties.containsKey(Constants.BUNDLE_SYMBOLICNAME)) {
>> + properties.put(Constants.BUNDLE_SYMBOLICNAME, warName + "_"
>> + + manifest.hashCode());
>> + }
>> +
>> + //
>> + // Bundle-ClassPath
>> + //
>> +
>> + ArrayList<String> classpath = new ArrayList<String>();
>> +
>> + // Set initial entry into classpath
>> + classpath.add(0, INITIAL_CLASSPATH_ENTRY);
>> +
>> + // Add any files from the WEB-INF/lib directory + their
>> dependencies
>> + classpath.addAll(classPath);
>> +
>> + for (String s : fileNames)
>> + if (s.startsWith(CLASSPATH_LIB_PREFIX) && !
>> classpath.contains(s))
>> + classpath.add(s);
>> +
>> + // Get the list from the URL and add to classpath (removing
>> duplicates)
>> +
>> mergePathList(properties.getProperty(Constants.BUNDLE_CLASSPATH),
>> + classpath, ",");
>> +
>> + // Get the existing list from the manifest file and add to
>> classpath
>> + // (removing duplicates)
>> + mergePathList(manifest.getMainAttributes().getValue(
>> + Constants.BUNDLE_CLASSPATH), classpath, ",");
>> +
>> + // Construct the classpath string and set it into the properties
>> + StringBuffer classPathValue = new StringBuffer();
>> + for (String entry : classpath) {
>> + classPathValue.append(",");
>> + classPathValue.append(entry);
>> + }
>> +
>> + if (!classpath.isEmpty())
>> + properties.put(Constants.BUNDLE_CLASSPATH,
>> classPathValue.toString()
>> + .substring(1));
>> +
>> + ArrayList<String> packages = new ArrayList<String>() {
>> + @Override
>> + public boolean contains(Object elem) {
>> + // Check for exact match of export list
>> + if (super.contains(elem))
>> + return true;
>> +
>> + if (!!!(elem instanceof String))
>> + return false;
>> +
>> + String expPackageStmt = (String) elem;
>> + String expPackage = expPackageStmt.split("\\s*;\\s*")[0];
>> +
>> + Pattern p = Pattern.compile("^\
>> \s*"+Pattern.quote(expPackage)+"((;|\\s).*)?\\s*$");
>> + for (String s : this) {
>> + Matcher m = p.matcher(s);
>> + if (m.matches()) {
>> + return true;
>> + }
>> + }
>> +
>> + return false;
>> + }
>> +
>> + };
>> +
>> + //
>> + // Import-Package
>> + //
>> + packages.clear();
>> +
>> + // Get the list from the URL and add to classpath (removing
>> duplicates)
>> +
>> mergePathList(properties.getProperty(Constants.IMPORT_PACKAGE),
>> packages,
>> + ",");
>> +
>> + // Get the existing list from the manifest file and add to
>> classpath
>> + // (removing duplicates)
>> + mergePathList(manifest.getMainAttributes().getValue(
>> + Constants.IMPORT_PACKAGE), packages, ",");
>> +
>> + // Add the default set of packages
>> + mergePathList(DEFAULT_IMPORT_PACKAGE_LIST, packages, ",");
>> +
>> + // Analyse the bytecode of any .class files in the jar to find
>> any other
>> + // required imports
>> + if (!!!importPackages.isEmpty()) {
>> + StringBuffer generatedImports = new StringBuffer();
>> + for (String entry : importPackages) {
>> + generatedImports.append(',');
>> + generatedImports.append(entry);
>> + generatedImports.append(";resolution:=optional");
>> + }
>> +
>> + mergePathList(generatedImports.substring(1), packages, ",");
>> + }
>> +
>> + // Construct the string and set it into the properties
>> + StringBuffer importValues = new StringBuffer();
>> + for (String entry : packages) {
>> + importValues.append(",");
>> + importValues.append(entry);
>> + }
>> + if (!packages.isEmpty())
>> + properties.put(Constants.IMPORT_PACKAGE,
>> importValues.toString()
>> + .substring(1));
>> +
>> + //
>> + // Web-ContextPath
>> + //
>> +
>> + String webCPath =
>> manifest.getMainAttributes().getValue(WEB_CONTEXT_PATH);
>> + if (webCPath != null)
>> + {
>> + if (!webCPath.startsWith(DEFAULT_WEB_CONTEXT_PATH))
>> + {
>> + webCPath = DEFAULT_WEB_CONTEXT_PATH + webCPath;
>> + properties.put(WEB_CONTEXT_PATH, webCPath);
>> + }
>> + }
>> + else if ( !properties.containsKey(WEB_CONTEXT_PATH)) {
>> + properties.put(WEB_CONTEXT_PATH, DEFAULT_WEB_CONTEXT_PATH);
>> + }
>> +
>> + //
>> + // Web-JSPExtractLocation
>> + //
>> +
>> + if
>> (manifest.getMainAttributes().getValue(WEB_JSP_EXTRACT_LOCATION) ==
>> null
>> + && !properties.containsKey(WEB_JSP_EXTRACT_LOCATION)) {
>> + properties
>> + .put(WEB_JSP_EXTRACT_LOCATION,
>> DEFAULT_WEB_JSP_EXTRACT_LOCATION);
>> + }
>> +
>> + // Take the properties map and add them to the manifest file
>> + for (Object s : properties.keySet())
>> + manifest.getMainAttributes().put(new
>> Attributes.Name((String) s), properties.get(s));
>> +
>> + return manifest;
>> + }
>> +
>> + // pathlist = A "delim" delimitted list of path entries
>> + public static void mergePathList(String pathlist,
>> ArrayList<String> classpath,
>> + String delim) {
>> + if (pathlist != null) {
>> + StringTokenizer tok = new StringTokenizer(pathlist, delim);
>> + while (tok.hasMoreTokens()) {
>> + String token = tok.nextToken().trim();
>> + if (!classpath.contains(token))
>> + classpath.add(token);
>> + }
>> + }
>> + }
>> +
>> + public InputStream getWAB() throws IOException {
>> + ensureConverted();
>> + return new ByteArrayInputStream(wabFile);
>> + }
>> +
>> + public Manifest getWABManifest() throws IOException {
>> + ensureConverted();
>> + return wabManifest;
>> + }
>> +
>> + public int getWabLength() throws IOException {
>> + ensureConverted();
>> + return wabFile.length;
>> + }
>> +
>> + private void ensureConverted() throws IOException {
>> + if (!!!converted) {
>> + convert();
>> + converted = true;
>> + }
>> + }
>> +
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/WarToWabConverterService.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/converter/impl/WarToWabConverterService.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/WarToWabConverterService.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/converter/impl/WarToWabConverterService.java Wed
>> Jan 13 10:19:25 2010
>> @@ -0,0 +1,22 @@
>> +package org.apache.aries.web.converter.impl;
>> +
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.util.Properties;
>> +import java.util.jar.Manifest;
>> +
>> +import org.apache.aries.web.converter.WarToWabConverter;
>> +
>> +public class WarToWabConverterService implements WarToWabConverter {
>> +
>> + public InputStream convert(InputStreamProvider input, String
>> name, Properties properties) throws IOException {
>> + WarToWabConverterImpl converter = new
>> WarToWabConverterImpl(input, name, properties);
>> + return converter.getWAB();
>> + }
>> +
>> + public Manifest generateManifest(InputStreamProvider input,
>> String name, Properties properties) throws IOException {
>> + WarToWabConverterImpl converter = new
>> WarToWabConverterImpl(input, name, properties);
>> + return converter.getWABManifest();
>> + }
>> +
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/url/WARConnection.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WARConnection.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/url/WARConnection.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/url/WARConnection.java Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,87 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.url;
>> +
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.net.MalformedURLException;
>> +import java.net.URL;
>> +import java.net.URLConnection;
>> +import java.util.Properties;
>> +
>> +import org.apache.aries.web.converter.WarToWabConverter.InputStreamProvider
>> ;
>> +import org.apache.aries.web.converter.impl.WarToWabConverterImpl;
>> +import org.osgi.framework.Constants;
>> +
>> +public class WARConnection extends URLConnection
>> +{
>> + private WarToWabConverterImpl converter = null;
>> + private Properties properties;
>> +
>> + protected WARConnection(URL url, Properties properties) throws
>> MalformedURLException
>> + {
>> + super(url);
>> + this.properties = properties;
>> +
>> + // Validate properties
>> +
>> + String bundleManifestVersion =
>> (String)properties.get(Constants.BUNDLE_VERSION);
>> + if (bundleManifestVersion != null && !
>> bundleManifestVersion.equals("2"))
>> + throw new MalformedURLException("Incorrect bundle version
>> supplied in URL : "+bundleManifestVersion);
>> +
>> + }
>> +
>> + @Override
>> + public void connect() throws IOException
>> + {
>> + int fileNameIndex = url.getFile().lastIndexOf("/") + 1;
>> + String warName;
>> + if (fileNameIndex != 0)
>> + warName = url.getFile().substring(fileNameIndex);
>> + else
>> + warName = url.getFile();
>> +
>> + converter = new WarToWabConverterImpl(new
>> InputStreamProvider() {
>> + public InputStream getInputStream() throws IOException {
>> + return url.openStream();
>> + }
>> + }, warName, properties);
>> + }
>> +
>> + @Override
>> + public InputStream getInputStream() throws IOException
>> + {
>> + if (converter == null)
>> + connect();
>> +
>> + return converter.getWAB();
>> + }
>> +
>> + @Override
>> + public int getContentLength()
>> + {
>> + try {
>> + if (converter == null)
>> + connect();
>> + return converter.getWabLength();
>> + } catch (IOException e) {
>> + return -1;
>> + }
>> + }
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/url/WAR_URLServiceHandler.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/java/org/apache/aries/web/url/WAR_URLServiceHandler.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/url/WAR_URLServiceHandler.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/java/org/
>> apache/aries/web/url/WAR_URLServiceHandler.java Wed Jan 13 10:19:25
>> 2010
>> @@ -0,0 +1,110 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.url;
>> +
>> +import java.io.IOException;
>> +import java.net.URL;
>> +import java.net.URLConnection;
>> +import java.util.Dictionary;
>> +import java.util.Hashtable;
>> +import java.util.Properties;
>> +import java.util.StringTokenizer;
>> +
>> +import org.osgi.framework.BundleActivator;
>> +import org.osgi.framework.BundleContext;
>> +import org.osgi.service.url.AbstractURLStreamHandlerService;
>> +import org.osgi.service.url.URLConstants;
>> +import org.osgi.service.url.URLStreamHandlerService;
>> +
>> +public class WAR_URLServiceHandler extends
>> AbstractURLStreamHandlerService implements
>> + BundleActivator
>> +{
>> +
>> + private static final String urlScheme = "webbundle";
>> +
>> + public WAR_URLServiceHandler()
>> + {
>> + super();
>> + }
>> +
>> + public URLConnection openConnection(URL url) throws IOException
>> + {
>> + // Create properties object
>> + Properties properties = new Properties();
>> + if (url.getQuery() != null)
>> + {
>> + String propString = url.getQuery();
>> + StringTokenizer tok = new StringTokenizer(propString);
>> + boolean firstProperty = true;
>> +
>> + // We now parse the property pairs query string.
>> + // This has the format name=value&name=value...(etc)
>> + while (tok.hasMoreElements())
>> + {
>> + String name = tok.nextToken("=");
>> + // "name" will now contain the name of the property we are
>> trying to
>> + // set. Property pairs are seperated by the '&' symbol.
>> The tokenizer
>> + // will include this symbol in the token so we need to
>> return it from
>> + // all property names except the first.
>> + if (!!!firstProperty)
>> + name = name.substring(1);
>> + String value = tok.nextToken("&").substring(1);
>> + properties.put(name, value);
>> + firstProperty = false;
>> + }
>> + }
>> +
>> + return new WARConnection(new URL(url.getPath()), properties);
>> + }
>> +
>> + @Override
>> + public void parseURL(URL u, String spec, int start, int limit)
>> + {
>> + int propertyStart = spec.lastIndexOf('?') + 1;
>> + String propertyString = null;
>> + if (propertyStart > 0)
>> + {
>> + propertyString = spec.substring(propertyStart, spec.length());
>> + propertyStart--;
>> + }
>> + else
>> + propertyStart = spec.length();
>> +
>> + String warURL = spec.substring(start, propertyStart);
>> +
>> + // For our war url, we use the "path" field to specify the
>> full url path to the WAR file,
>> + // and we use the "query" field to specify the properties for
>> the WAB manifest
>> +
>> + setURL(u, urlScheme, null, 0, null, null, warURL,
>> propertyString, null);
>> + }
>> +
>> + public void start(BundleContext context) throws Exception
>> + {
>> + Dictionary properties = new Hashtable();
>> + properties.put( URLConstants.URL_HANDLER_PROTOCOL, new
>> String[] {urlScheme});
>> +
>> context.registerService(URLStreamHandlerService.class.getName(),
>> this, properties);
>> + }
>> +
>> + public void stop(BundleContext arg0) throws Exception
>> + {
>> + // TODO Auto-generated method stub
>> +
>> + }
>> +
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/main/resources/
>> OSGI-INF/blueprint/WARHandler.xml
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/main/resources/OSGI-INF/blueprint/WARHandler.xml?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/main/resources/
>> OSGI-INF/blueprint/WARHandler.xml (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/main/resources/
>> OSGI-INF/blueprint/WARHandler.xml Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,38 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<!--
>> + 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.
>> +-->
>> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> + xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
>> ">
>> +
>> + <bean id="WarURLSchemeHandler"
>> class="org.apache.aries.web.url.WAR_URLServiceHandler"
>> activation="lazy"/>
>> +
>> + <service ref="WarURLSchemeHandler"
>> interface="org.osgi.service.url.URLStreamHandlerService">
>> + <service-properties>
>> + <entry key="url.handler.protocol">
>> + <array value-type="java.lang.String">
>> + <value>war</value>
>> + </array>
>> + </entry>
>> + </service-properties>
>> + </service>
>> +
>> + <bean id="WarConverterService" class="org.apache.aries.web.converter.impl.WarToWabConverterService
>> " />
>> +
>> + <service ref="WarConverterService" interface="org.apache.aries.web.converter.WarToWabConverter
>> " />
>> +
>> +</blueprint>
>> \ No newline at end of file
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/test/java/org/
>> apache/aries/web/converter/impl/JSPImportParserTest.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/aries/web/converter/impl/JSPImportParserTest.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/test/java/org/
>> apache/aries/web/converter/impl/JSPImportParserTest.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/test/java/org/
>> apache/aries/web/converter/impl/JSPImportParserTest.java Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,43 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.converter.impl;
>> +
>> +import static org.junit.Assert.assertFalse;
>> +import static org.junit.Assert.assertTrue;
>> +
>> +import java.io.InputStream;
>> +import java.util.Collection;
>> +
>> +import org.apache.aries.web.converter.impl.JSPImportParser;
>> +import org.junit.Test;
>> +
>> +public class JSPImportParserTest {
>> +
>> + @Test
>> + public void testJSPImportParser () throws Exception {
>> + InputStream helloImport =
>> getClass().getClassLoader().getResourceAsStream("JSPs/
>> helloImport.jsp");
>> + Collection<String> imports =
>> JSPImportParser.getImports(helloImport);
>> + assertTrue("Four imports expected", imports.size() == 4);
>> + assertTrue(imports.contains("javax.jms"));
>> + assertTrue(imports.contains("javax.mystuff"));
>> + assertTrue(imports.contains("javax.transaction"));
>> + assertTrue(imports.contains("a.b"));
>> + assertFalse(imports.contains("java.util"));
>> + }
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/test/java/org/
>> apache/aries/web/converter/impl/WabConverterTest.java
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/test/java/org/apache/aries/web/converter/impl/WabConverterTest.java?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/test/java/org/
>> apache/aries/web/converter/impl/WabConverterTest.java (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/test/java/org/
>> apache/aries/web/converter/impl/WabConverterTest.java Wed Jan 13
>> 10:19:25 2010
>> @@ -0,0 +1,189 @@
>> +/*
>> + * 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 WARRANTIESOR 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.aries.web.converter.impl;
>> +
>> +import static org.junit.Assert.assertEquals;
>> +import static org.junit.Assert.assertTrue;
>> +
>> +import java.io.ByteArrayInputStream;
>> +import java.io.ByteArrayOutputStream;
>> +import java.io.IOException;
>> +import java.io.InputStream;
>> +import java.util.Properties;
>> +import java.util.jar.Attributes;
>> +import java.util.jar.JarInputStream;
>> +import java.util.jar.JarOutputStream;
>> +import java.util.jar.Manifest;
>> +import java.util.zip.ZipEntry;
>> +
>> +import org.apache.aries.web.converter.WarToWabConverter.InputStreamProvider
>> ;
>> +import org.junit.Test;
>> +import org.osgi.framework.Constants;
>> +
>> +/**
>> + * These tests do not cover the complete functionality (as yet).
>> Rather this gives a place for adding
>> + * smaller tests for individual units of work that don't need to
>> be tested by converting a whole WAR file.
>> + */
>> +public class WabConverterTest
>> +{
>> + public static final String WAR_FILE_NAME_WO_SUFFIX = "test";
>> + public static final String WAR_FILE_NAME =
>> WAR_FILE_NAME_WO_SUFFIX + ".war";
>> +
>> + /**
>> + * Test that we can handle a null manifest (in case a jar
>> archive was created without manifest)
>> + */
>> + @Test
>> + public void testNullManifest() throws Exception
>> + {
>> + WarToWabConverterImpl sut = new
>> WarToWabConverterImpl(makeTestFile(new byte[0]), WAR_FILE_NAME, new
>> Properties());
>> +
>> + Manifest res = sut.updateManifest(null);
>> + Attributes attrs = res.getMainAttributes();
>> +
>> + assertTrue(attrs.getValue("Import-
>> Package").contains("javax.servlet"));
>> + }
>> +
>> + @Test
>> + public void testImportPackageMerge() throws Exception
>> + {
>> + WarToWabConverterImpl sut = new
>> WarToWabConverterImpl(makeTestFile(new byte[0]), WAR_FILE_NAME, new
>> Properties());
>> +
>> + Manifest input = new Manifest();
>> + input.getMainAttributes().putValue("Import-Package",
>> "com.ibm.test,javax.servlet.http");
>> +
>> + Manifest res = sut.updateManifest(input);
>> + Attributes attrs = res.getMainAttributes();
>> +
>> + assertEquals(
>> + "com.ibm.test,"+
>> + "javax.servlet.http,"+
>> + "javax.servlet;version=2.5,"+
>> + "javax.el;version=2.1,"+
>> + "javax.servlet.jsp;version=2.1,"+
>> + "javax.servlet.jsp.el;version=2.1,"+
>> + "javax.servlet.jsp.tagext;version=2.1",
>> + attrs.getValue("Import-Package"));
>> + }
>> +
>> +
>> + @Test
>> + public void testAcceptNoManifest() throws Exception
>> + {
>> + final ByteArrayOutputStream bout = new ByteArrayOutputStream();
>> + JarOutputStream out = new JarOutputStream(bout);
>> + out.putNextEntry(new ZipEntry("random.html"));
>> + out.write("hello world".getBytes());
>> + out.close();
>> +
>> + InputStreamProvider input = makeTestFile(bout.toByteArray());
>> +
>> + Properties props = new Properties();
>> + props.put(Constants.BUNDLE_SYMBOLICNAME, "test.bundle");
>> + WarToWabConverterImpl sut = new WarToWabConverterImpl(input,
>> WAR_FILE_NAME, props);
>> +
>> + Manifest m = new JarInputStream(sut.getWAB()).getManifest();
>> + assertEquals("test.bundle",
>> m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME));
>> + }
>> +
>> + @Test
>> + public void testDefaultProperties() throws Exception {
>> + Attributes attrs = convertWithProperties();
>> +
>> +
>> assertTrue
>> (attrs
>> .getValue
>> (Constants.BUNDLE_SYMBOLICNAME).startsWith(WAR_FILE_NAME_WO_SUFFIX));
>> + assertEquals("/",
>> attrs.getValue(WarToWabConverterImpl.WEB_JSP_EXTRACT_LOCATION));
>> + assertEquals("1.0", attrs.getValue(Constants.BUNDLE_VERSION));
>> +
>> assertEquals
>> ("javax
>> .servlet
>> ;version=2.5,javax.servlet.http;version=2.5,javax.el;version=2.1," +
>> +
>> "javax.servlet.jsp;version=2.1,javax.servlet.jsp.el;version=2.1," +
>> + "javax.servlet.jsp.tagext;version=2.1",
>> + attrs.getValue(Constants.IMPORT_PACKAGE));
>> + assertEquals("WEB-INF/
>> classes/",attrs.getValue(Constants.BUNDLE_CLASSPATH));
>> + }
>> +
>> + @Test
>> + public void testPropertySupport() throws Exception {
>> + Attributes attrs = convertWithProperties(
>> + WarToWabConverterImpl.WEB_CONTEXT_PATH, "../WebFiles",
>> + WarToWabConverterImpl.WEB_JSP_EXTRACT_LOCATION, "/jsp",
>> + Constants.BUNDLE_VERSION, "2.0",
>> + Constants.IMPORT_PACKAGE,
>> "org
>> .apache
>> .aries.test;version=2.5,org.apache.aries.test.eba;version=1.0");
>> +
>> + assertEquals("../WebFiles",
>> attrs.getValue(WarToWabConverterImpl.WEB_CONTEXT_PATH));
>> + assertEquals("/jsp",
>> attrs.getValue(WarToWabConverterImpl.WEB_JSP_EXTRACT_LOCATION));
>> + assertEquals("2.0", attrs.getValue(Constants.BUNDLE_VERSION));
>> +
>> assertEquals
>> ("org
>> .apache
>> .aries.test;version=2.5,org.apache.aries.test.eba;version=1.0,"+
>> +
>> "javax
>> .servlet
>> ;version=2.5,javax.servlet.http;version=2.5,javax.el;version=2.1," +
>> +
>> "javax.servlet.jsp;version=2.1,javax.servlet.jsp.el;version=2.1," +
>> + "javax.servlet.jsp.tagext;version=2.1",
>> + attrs.getValue(Constants.IMPORT_PACKAGE));
>> + }
>> +
>> + @Test
>> + public void testManifestAndPropertyOverwrites() throws Exception {
>> + Manifest m = new Manifest();
>> + Attributes attrs = m.getMainAttributes();
>> + attrs.putValue(Constants.BUNDLE_SYMBOLICNAME,
>> "org.apache.test");
>> + attrs.putValue(Constants.BUNDLE_VERSION, "1.0");
>> + attrs.putValue(Constants.IMPORT_PACKAGE,
>> "org.apache.util,org.apache.test;version=1.0");
>> + attrs.putValue(Constants.BUNDLE_CLASSPATH, "jsp/classes/");
>> +
>> + attrs = convertWithProperties(m, Constants.BUNDLE_VERSION,
>> "2.0",
>> + Constants.IMPORT_PACKAGE,
>> "org.apache.wab,org.apache.test;version=2.0",
>> + Constants.BUNDLE_CLASSPATH, "aries/generated/");
>> +
>> + assertEquals("org.apache.test",
>> attrs.getValue(Constants.BUNDLE_SYMBOLICNAME));
>> + assertEquals("2.0", attrs.getValue(Constants.BUNDLE_VERSION));
>> +
>> assertTrue
>> (attrs
>> .getValue(Constants.IMPORT_PACKAGE).contains("org.apache.util"));
>> +
>> assertTrue
>> (attrs
>> .getValue
>> (Constants.IMPORT_PACKAGE).contains("org.apache.test;version=2.0"));
>> +
>> assertTrue
>> (attrs
>> .getValue(Constants.IMPORT_PACKAGE).contains("org.apache.wab"));
>> + assertEquals("WEB-INF/classes/,aries/generated/,jsp/classes/",
>> attrs.getValue(Constants.BUNDLE_CLASSPATH));
>> + }
>> +
>> + private Attributes convertWithProperties(Manifest m, String ...
>> props) throws Exception {
>> + Properties properties = new Properties();
>> + for (int i=0;i<props.length;i+=2) {
>> + properties.put(props[i], props[i+1]);
>> + }
>> +
>> + byte[] bytes = new byte[0];
>> +
>> + if (m != null) {
>> + m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,
>> "1");
>> + final ByteArrayOutputStream bout = new
>> ByteArrayOutputStream();
>> + JarOutputStream out = new JarOutputStream(bout,m);
>> + out.close();
>> + bytes = bout.toByteArray();
>> + }
>> +
>> + WarToWabConverterImpl sut = new
>> WarToWabConverterImpl(makeTestFile(bytes), WAR_FILE_NAME,
>> properties);
>> + return sut.getWABManifest().getMainAttributes();
>> + }
>> +
>> + private Attributes convertWithProperties(String ... props)
>> throws Exception {
>> + return convertWithProperties(null, props);
>> + }
>> +
>> +
>> + private InputStreamProvider makeTestFile(final byte[] content) {
>> + return new InputStreamProvider() {
>> + public InputStream getInputStream() throws IOException {
>> + return new ByteArrayInputStream(content);
>> + }
>> + };
>> + }
>> +}
>>
>> Added: incubator/aries/trunk/web/web-urlhandler/src/test/resources/
>> JSPs/helloImport.jsp
>> URL: http://svn.apache.org/viewvc/incubator/aries/trunk/web/web-urlhandler/src/test/resources/JSPs/helloImport.jsp?rev=898698&view=auto
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- incubator/aries/trunk/web/web-urlhandler/src/test/resources/
>> JSPs/helloImport.jsp (added)
>> +++ incubator/aries/trunk/web/web-urlhandler/src/test/resources/
>> JSPs/helloImport.jsp Wed Jan 13 10:19:25 2010
>> @@ -0,0 +1,29 @@
>> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> +
>> +<HTML>
>> +<HEAD>
>> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
>> + pageEncoding="ISO-8859-1"%>
>> +<META http-equiv="Content-Type" content="text/html;
>> charset=ISO-8859-1">
>> +<META name="GENERATOR" content="IBM Software Development Platform">
>> +<TITLE>helloWorld.jsp</TITLE>
>> +</HEAD>
>> +<BODY>
>> +<P>
>> +Hello world - from JSP! With JMS Import!
>> +xxx <%@ page import="javax.jms.*, javax.mystuff.SomeClass" %> <%@
>> page import = "javax.transaction.package" %>xxx
>> +<%@ page import="a.b.AClass" %>
>> +<%@ page import="a.b.AnotherClassInADotB" %>
>> +<%@ page import="java.util.List" %>
>> +
>> +<BR/><BR/>
>> +Here is a random number <%= Math.random() %>
>> +</P>
>> +
>> +<%
>> + JMSException jmsx = new JMSException ("reason");
>> +%>
>> +Here's an exception: <%= jmsx.toString() %>
>> +
>> +</BODY>
>> +</HTML>
>>
>>
>>