Announcement Announcement Module
No announcement yet.
Cxf jax-rs Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cxf jax-rs

    Not sure if this is the right server for this but I am having a problem with configuring WS Security with cxf. I have the following crx-config.xml

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterce ptor"/>
    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterc eptor"/>

    <bean id="myPasswordCallback"
    class=" s.ServerPasswordCallback"/>

    <jaxrs:server id="helloworldrs" address="/">

    <ref bean="logInbound"/>
    <bean class=" erceptor">
    <entry key="action" value="UsernameToken" />
    <entry key="passwordType" value="PasswordText" />
    <entry key="passwordCallbackRef"><ref bean="myPasswordCallback"/></entry>

    <ref bean="logOutbound"/>
    <ref bean="membershipSession" />

    password callback file looks like

    public class ServerPasswordCallback implements CallbackHandler {

    private static final String BUNDLE_LOCATION = "";
    private static final String PASSWORD_PROPERTY_NAME = "auth.manager.password";

    private static String password;
    static {
    //final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_LOCATION);
    //password = bundle.getString(PASSWORD_PROPERTY_NAME);

    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

    WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];

    if (pc.getIdentifer().equals("joe") ) {
    if (!pc.getPassword().equals("password")) {
    throw new IOException("wrong password");



    now I am getting a class cast exception java.lang.ClassCastException: org.apache.cxf.message.XMLMessage which I suspect it's because I need a different config for Restful web services. So can someone please help me with this driving me crazy. I don't see any examples for rest config. Also I was wondering with Spring 3.0 support for rest is it even worth while to use CXF or should I just use spring.