You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Corey Puffalt (JIRA)" <ji...@apache.org> on 2007/09/27 18:20:50 UTC

[jira] Created: (CXF-1072) CXFServlet can't be configured without using Spring.

CXFServlet can't be configured without using Spring.
----------------------------------------------------

                 Key: CXF-1072
                 URL: https://issues.apache.org/jira/browse/CXF-1072
             Project: CXF
          Issue Type: Bug
          Components: Configuration
    Affects Versions: 2.0.1
         Environment: Tomcat v5.5.17
            Reporter: Corey Puffalt


CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

willem Jiang updated CXF-1072:
------------------------------

    Comment: was deleted

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>            Assignee: willem Jiang
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "Damien B (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538362 ] 

Damien B commented on CXF-1072:
-------------------------------

Even when removing the Spring dependency-hardcoding, the CXFServlet is doomed to fail: servletTransportFactory is instanciated after the creation of the ServletController, which always leads to a NPE.

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

willem Jiang reassigned CXF-1072:
---------------------------------

    Assignee: willem Jiang

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>            Assignee: willem Jiang
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "Damien B (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540643 ] 

Damien B commented on CXF-1072:
-------------------------------

My changes to make it work with the simple example (http://cwiki.apache.org/CXF20DOC/servlet-transport.html :: Publishing an endpoint with the API).
I'm quite sure it's not the right way to do it, but here it is:


-----8<---------------
org/apache/cxf/transport/http/WSDLQueryHandler.java 

@@ -277,10 +277,10 @@
     }

     public boolean isRecognizedQuery(String baseUri, String ctx, EndpointInfo endpointInfo) {
-        return isRecognizedQuery(baseUri, ctx, endpointInfo, false);
+        return isRecognizedQuery(baseUri, ctx, endpointInfo, true);
     }

-----8<---------------
org.apache.cxf.transport.servlet.CXFServlet.java

diff too big: have to remove the dependency toward Spring, and fix some ordering see attached file


-----8<---------------
org.apache.cxf.transport.servlet.ServletTransportFactory

@@ -24,6 +23,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -43,6 +43,16 @@
     private Map<String, ServletDestination> destinations =
         new ConcurrentHashMap<String, ServletDestination>();

+    /**
+     * This constant holds the prefixes served by this factory.
+     */
+    private static final Set<String> URI_PREFIXES = new HashSet<String>();
+    static {
+        URI_PREFIXES.add("http://");
+        URI_PREFIXES.add("https://");
+        URI_PREFIXES.add("/");
+    }
+
     public ServletTransportFactory(Bus b) {
         super.setBus(b);
         List<String> ids = Arrays.asList(new String[] {
@@ -111,5 +121,8 @@
         return Collections.unmodifiableSet(destinations.keySet());
     }

-
+    @Override
+    public Set<String> getUriPrefixes() {
+        return URI_PREFIXES;
+    }
 }

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>            Assignee: willem Jiang
>         Attachments: CXFServlet.java
>
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

willem Jiang resolved CXF-1072.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.3

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>            Assignee: willem Jiang
>             Fix For: 2.0.3
>
>         Attachments: CXFServlet.java
>
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "Damien B (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Damien B updated CXF-1072:
--------------------------

    Attachment: CXFServlet.java

Formatted with CXFCodeFormatter.xml v2.0.2

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>            Assignee: willem Jiang
>         Attachments: CXFServlet.java
>
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539005 ] 

willem Jiang commented on CXF-1072:
-----------------------------------

Now you could use CXFNonSpringServlet to use Servlet transport without Spring support.
Here a systest which show how to use it.
https://svn.apache.org/repos/asf/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/NoSpringServletServer.java


> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>            Assignee: willem Jiang
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538412 ] 

willem Jiang commented on CXF-1072:
-----------------------------------

You need to put a file named with bus-extensions.xml  in to the trunk\rt\transports\http\src\main\resources\META-INF to let the CXF ExtensionManagerBus instantiate the ServletTransportFactory for you.
Here is an example for you.
https://svn.apache.org/repos/asf/incubator/cxf/trunk/rt/transports/http-jetty/src/main/resources/META-INF/bus-extensions.xml

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1072) CXFServlet can't be configured without using Spring.

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540652 ] 

willem Jiang commented on CXF-1072:
-----------------------------------

Hi Damien,
I can't apply your change into the trunk, since we still need to support Spring context in CXFServlet.

BTW, you can try out the CXFNonSpringServlet for using CXF in Web container without Spring.

Willem.

> CXFServlet can't be configured without using Spring.
> ----------------------------------------------------
>
>                 Key: CXF-1072
>                 URL: https://issues.apache.org/jira/browse/CXF-1072
>             Project: CXF
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 2.0.1
>         Environment: Tomcat v5.5.17
>            Reporter: Corey Puffalt
>            Assignee: willem Jiang
>             Fix For: 2.0.3
>
>         Attachments: CXFServlet.java
>
>
> CXFServlet appears to be designed to allow configuration without using Spring via the loadBusNoConfig() method called from init() but although reflection is used to test for the existence of the Spring ApplicationContext class, elsewhere in the code there is an instance variable of type ApplicationContext (and other spring types.)  This means it's impossible to instantiate CXFServlet without Spring on the classpath and if you add Spring to the classpath so you can instantiate CXFServlet then it will only attempt to configure itself via Spring.  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.