cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r921156 - in /cxf/branches/2.2.x-fixes: ./ common/common/src/main/java/org/apache/cxf/jaxb/ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/ rt/frontend/jax...
Date Tue, 09 Mar 2010 22:04:55 GMT
Author: sergeyb
Date: Tue Mar  9 22:04:54 2010
New Revision: 921156

URL: http://svn.apache.org/viewvc?rev=921156&view=rev
Log:
Merged revisions 921014 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r921014 | sergeyb | 2010-03-09 17:53:56 +0000 (Tue, 09 Mar 2010) | 1 line
  
  JAXRS : introducing a provider capable of generating and serving the client code
........

Added:
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/
      - copied from r921014, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java
      - copied, changed from r921014, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/
      - copied from r921014, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java
      - copied unchanged from r921014, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/FormInterface.java
      - copied unchanged from r921014, cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/FormInterface.java
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
    cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
    cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar  9 22:04:54 2010
@@ -1 +1 @@
-/cxf/trunk:920741,920752
+/cxf/trunk:920741,920752,921014

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java (original)
+++ cxf/branches/2.2.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java Tue Mar  9 22:04:54 2010
@@ -664,6 +664,45 @@ public final class JAXBUtils {
             throw new JAXBException(ex);
         }
     }
+
+    public static SchemaCompiler createSchemaCompilerWithDefaultAllocator(Set<String> allocatorSet) {
+        
+        try {
+            SchemaCompiler compiler = JAXBUtils.createSchemaCompiler();
+            Object allocator = ReflectionInvokationHandler
+                .createProxyWrapper(new DefaultClassNameAllocator(allocatorSet),
+                                JAXBUtils.getParamClass(compiler, "setClassNameAllocator"));
+
+            compiler.setClassNameAllocator(allocator);
+            return compiler;    
+        } catch (JAXBException e1) {
+            throw new IllegalStateException("Unable to create schema compiler", e1);
+        }
+        
+    }
+    
+    public static void logGeneratedClassNames(Logger logger, JCodeModel codeModel) {
+        if (!logger.isLoggable(Level.INFO)) {
+            return;
+        }
+        
+        StringBuilder sb = new StringBuilder();
+        boolean first = true;
+        for (Iterator<JPackage> itr = codeModel.packages(); itr.hasNext();) {
+            JPackage package1 = itr.next();
+            
+            for (Iterator<JDefinedClass> citr = package1.classes(); citr.hasNext();) {
+                if (!first) {
+                    sb.append(", ");
+                } else {
+                    first = false;
+                }
+                sb.append(citr.next().fullName());
+            }
+        }
+        
+        logger.log(Level.INFO, "Created classes: " + sb.toString());
+    }
     
     public static Object createFileCodeWriter(File f) throws JAXBException {
         try {
@@ -834,6 +873,32 @@ public final class JAXBUtils {
         }
     }
     
+    public static class DefaultClassNameAllocator {
+        private final Set<String> typesClassNames;
+
+        public DefaultClassNameAllocator() {
+            this(new HashSet<String>());
+        }
+        
+        public DefaultClassNameAllocator(Set<String> set) {
+            typesClassNames = set;
+        }
+
+        public String assignClassName(String packageName, String className) {
+            String fullClassName = className;
+            String fullPckClass = packageName + "." + fullClassName;
+            int cnt = 0;
+            while (typesClassNames.contains(fullPckClass)) {
+                cnt++;
+                fullClassName = className + cnt;
+                fullPckClass = packageName + "." + fullClassName;
+            }
+            typesClassNames.add(fullPckClass);
+            return fullClassName;
+        }
+       
+    }
+    
     public static interface SchemaCompiler {
 
         void setErrorListener(Object elForRun);

Modified: cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java (original)
+++ cxf/branches/2.2.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java Tue Mar  9 22:04:54 2010
@@ -34,7 +34,6 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
@@ -258,24 +257,15 @@ public class DynamicClientFactory {
         //all SI's should have the same schemas
         Collection<SchemaInfo> schemas = svc.getServiceInfos().get(0).getSchemas();
 
-        SchemaCompiler compiler;
-        try {
-            compiler = JAXBUtils.createSchemaCompiler();
-        } catch (JAXBException e1) {
-            throw new IllegalStateException("Unable to create schema compiler", e1);
-        }
+        SchemaCompiler compiler = 
+            JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<String>());
+        
         Object elForRun = ReflectionInvokationHandler
             .createProxyWrapper(new InnerErrorListener(wsdlUrl),
                                 JAXBUtils.getParamClass(compiler, "setErrorListener"));
         
         compiler.setErrorListener(elForRun);
         
-        Object allocator = ReflectionInvokationHandler
-            .createProxyWrapper(new ClassNameAllocatorImpl(),
-                                JAXBUtils.getParamClass(compiler, "setClassNameAllocator"));
-
-        compiler.setClassNameAllocator(allocator);
-
         addSchemas(wsdlUrl, schemas, compiler);
         addBindingFiles(bindingFiles, compiler);
         S2JJAXBModel intermediateModel = compiler.bind();
@@ -295,7 +285,7 @@ public class DynamicClientFactory {
             }
             sb.append(jpackage.name());
         }
-        outputDebug(codeModel);
+        JAXBUtils.logGeneratedClassNames(LOG, codeModel);
         
         String packageList = sb.toString();
 
@@ -413,30 +403,6 @@ public class DynamicClientFactory {
         return false;
     }
 
-    private void outputDebug(JCodeModel codeModel) {
-        if (!LOG.isLoggable(Level.INFO)) {
-            return;
-        }
-        
-        StringBuilder sb = new StringBuilder();
-        boolean first = true;
-        for (Iterator<JPackage> itr = codeModel.packages(); itr.hasNext();) {
-            JPackage package1 = itr.next();
-            
-            for (Iterator<JDefinedClass> citr = package1.classes(); citr.hasNext();) {
-                if (!first) {
-                    sb.append(", ");
-                } else {
-                    first = false;
-                }
-                sb.append(citr.next().fullName());
-            }
-        }
-        
-        LOG.log(Level.INFO, "Created classes: " + sb.toString());
-        
-    }
-
     private void addSchemas(String wsdlUrl, Collection<SchemaInfo> schemas, SchemaCompiler compiler) {
         int num = 1;
         for (SchemaInfo schema : schemas) {
@@ -689,26 +655,4 @@ public class DynamicClientFactory {
         this.jaxbContextProperties = jaxbContextProperties;
     }
     
-    
-    
-    public static class ClassNameAllocatorImpl {
-        private final Set<String> typesClassNames = new HashSet<String>();
-
-        public ClassNameAllocatorImpl() {
-        }
-
-        public String assignClassName(String packageName, String className) {
-            String fullClassName = className;
-            String fullPckClass = packageName + "." + fullClassName;
-            int cnt = 0;
-            while (typesClassNames.contains(fullPckClass)) {
-                cnt++;
-                fullClassName = className + cnt;
-                fullPckClass = packageName + "." + fullClassName;
-            }
-            typesClassNames.add(fullPckClass);
-            return fullClassName;
-        }
-       
-    }
 }

Copied: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java (from r921014, cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java)
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java?p2=cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java&p1=cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java&r1=921014&r2=921156&rev=921156&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java Tue Mar  9 22:04:54 2010
@@ -46,7 +46,6 @@ import javax.ws.rs.GET;
 import javax.ws.rs.HEAD;
 import javax.ws.rs.HeaderParam;
 import javax.ws.rs.MatrixParam;
-import javax.ws.rs.OPTIONS;
 import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
@@ -117,7 +116,6 @@ public class CodeGeneratorProvider imple
         HTTP_METHOD_ANNOTATIONS.put("post", POST.class);
         HTTP_METHOD_ANNOTATIONS.put("delete", DELETE.class);
         HTTP_METHOD_ANNOTATIONS.put("head", HEAD.class);
-        HTTP_METHOD_ANNOTATIONS.put("options", OPTIONS.class);
         
         PARAM_ANNOTATIONS = new HashMap<String, Class<?>>();
         PARAM_ANNOTATIONS.put("template", PathParam.class);

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RequestPreprocessor.java Tue Mar  9 22:04:54 2010
@@ -30,10 +30,12 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
 import org.apache.cxf.jaxrs.ext.RequestHandler;
+import org.apache.cxf.jaxrs.ext.codegen.CodeGeneratorProvider;
 import org.apache.cxf.jaxrs.model.ProviderInfo;
 import org.apache.cxf.jaxrs.model.wadl.WadlGenerator;
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
+import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.message.Message;
 
 public class RequestPreprocessor {
@@ -75,7 +77,13 @@ public class RequestPreprocessor {
         MultivaluedMap<String, String> queries = u.getQueryParameters();
         handleTypeQuery(m, queries);
         handleMethod(m, queries, new HttpHeadersImpl(m));
-        checkMetadataRequest(m);
+        Response r = checkMetadataRequest(m);
+        if (r == null) {
+            r = checkCodeRequest(m);
+        }
+        if (r != null) {
+            m.getExchange().put(Response.class, r);
+        }
         return new UriInfoImpl(m, null).getPath();
     }
     
@@ -159,7 +167,7 @@ public class RequestPreprocessor {
      * has been selected are handy. Consider implementing this method as part of the QueryHandler,
      * we will need to save the list of ClassResourceInfos on the EndpointInfo though
      */
-    public void checkMetadataRequest(Message m) {
+    public Response checkMetadataRequest(Message m) {
         String query = (String)m.get(Message.QUERY_STRING);
         if (query != null && query.contains(WadlGenerator.WADL_QUERY)) {
             String requestURI = (String)m.get(Message.REQUEST_URI);
@@ -169,12 +177,29 @@ public class RequestPreprocessor {
                 // this is actually being tested by ProviderFactory unit tests but just in case
                 // WadlGenerator, the custom or default one, must be the first one
                 if (shs.size() > 0 && shs.get(0).getProvider() instanceof WadlGenerator) {
-                    Response r = shs.get(0).getProvider().handleRequest(m, null);
-                    if (r != null) {
-                        m.getExchange().put(Response.class, r);
-                    }    
+                    return shs.get(0).getProvider().handleRequest(m, null);
+                }
+            }
+        }
+        return null;
+    }
+    
+    public Response checkCodeRequest(Message m) {
+        String query = (String)m.get(Message.QUERY_STRING);
+        if (query != null && (query.contains(CodeGeneratorProvider.CODE_QUERY) 
+            || query.contains(CodeGeneratorProvider.SOURCE_QUERY))) {
+            String requestURI = (String)m.get(Message.REQUEST_URI);
+            String baseAddress = HttpUtils.getBaseAddress(m);
+            if (baseAddress.equals(requestURI)) {
+                List<ProviderInfo<RequestHandler>> shs = ProviderFactory.getInstance(m).getRequestHandlers();
+                for (ProviderInfo<RequestHandler> provider : shs) {
+                    if (provider.getProvider() instanceof CodeGeneratorProvider) { 
+                        InjectionUtils.injectContextMethods(provider.getProvider(), provider, m);
+                        return provider.getProvider().handleRequest(m, null);
+                    }
                 }
             }
         }
+        return null;
     }
 }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java Tue Mar  9 22:04:54 2010
@@ -503,6 +503,9 @@ public class UriBuilderImpl extends UriB
             }
             list.add(value.toString());
         }
+        if (list.isEmpty()) {
+            list.add("");
+        }
         return list;
     }
 

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSInInterceptor.java Tue Mar  9 22:04:54 2010
@@ -180,7 +180,7 @@ public class JAXRSInInterceptor extends 
                 
             }
             InjectionUtils.injectContextFields(sh.getProvider(), sh, message);
