You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "kumaran venkatesan (JIRA)" <ji...@apache.org> on 2008/01/14 06:42:34 UTC

[jira] Created: (SYNAPSE-224) Not able to get the http header information in the custom mediators using the Message Context object

Not able to get the http header information in the custom mediators using the Message Context object
----------------------------------------------------------------------------------------------------

                 Key: SYNAPSE-224
                 URL: https://issues.apache.org/jira/browse/SYNAPSE-224
             Project: Synapse
          Issue Type: Bug
          Components: Extension Mediators
            Reporter: kumaran venkatesan


When i tried to extract the header information through the message context object in the custom mediator giving null pointer exception.

public class SessionMediator implements Mediator {

    private static final Log log = LogFactory.getLog(DiscountQuoteMediator.class);

    public SessionMediator(){}

    public boolean mediate(MessageContext mc) {
    	
    	Axis2MessageContext axis2mc = (Axis2MessageContext)mc;
    	org.apache.axis2.context.MessageContext axis2MessageCtx =  axis2mc.getAxis2MessageContext(); 
        System.out.println("User Agent : " +axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT));
              
       return true;
    }

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


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


[jira] Commented: (SYNAPSE-224) Not able to get the http header information in the custom mediators using the Message Context object

Posted by "kumaran venkatesan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SYNAPSE-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558534#action_12558534 ] 

kumaran venkatesan commented on SYNAPSE-224:
--------------------------------------------


Hi,

Thanks a lot for your prompt response on this.

Is it possible to get the handle of HttpServletRequest object under the
synapse custom mediators.

The below function not working under synapse, got "NULL" for
HttpServletRequest.

public static HttpSession getSession() {
MessageContext msgContext =
org.apache.axis.MessageContext.getCurrentContext();
HttpServletRequest request =
HttpServletRequest)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETR
EQUEST)
return request.getSession(false);}



With Regards
Kumaran
Phone net : 85267 Direct line:  6725 5267



> Not able to get the http header information in the custom mediators using the Message Context object
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SYNAPSE-224
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-224
>             Project: Synapse
>          Issue Type: Bug
>          Components: Extension Mediators
>            Reporter: kumaran venkatesan
>            Assignee: Asankha C. Perera
>
> When i tried to extract the header information through the message context object in the custom mediator giving null value for  "axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT"
> public class SessionMediator implements Mediator {
>     private static final Log log = LogFactory.getLog(DiscountQuoteMediator.class);
>     public SessionMediator(){}
>     public boolean mediate(MessageContext mc) {
>     	
>     	Axis2MessageContext axis2mc = (Axis2MessageContext)mc;
>     	org.apache.axis2.context.MessageContext axis2MessageCtx =  axis2mc.getAxis2MessageContext(); 
>         System.out.println("User Agent : " +axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT));
>               
>        return true;
>     }

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


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


[jira] Commented: (SYNAPSE-224) Not able to get the http header information in the custom mediators using the Message Context object

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SYNAPSE-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558538#action_12558538 ] 

Asankha C. Perera commented on SYNAPSE-224:
-------------------------------------------

Synapse by default ships with a high performance non-blocking http/s transport, even through you deploy Synapse as a WAR file. It is possible to really switch this into the Apache Axis2's servlet based http/s implementation - but in general the NIO transport is highly recommended due to the nature of  an ESB. If you explain your objectives or the problem you are trying to solve, one of the developers may be able to suggest a solution. As this topic is now off the original issue JIRA issue, please use the developer or user mailing lists to discuss possibilities

asankha

> Not able to get the http header information in the custom mediators using the Message Context object
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SYNAPSE-224
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-224
>             Project: Synapse
>          Issue Type: Bug
>          Components: Extension Mediators
>            Reporter: kumaran venkatesan
>            Assignee: Asankha C. Perera
>
> When i tried to extract the header information through the message context object in the custom mediator giving null value for  "axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT"
> public class SessionMediator implements Mediator {
>     private static final Log log = LogFactory.getLog(DiscountQuoteMediator.class);
>     public SessionMediator(){}
>     public boolean mediate(MessageContext mc) {
>     	
>     	Axis2MessageContext axis2mc = (Axis2MessageContext)mc;
>     	org.apache.axis2.context.MessageContext axis2MessageCtx =  axis2mc.getAxis2MessageContext(); 
>         System.out.println("User Agent : " +axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT));
>               
>        return true;
>     }

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


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


