Hi guys,

 

I can't get the Authorization header param in a JAX-RS server.  Is
@HeaderParam the way?

 

I've configured CXF 2.3.1 with Spring 3. My applicationContext.xml has the
following jax-rs server bean:

 

<jaxrs:server id="userServer"
modelRef="classpath:/WEB-INF/model/UserModel.xml" address="/users">

... (logging feature, service bean...)

</jaxrs:server>

 

UserModel.xml config:

 

<model xmlns="http://cxf.apache.org/jaxrs";>

    <resource name=" UserRestService" path="/"
consumesType="application/xml" producesType="application/xml">

        <operation name="getUserByLogin" verb="GET" path="/login">

            <param name="authorization" type="HEADER" />

        </operation>

    </resource>

</model>

 

Finally, the service implementation:

 

public class UserRestService implements IRestService

{

    public ElementWrapper<MobilityUser>
getUserByLogin(@HeaderParam(HttpHeaders.AUTHORIZATION) String authorization)

   {

                // authorization is empty at this point...

   }

}

 

 

I'm sure the Authorization header is sent because i'm also using Spring
Security, which allows the request via Basic Authentication. It doesn't work
if i disable Spring Security.

 

Thanks in advance,

 

Ivan

 

Reply via email to