-            InjectionUtils.injectContextFields(sh.getProvider(), sh, message);
+            InjectionUtils.injectContextMethods(sh.getProvider(), sh, message);
             Response response = sh.getProvider().handleRequest(message, resource);
             if (response != null) {
                 message.getExchange().put(Response.class, response);

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java Tue Mar  9 22:04:54 2010
@@ -62,6 +62,7 @@ import org.w3c.dom.Node;
 
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.common.util.ReflectionInvokationHandler;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.util.XmlSchemaPrimitiveUtils;
@@ -113,6 +114,7 @@ public class WadlGenerator implements Re
     private boolean ignoreMessageWriters = true;
     private boolean singleResourceMultipleMethods = true;
     private boolean useSingleSlashResource;
+    private boolean addResourceAndMethodIds;
     
     private boolean useJaxbContextForQnames = true;
     
@@ -122,6 +124,24 @@ public class WadlGenerator implements Re
     private ElementQNameResolver resolver;
     private List<String> privateAddresses;
     
+    public WadlGenerator() {
+        
+    }
+    
+    public WadlGenerator(WadlGenerator other) {
+        this.wadlNamespace = other.wadlNamespace;
+        this.externalQnamesMap = other.externalQnamesMap;
+        this.externalSchemaLinks = other.externalSchemaLinks;
+        this.externalSchemasCache = other.externalSchemasCache;
+        this.ignoreMessageWriters = other.ignoreMessageWriters;
+        this.privateAddresses = other.privateAddresses;
+        this.resolver = other.resolver;
+        this.addResourceAndMethodIds = other.addResourceAndMethodIds;
+        this.singleResourceMultipleMethods = other.singleResourceMultipleMethods;
+        this.useJaxbContextForQnames = other.useJaxbContextForQnames;
+        this.useSingleSlashResource = other.useSingleSlashResource;
+    }
+    
     public Response handleRequest(Message m, ClassResourceInfo resource) {
         
         if (!"GET".equals(m.get(Message.HTTP_REQUEST_METHOD))) {
@@ -159,8 +179,7 @@ public class WadlGenerator implements Re
         Map<Class<?>, QName> clsMap = new IdentityHashMap<Class<?>, QName>();
         Set<ClassResourceInfo> visitedResources = new HashSet<ClassResourceInfo>();
         for (ClassResourceInfo cri : cris) {
-            String path = cri.getURITemplate().getValue();
-            sbResources.append("<resource path=\"").append(path).append("\">");
+            startResourceTag(sbResources, cri.getServiceClass(), cri.getURITemplate().getValue());
             handleDocs(cri.getServiceClass().getAnnotations(), sbResources);
             handleResource(sbResources, allTypes, qnameResolver, clsMap, cri, visitedResources);
             sbResources.append("</resource>");
@@ -218,8 +237,7 @@ public class WadlGenerator implements Re
                 Class<?> cls = ori.getMethodToInvoke().getReturnType();
                 ClassResourceInfo subcri = cri.findResource(cls, cls);
                 if (subcri != null && !visitedResources.contains(subcri)) {
-                    String path = ori.getURITemplate().getValue();
-                    sb.append("<resource path=\"").append(path).append("\">");
+                    startResourceTag(sb, subcri.getServiceClass(), ori.getURITemplate().getValue());
                     handleDocs(subcri.getServiceClass().getAnnotations(), sb);
                     handlePathAndMatrixParams(sb, ori);
                     handleResource(sb, jaxbTypes, qnameResolver, clsMap, subcri, 
@@ -236,6 +254,30 @@ public class WadlGenerator implements Re
         }
     }
     
+    private void startResourceTag(StringBuilder sb, Class<?> serviceClass, String path) {
+        sb.append("<resource path=\"").append(path).append("\"");
+        if (addResourceAndMethodIds) {
+            QName jaxbQname = null;
+            if (useJaxbContextForQnames) {
+                jaxbQname = getJaxbQName(null, serviceClass, new HashMap<Class<?>, QName>(0));
+            }
+            String pName = jaxbQname == null ? PackageUtils.getPackageName(serviceClass) 
+                : jaxbQname.getNamespaceURI();
+            String localName = jaxbQname == null ? serviceClass.getSimpleName() 
+                : jaxbQname.getLocalPart();
+            sb.append(" id=\"").append("{" + pName + "}" + localName).append("\"");
+        }
+        sb.append(">");
+    }
+    
+    private void startMethodTag(StringBuilder sb, OperationResourceInfo ori) {
+        sb.append("<method name=\"").append(ori.getHttpMethod()).append("\"");
+        if (addResourceAndMethodIds) {
+            sb.append(" id=\"").append(ori.getMethodToInvoke().getName()).append("\"");
+        }
+        sb.append(">");
+    }
+    
     //CHECKSTYLE:OFF
     private boolean handleOperation(StringBuilder sb, Set<Class<?>> jaxbTypes, 
                                  ElementQNameResolver qnameResolver, 
@@ -263,7 +305,7 @@ public class WadlGenerator implements Re
             handlePathAndMatrixParams(sb, ori);
         }
         
-        sb.append("<method name=\"").append(ori.getHttpMethod()).append("\">");
+        startMethodTag(sb, ori);
         handleDocs(ori.getAnnotatedMethod().getAnnotations(), sb);
         if (ori.getMethodToInvoke().getParameterTypes().length != 0) {
             sb.append("<request>");
@@ -342,7 +384,8 @@ public class WadlGenerator implements Re
         } else {
             sb.append("<!-- Dynamic subresource -->");    
         }
-        sb.append("<resource path=\"").append(ori.getURITemplate().getValue()).append("\">");
+        startResourceTag(sb, subcri != null ? subcri.getServiceClass() : Object.class, 
+            ori.getURITemplate().getValue());
         handlePathAndMatrixParams(sb, ori);
         sb.append("</resource>");
     }
@@ -483,7 +526,7 @@ public class WadlGenerator implements Re
                 URITemplate ut1 = op1.getURITemplate();
                 URITemplate ut2 = op2.getURITemplate();
                 int result = ut1.getValue().compareTo(ut2.getValue());
-                if (result == 0) {
+                if (result == 0 && !(sub1 && sub2)) {
                     result = op1.getHttpMethod().compareTo(op2.getHttpMethod());
                 }
                 return result;
@@ -1004,7 +1047,7 @@ public class WadlGenerator implements Re
                 name = type.getAnnotation(XMLName.class);
             }
             if (name != null) {
-                QName qname = convertStringToQName(name.value(), name.prefix());
+                QName qname = JAXRSUtils.convertStringToQName(name.value(), name.prefix());
                 if (qname.getPrefix().length() > 0) {
                     return qname;
                 } else {
@@ -1043,21 +1086,6 @@ public class WadlGenerator implements Re
         
     }
     
-    private QName convertStringToQName(String name, String prefix) {
-        int ind1 = name.indexOf('{');
-        if (ind1 != 0) {
-            return null;
-        }
-        
-        int ind2 = name.indexOf('}');
-        if (ind2 <= ind1 + 1 || ind2 >= name.length() - 1) {
-            return null;
-        }
-        String ns = name.substring(ind1 + 1, ind2);
-        String localName = name.substring(ind2 + 1);
-        return new QName(ns, localName, prefix);
-    }
-
     public void setResolver(ElementQNameResolver resolver) {
         this.resolver = resolver;
     }
@@ -1074,6 +1102,10 @@ public class WadlGenerator implements Re
         return MessageUtils.isTrue(m.getContextualProperty("org.apache.cxf.endpoint.private")); 
     }
     
+    public void setAddResourceAndMethodIds(boolean addResourceAndMethodIds) {
+        this.addResourceAndMethodIds = addResourceAndMethodIds;
+    }
+
     private static class SchemaConverter extends DelegatingXMLStreamWriter {
         private static final String SCHEMA_LOCATION = "schemaLocation";
         private Map<String, String> locsMap;    

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Tue Mar  9 22:04:54 2010
@@ -164,13 +164,13 @@ public abstract class AbstractJAXBProvid
         if (jaxbElementClassNames != null && jaxbElementClassNames.contains(cls.getName()) 
             || jaxbElementClassMap != null && jaxbElementClassMap.containsKey(cls.getName())) {
             if (jaxbElementClassMap != null) {
-                name = convertStringToQName(jaxbElementClassMap.get(cls.getName()));
+                name = JAXRSUtils.convertStringToQName(jaxbElementClassMap.get(cls.getName()));
             } else {
                 name = getJaxbQName(cls, genericType, obj, false);
             }
         }
         if (name == null && marshalAsJaxbElement) {
-            name = convertStringToQName(cls.getSimpleName());
+            name = JAXRSUtils.convertStringToQName(cls.getSimpleName());
         }
         if (name != null) {
             return new JAXBElement(name, cls, null, obj);
@@ -221,22 +221,7 @@ public abstract class AbstractJAXBProvid
             return getJaxbQName(cls, type, object, pluralName);
         }
             
-        return convertStringToQName(name);
-    }
-    
-    protected static QName convertStringToQName(String name) {
-        int ind1 = name.indexOf('{');
-        if (ind1 != 0) {
-            return new QName(name);
-        }
-        
-        int ind2 = name.indexOf('}');
-        if (ind2 <= ind1 + 1 || ind2 >= name.length() - 1) {
-            return null;
-        }
-        String ns = name.substring(ind1 + 1, ind2);
-        String localName = name.substring(ind2 + 1);
-        return new QName(ns, localName);
+        return JAXRSUtils.convertStringToQName(name);
     }
     
     private String getCollectionWrapperName(Class<?> cls) {
@@ -591,7 +576,7 @@ public abstract class AbstractJAXBProvid
         if (dropEls != null) {
             dropElements = new LinkedHashSet<QName>(dropEls.size());
             for (String val : dropEls) {
-                dropElements.add(convertStringToQName(val));
+                dropElements.add(JAXRSUtils.convertStringToQName(val));
             }
         }
         return dropElements;
@@ -634,8 +619,8 @@ public abstract class AbstractJAXBProvid
                                              Map<String, String> nsMap) {
         if (map != null) {
             for (Map.Entry<String, String> entry : map.entrySet()) {
-                QName lname = convertStringToQName(entry.getKey());
-                QName rname = convertStringToQName(entry.getValue());
+                QName lname = JAXRSUtils.convertStringToQName(entry.getKey());
+                QName rname = JAXRSUtils.convertStringToQName(entry.getValue());
                 elementsMap.put(lname, rname);
                 if (nsMap != null) {
                     nsMap.put(lname.getNamespaceURI(), rname.getNamespaceURI());
@@ -648,8 +633,8 @@ public abstract class AbstractJAXBProvid
                                                Map<QName, QName> elementsMap) {
         if (map != null) {
             for (Map.Entry<String, String> entry : map.entrySet()) {
-                QName lname = convertStringToQName(entry.getKey());
-                QName rname = convertStringToQName(entry.getValue());
+                QName lname = JAXRSUtils.convertStringToQName(entry.getKey());
+                QName rname = JAXRSUtils.convertStringToQName(entry.getValue());
                 elementsMap.put(lname, rname);
             }
         }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Tue Mar  9 22:04:54 2010
@@ -1160,5 +1160,23 @@ public final class JAXRSUtils {
         }
         return new QName(nsURI, type.getSimpleName(), "ns1"); 
     }
+
+    public static QName convertStringToQName(String name) {
+        return convertStringToQName(name, "");
+    }
     
+    public static QName convertStringToQName(String name, String prefix) {
+        int ind1 = name.indexOf('{');
+        if (ind1 != 0) {
+            return new QName(name);
+        }
+        
+        int ind2 = name.indexOf('}');
+        if (ind2 <= ind1 + 1 || ind2 >= name.length() - 1) {
+            return null;
+        }
+        String ns = name.substring(ind1 + 1, ind2);
+        String localName = name.substring(ind2 + 1);
+        return new QName(ns, localName, prefix);
+    }
 }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java Tue Mar  9 22:04:54 2010
@@ -150,6 +150,20 @@ public class UriBuilderImplTest extends 
     }
     
     @Test
+    public void testQueryWithNoValue() throws Exception {
+        URI uri = new URI("http://bar");
+        URI newUri = new UriBuilderImpl(uri).queryParam("q").build();   
+        assertEquals("URI is not built correctly", "http://bar?q", newUri.toString());
+    }
+    
+    @Test
+    public void testMatrixWithNoValue() throws Exception {
+        URI uri = new URI("http://bar/foo");
+        URI newUri = new UriBuilderImpl(uri).matrixParam("q").build();   
+        assertEquals("URI is not built correctly", "http://bar/foo;q", newUri.toString());
+    }
+    
+    @Test
     public void testSchemeSpecificPart() throws Exception {
         URI uri = new URI("http://bar");
         URI newUri = new UriBuilderImpl(uri).scheme("https").schemeSpecificPart("//localhost:8080/foo/bar")

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java Tue Mar  9 22:04:54 2010
@@ -102,6 +102,11 @@ public class BookStore {
         return new Chapter(1);
     }
     
+    @Path("form")
+    public FormInterface getForm() {
+        return new Book(1);
+    }
+    
     @Path("itself")
     public BookStore getItself() {
         return this;

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java Tue Mar  9 22:04:54 2010
@@ -329,13 +329,14 @@ public class WadlGeneratorTest extends A
         
         List<Element> resourceEls = DOMUtils.getChildrenWithName(resource, 
                                          WadlGenerator.WADL_NS, "resource");
-        assertEquals(6, resourceEls.size());        
+        assertEquals(7, resourceEls.size());        
         assertEquals("/book2", resourceEls.get(0).getAttribute("path"));
         assertEquals("/books/{bookid}", resourceEls.get(1).getAttribute("path"));
         assertEquals("/chapter", resourceEls.get(2).getAttribute("path"));
         assertEquals("/books/{bookid}", resourceEls.get(3).getAttribute("path"));
         assertEquals("/booksubresource", resourceEls.get(4).getAttribute("path"));
-        assertEquals("/itself", resourceEls.get(5).getAttribute("path"));
+        assertEquals("/form", resourceEls.get(5).getAttribute("path"));
+        assertEquals("/itself", resourceEls.get(6).getAttribute("path"));
         
         // verify root resource starting with "/"
         // must have a single template parameter

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/jaxb/Book.java Tue Mar  9 22:04:54 2010
@@ -18,9 +18,7 @@
  */
 package org.apache.cxf.jaxrs.model.wadl.jaxb;
 
-import javax.ws.rs.FormParam;
 import javax.ws.rs.GET;
-import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
@@ -31,12 +29,13 @@ import javax.xml.bind.annotation.XmlType
 
 import org.apache.cxf.jaxrs.ext.Description;
 import org.apache.cxf.jaxrs.ext.xml.XMLName;
+import org.apache.cxf.jaxrs.model.wadl.FormInterface;
 
 @XmlRootElement(name = "thebook", namespace = "http://superbooks")
 @XmlType(name = "book", namespace = "http://superbooks")
 @Description("Book subresource")
 @XMLName(value = "{http://books}thesuperbook", prefix = "p1")
-public class Book {
+public class Book implements FormInterface {
 
     private int id;
     @XmlElement(name = "thechapter", namespace = "http://superbooks")
@@ -70,14 +69,10 @@ public class Book {
         return chapter;
     }
     
-    @Path("/form1")
-    @POST
     public void form1(MultivaluedMap map) {
     }
     
-    @Path("/form2")
-    @POST
-    public void form2(@FormParam("field1") String f1, @FormParam("field2") String f2) {
+    public void form2(String f1, String f2) {
     }
     
 }

Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java Tue Mar  9 22:04:54 2010
@@ -21,23 +21,39 @@ package org.apache.cxf.systest.jaxrs;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.Socket;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.URLClassLoader;
 import java.net.URLConnection;
+import java.util.Collections;
 import java.util.List;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.ext.codegen.CodeGeneratorProvider;
+import org.apache.cxf.jaxrs.ext.xml.XMLSource;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.model.wadl.WadlGenerator;
+import org.apache.cxf.jaxrs.utils.ResourceUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.transport.http.HTTPConduit;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -74,7 +90,70 @@ public class JAXRSClientServerResourceCr
                                                          "http://localhost:9080/webapp/petstore", 1);
         checkPetStoreInfo(resourceEls.get(0));
     }
+    
+    @Test
+    public void testPetStoreSource() throws Exception {
+        try {
+            WebClient wc = WebClient.create("http://localhost:9080/webapp/petstore");
+            HTTPConduit conduit = WebClient.getConfig(wc).getHttpConduit();
+            conduit.getClient().setReceiveTimeout(1000000);
+            conduit.getClient().setConnectionTimeout(1000000);
+            XMLSource source = wc.query("_code", "").query("_os", getOs()).get(XMLSource.class);
+            String link = source.getValue("ns:html/ns:body/ns:ul/ns:a/@href", 
+                                          Collections.singletonMap("ns", "http://www.w3.org/1999/xhtml"));
+            WebClient wc2 = WebClient.create(link);
+            HTTPConduit conduit2 = WebClient.getConfig(wc2).getHttpConduit();
+            conduit2.getClient().setReceiveTimeout(1000000);
+            conduit2.getClient().setConnectionTimeout(1000000);
+            InputStream is = wc2.accept("application/zip").get(InputStream.class);
+            String tmpdir = System.getProperty("java.io.tmpdir");
+            File classes = new File(tmpdir, "cxf-jaxrs-test-compiled-src");
+            if (!classes.mkdir()) {
+                fail();
+            }
+            File unzippedSrc = new File(tmpdir, "cxf-jaxrs-test-unzipped-src");
+            if (!unzippedSrc.mkdir()) {
+                fail();
+            }
+            try {             
+                compileSrc(classes, unzippedSrc, is);
+                verifyClasses(classes);
+            } finally {
+                FileUtils.removeDir(classes);
+                FileUtils.removeDir(unzippedSrc);
+            }
+        } finally {
+            ClassResourceInfo cri = 
+                ResourceUtils.createClassResourceInfo(PetStore.class, PetStore.class, true, true);
+            new CodeGeneratorProvider().removeCode(cri);
+        }
+    }
  
+    private void verifyClasses(File classesDir) {
+        List<File> clsFiles = FileUtils.getFilesRecurse(classesDir, ".+\\.class$");
+        assertEquals(1, clsFiles.size());
+        assertTrue(checkContains(clsFiles, "org.apache.cxf.systest.jaxrs.PetStore.class"));
+    }
+    
+    private boolean checkContains(List<File> clsFiles, String name) {
+        
+        for (File f : clsFiles) {
+            if (f.getAbsolutePath().replace(getPathSep(), ".").endsWith(name)) {
+                return true;
+            }
+        }
+        return false;
+    }
+    
+    private String getPathSep() {
+        String os = System.getProperty("os.name");
+        if (os.toLowerCase().contains("win")) {
+            return "\\";
+        } else {
+            return "/";
+        }
+    }
+    
     private void checkBookStoreInfo(Element resource) {
         assertEquals("/bookstore", resource.getAttribute("path"));
     }
@@ -221,4 +300,146 @@ public class JAXRSClientServerResourceCr
         return IOUtils.toString(in);
     }
 
+    private void compileSrc(File classes, File unzippedSrc, InputStream zipFile) throws Exception {
+        unzip(zipFile, unzippedSrc);
+        StringBuilder classPath = new StringBuilder();
+        try {
+            setupClasspath(classPath, this.getClass().getClassLoader());
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+        
+        List<File> srcFiles = FileUtils.getFilesRecurse(unzippedSrc, ".+\\.java$"); 
+        if (!compileJavaSrc(classPath.toString(), srcFiles, classes.toString())) {
+            fail("Could not compile classes");
+        }
+    }
+
+    private void unzip(InputStream fin, File unzippedSrc) throws Exception {
+        ZipInputStream zin = new ZipInputStream(fin);
+        ZipEntry ze = null;
+        while ((ze = zin.getNextEntry()) != null) {
+            String entryName = ze.getName();
+            int index = entryName.lastIndexOf(System.getProperty("file.separator"));
+            File packageDir = new File(unzippedSrc, entryName.substring(0, index));
+            packageDir.mkdirs();
+            FileOutputStream fout = new FileOutputStream(
+                                        new File(packageDir, entryName.substring(index + 1)));
+            for (int c = zin.read(); c != -1; c = zin.read()) {
+                fout.write(c);
+            }
+            zin.closeEntry();
+            fout.close();
+        }
+        zin.close();
+    }
+    
+    protected boolean compileJavaSrc(String classPath, List<File> srcList, String dest) {
+        String[] javacCommand = new String[srcList.size() + 7];
+        
+        javacCommand[0] = "javac";
+        javacCommand[1] = "-classpath";
+        javacCommand[2] = classPath;        
+        javacCommand[3] = "-d";
+        javacCommand[4] = dest;
+        javacCommand[5] = "-target";
+        javacCommand[6] = "1.5";
+        
+        int i = 7;
+        for (File f : srcList) {
+            javacCommand[i++] = f.getAbsolutePath();            
+        }
+        org.apache.cxf.common.util.Compiler javaCompiler 
+            = new org.apache.cxf.common.util.Compiler();
+        
+        return javaCompiler.internalCompile(javacCommand, 7); 
+    }
+    
+    static void setupClasspath(StringBuilder classPath, ClassLoader classLoader)
+        throws URISyntaxException, IOException {
+        
+        ClassLoader scl = ClassLoader.getSystemClassLoader();        
+        ClassLoader tcl = classLoader;
+        do {
+            if (tcl instanceof URLClassLoader) {
+                URL[] urls = ((URLClassLoader)tcl).getURLs();
+                if (urls == null) {
+                    urls = new URL[0];
+                }
+                for (URL url : urls) {
+                    if (url.getProtocol().startsWith("file")) {
+                        File file;
+                        if (url.toURI().getPath() == null) {
+                            continue;
+                        }
+                        try { 
+                            file = new File(url.toURI().getPath()); 
+                        } catch (URISyntaxException urise) { 
+                            if (url.getPath() == null) {
+                                continue;
+                            }
+                            file = new File(url.getPath()); 
+                        } 
+    
+                        if (file.exists()) { 
+                            classPath.append(file.getAbsolutePath()) 
+                                .append(System 
+                                        .getProperty("path.separator")); 
+    
+                            if (file.getName().endsWith(".jar")) { 
+                                addClasspathFromManifest(classPath, file); 
+                            }                         
+                        }     
+                    }
+                }
+            }
+            tcl = tcl.getParent();
+            if (null == tcl) {
+                break;
+            }
+        } while(!tcl.equals(scl.getParent()));
+    }
+
+    static void addClasspathFromManifest(StringBuilder classPath, File file) 
+        throws URISyntaxException, IOException {
+        
+        JarFile jar = new JarFile(file);
+        Attributes attr = null;
+        if (jar.getManifest() != null) {
+            attr = jar.getManifest().getMainAttributes();
+        }
+        if (attr != null) {
+            String cp = attr.getValue("Class-Path");
+            while (cp != null) {
+                String fileName = cp;
+                int idx = fileName.indexOf(' ');
+                if (idx != -1) {
+                    fileName = fileName.substring(0, idx);
+                    cp =  cp.substring(idx + 1).trim();
+                } else {
+                    cp = null;
+                }
+                URI uri = new URI(fileName);
+                File f2;
+                if (uri.isAbsolute()) {
+                    f2 = new File(uri);
+                } else {
+                    f2 = new File(file, fileName);
+                }
+                if (f2.exists()) {
+                    classPath.append(f2.getAbsolutePath());
+                    classPath.append(System.getProperty("path.separator"));
+                }
+            }
+        }         
+    }
+    
+    private String getOs() {
+        String os = System.getProperty("os.name");
+        if (os.toLowerCase().contains("win")) {
+            return "win";
+        } else {
+            return "unix";
+        }
+    }
 }

Modified: cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml?rev=921156&r1=921155&r2=921156&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml (original)
+++ cxf/branches/2.2.x-fixes/systests/jaxrs/src/test/resources/jaxrs_spring_providers/WEB-INF/beans.xml Tue Mar  9 22:04:54 2010
@@ -34,6 +34,7 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
         </jaxrs:serviceBeans>
         <jaxrs:providers>
             <bean class="org.apache.cxf.systest.jaxrs.BadgerFishProvider"/>
+            <bean class="org.apache.cxf.jaxrs.ext.codegen.CodeGeneratorProvider"/>
             <ref bean="exceptionMapper"/>
             <ref bean="exceptionMapper2"/>
         </jaxrs:providers>



Mime
View raw message