Created
September 21, 2014 06:01
-
-
Save hasithaa/9b215bf9c7f0833565b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example.rampart.mediator; | |
import java.util.Hashtable; | |
import java.util.Map; | |
import org.apache.synapse.Mediator; | |
import org.apache.synapse.MessageContext; | |
import org.apache.synapse.core.axis2.Axis2MessageContext; | |
public class SetUserMediator implements Mediator { | |
private String username; | |
@Override | |
public boolean mediate(MessageContext synCtx) { | |
org.apache.axis2.context.MessageContext msgContext = ((Axis2MessageContext) synCtx) | |
.getAxis2MessageContext(); | |
Map<String, String> rampConfigCBProperties = new Hashtable<String, String>(); | |
System.out.println("Setting username to rampartConfigCallbackProperties: " + getUsername()); | |
rampConfigCBProperties.put("user_name", getUsername()); | |
msgContext.setProperty("rampartConfigCallbackProperties", | |
rampConfigCBProperties); | |
return true; | |
} | |
public String getUsername() { | |
if (username == null) { | |
username = ""; | |
} | |
return username; | |
} | |
public void setUsername(String username) { | |
this.username = username; | |
} | |
@Override | |
public String getDescription() {return null;} | |
@Override | |
public void setDescription(String arg0) {} | |
@Override | |
public int getMediatorPosition() {return 0; } | |
@Override | |
public String getShortDescription() {return null; } | |
@Override | |
public int getTraceState() {return 0; } | |
@Override | |
public String getType() {return null; } | |
@Override | |
public boolean isContentAware() {return false; } | |
@Override | |
public void setMediatorPosition(int arg0) {} | |
@Override | |
public void setShortDescription(String arg0) {} | |
@Override | |
public void setTraceState(int arg0) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment