Getting a header like this.
If im not mistaking, there is a javax.servlet.http.HttpServletResponse.setHeader(sometype foo) too.
------------------------

import org.apache.axis2.context.MessageContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

MessageContext inMsgCtx = MessageContext.getCurrentMessageContext();
httpServReq = (HttpServletRequest)inMsgCtx.getProperty("transport.http.servletRequest"); httpServResp = (HttpServletResponse)inMsgCtx.getProperty("transport.http.servletResponse");
vHost = httpServReq.getHeader("Host");

Greetings, Joek Hondius


mieke schreef:
I tried the following with out success too

            Hashtable headerTbl = (Hashtable)
_messageContext.getProperty(HTTPConstants.HTTP_HEADERS);

            if (headerTbl == null) {
                headerTbl = new Hashtable();
                _messageContext.setProperty(HTTPConstants.HTTP_HEADERS,
headerTbl);
            }
            headerTbl.put("TEST_HEADER", "TEST_VALUE");



mieke wrote:
I have an old axis2 client with generated stubs that is now required to
pass some additional information in the HTTP Header.  I attempted to
modify the generated stub by adding the following logic to one of the
methods:

Hashtable headerTbl = (Hashtable)
_messageContext.getProperty(HTTPConstants.HEADER_SOAP_ACTION);
            if (headerTbl == null) {
                headerTbl = new Hashtable();
                _messageContext.setProperty(HTTPConstants.REQUEST_HEADERS,
headerTbl);
            }
            headerTbl.put("TEST_NAME", "TEST_VALUE");

This did not work.  Could someone please outline (with an example if
possible) how to add data to the header.

Thanks,

Mieke



Reply via email to