[jira] Resolved: (SYNAPSE-224) Not able to get the http header information in the custom mediators using the Message Context object

Posted by "Asankha C. Perera (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SYNAPSE-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asankha C. Perera resolved SYNAPSE-224.
---------------------------------------

    Resolution: Invalid
      Assignee: Asankha C. Perera

Kumaran

Check GetPropertyFunction line 255 in the source that contains the following snippet:

            org.apache.axis2.context.MessageContext axis2MessageContext
                = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
            Object headers = axis2MessageContext.getProperty(
                org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);

            if (headers != null && headers instanceof Map) {
                Map headersMap = (HashMap) headers;
                return headersMap.get(key);
            }

Note that the Axis2 message context stores transport headers as a Map under the property name  org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS

asankha


> Not able to get the http header information in the custom mediators using the Message Context object
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SYNAPSE-224
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-224
>             Project: Synapse
>          Issue Type: Bug
>          Components: Extension Mediators
>            Reporter: kumaran venkatesan
>            Assignee: Asankha C. Perera
>
> When i tried to extract the header information through the message context object in the custom mediator giving null value for  "axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT"
> public class SessionMediator implements Mediator {
>     private static final Log log = LogFactory.getLog(DiscountQuoteMediator.class);
>     public SessionMediator(){}
>     public boolean mediate(MessageContext mc) {
>     	
>     	Axis2MessageContext axis2mc = (Axis2MessageContext)mc;
>     	org.apache.axis2.context.MessageContext axis2MessageCtx =  axis2mc.getAxis2MessageContext(); 
>         System.out.println("User Agent : " +axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT));
>               
>        return true;
>     }

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


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


[jira] Updated: (SYNAPSE-224) Not able to get the http header information in the custom mediators using the Message Context object

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

kumaran venkatesan updated SYNAPSE-224:
---------------------------------------

    Description: 
When i tried to extract the header information through the message context object in the custom mediator giving null value for  "axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT"

public class SessionMediator implements Mediator {

    private static final Log log = LogFactory.getLog(DiscountQuoteMediator.class);

    public SessionMediator(){}

    public boolean mediate(MessageContext mc) {
    	
    	Axis2MessageContext axis2mc = (Axis2MessageContext)mc;
    	org.apache.axis2.context.MessageContext axis2MessageCtx =  axis2mc.getAxis2MessageContext(); 
        System.out.println("User Agent : " +axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT));
              
       return true;
    }

  was:
When i tried to extract the header information through the message context object in the custom mediator giving null pointer exception.

public class SessionMediator implements Mediator {

    private static final Log log = LogFactory.getLog(DiscountQuoteMediator.class);

    public SessionMediator(){}

    public boolean mediate(MessageContext mc) {
    	
    	Axis2MessageContext axis2mc = (Axis2MessageContext)mc;
    	org.apache.axis2.context.MessageContext axis2MessageCtx =  axis2mc.getAxis2MessageContext(); 
        System.out.println("User Agent : " +axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT));
              
       return true;
    }


> Not able to get the http header information in the custom mediators using the Message Context object
> ----------------------------------------------------------------------------------------------------
>
>                 Key: SYNAPSE-224
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-224
>             Project: Synapse
>          Issue Type: Bug
>          Components: Extension Mediators
>            Reporter: kumaran venkatesan
>
> When i tried to extract the header information through the message context object in the custom mediator giving null value for  "axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT"
> public class SessionMediator implements Mediator {
>     private static final Log log = LogFactory.getLog(DiscountQuoteMediator.class);
>     public SessionMediator(){}
>     public boolean mediate(MessageContext mc) {
>     	
>     	Axis2MessageContext axis2mc = (Axis2MessageContext)mc;
>     	org.apache.axis2.context.MessageContext axis2MessageCtx =  axis2mc.getAxis2MessageContext(); 
>         System.out.println("User Agent : " +axis2MessageCtx.getProperty(HTTPConstants.HEADER_USER_AGENT));
>               
>        return true;
>     }

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


---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org