cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gabo Manuel (JIRA)" <>
Subject [jira] Created: (CXF-2045) Custom headers lost when using Cxf Interceptors
Date Tue, 17 Feb 2009 11:29:03 GMT
Custom headers lost when using Cxf Interceptors

                 Key: CXF-2045
             Project: CXF
          Issue Type: Bug
          Components: Core, REST
    Affects Versions: 2.2
         Environment: Java 1.5
Jetty 6.1
            Reporter: Gabo Manuel

All changes to the header through the Message object in the out interceptor are not received
by client.

public class RetestRestServer {
    String basepath = "/someValue";
    int port = 8080;

    protected RetestRestServer() throws Exception {
        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
            new SingletonResourceProvider(new AccountService()));
        List<Interceptor> out = new ArrayList<Interceptor>(1);
        in.add(new RestOutHandler());

    public static void main(String args[]) throws Exception {
        new RetestRestServer();
        System.out.println("Server ready...");

public class RestOutHandler extends AbstractPhaseInterceptor<Message>{
	private static Logger logger = Logger.getLogger(RestOutHandler.class);
	public RestOutHandler() {
	public void handleMessage(Message message) throws Fault {
		Map<String, List<String>> responseHeaders = (Map<String, List<String>>)message.get(Message.PROTOCOL_HEADERS);
		if (responseHeaders == null) {
			responseHeaders = new HashMap<String, List<String>>();
			message.put(Message.PROTOCOL_HEADERS, responseHeaders);
		responseHeaders.put("header1", Arrays.asList(new String[]{"headerValue"}));
		logger.debug("out message headers: " + responseHeaders);

@WebService(serviceName="AccountService", portName="AccountServicePort")
public class AccountService{
    private static Logger logger = Logger.getLogger(AccountService.class);
    public String getAccount(
            long serialNumber) {"get Account received: " + serialNumber);
        return "get Account received: " + serialNumber;

Please advise if more info is needed.

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

View raw message