cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1533584 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSISchemaLocation.java rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
Date Fri, 18 Oct 2013 18:34:41 GMT
Author: sergeyb
Date: Fri Oct 18 18:34:41 2013
New Revision: 1533584

URL: http://svn.apache.org/r1533584
Log:
Merged revisions 1533582 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1533582 | sergeyb | 2013-10-18 19:26:01 +0100 (Fri, 18 Oct 2013) | 1 line
  
  [CXF-5342] Making it possible to pass relative XSI locations
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSISchemaLocation.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1533582

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

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSISchemaLocation.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSISchemaLocation.java?rev=1533584&r1=1533583&r2=1533584&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSISchemaLocation.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XSISchemaLocation.java
Fri Oct 18 18:34:41 2013
@@ -31,9 +31,17 @@ import java.lang.annotation.Target;
 @Retention(RetentionPolicy.RUNTIME)
 public @interface XSISchemaLocation {
     /**
-     * schema location relative to a base URI of the web application
+     * Schema location 
+     * By default it is assumed to be relative to a base URI of the web application
      */
     String value();
+    
+    /**
+     * If the location is relative and this property is set to true then 
+     * the location will be resolved against the base URI of the web application
+     */
+    boolean resolve() default true;
+    
     /**
      * Can be used to get xsi:noNamespaceSchemaLocation produced.
      * By default, xsi:schemaLocation will be set.

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=1533584&r1=1533583&r2=1533584&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
Fri Oct 18 18:34:41 2013
@@ -433,7 +433,7 @@ public class JAXBElementProvider<T> exte
                 if (relRef.endsWith("'")) {
                     relRef = relRef.substring(0, relRef.length() - 1);
                 }
-                String absRef = buildAbsoluteXMLResourceURI(relRef);
+                String absRef = resolveXMLResourceURI(relRef);
                 value = value.substring(0, ind + 6) + absRef + "'?>";
             }
             setXmlPiProperty(ms, value);
@@ -443,14 +443,14 @@ public class JAXBElementProvider<T> exte
     private void addSchemaLocation(Marshaller ms, Annotation[] anns) throws Exception {
         XSISchemaLocation sl = AnnotationUtils.getAnnotation(anns, XSISchemaLocation.class);
         if (sl != null) {
-            String value = buildAbsoluteXMLResourceURI(sl.value());
+            String value = sl.resolve() ? resolveXMLResourceURI(sl.value()) : sl.value();
             String propName = !sl.noNamespace() 
                 ? Marshaller.JAXB_SCHEMA_LOCATION : Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION;
             ms.setProperty(propName, value);
         }
     }
     
-    private String buildAbsoluteXMLResourceURI(String path) {
+    protected String resolveXMLResourceURI(String path) {
         MessageContext mc = getContext();
         if (mc != null) {
             String httpBasePath = (String)mc.get("http.base.path");



Mime
View raw message