private boolean isServerMessage(MessageContext context) { return context.containsKey(MessageContext.SERVLET_REQUEST) || context.containsKey(MessageContext.SERVLET_RESPONSE) || context.containsKey(MessageContext.SERVLET_CONTEXT); }
protected void updateHeader(Exchange exchange, MessageContext ctx) { if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>) { List<?> list = (List<?>) ctx.get(Header.HEADER_LIST); if (list != null && !list.isEmpty()) { SoapMessage sm = (SoapMessage) createResponseMessage(exchange); if (sm != null) { Iterator<?> iter = list.iterator(); while (iter.hasNext()) { Header header = (Header) iter.next(); if (header.getDirection() != Header.Direction.DIRECTION_IN && !header.getName().getNamespaceURI(). equals("http://docs.oasis-open.org/wss/2004/01/" + "oasis-200401-wss-wssecurity-secext-1.0.xsd") && !header.getName().getNamespaceURI(). equals("http://docs.oasis-open.org/" + "wss/oasis-wss-wssecurity-secext-1.1.xsd")) { //don't copy over security header, out interceptor chain will take care of it. sm.getHeaders().add(header); } } } } } }
protected void updateWebServiceContext(Exchange exchange, MessageContext ctx) { // Guard against wrong type associated with header list. // Need to copy header only if the message is going out. if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>) { List<?> list = (List<?>) ctx.get(Header.HEADER_LIST); if (list != null && !list.isEmpty()) { SoapMessage sm = (SoapMessage) createResponseMessage(exchange); if (sm != null) { Iterator<?> iter = list.iterator(); while (iter.hasNext()) { sm.getHeaders().add((Header) iter.next()); } } } } if (exchange.getOutMessage() != null) { Message out = exchange.getOutMessage(); if (out.containsKey(Message.PROTOCOL_HEADERS)) { Map<String, List<String>> heads = CastUtils .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS)); if (heads.containsKey("Content-Type")) { List<String> ct = heads.get("Content-Type"); exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0)); heads.remove("Content-Type"); } } } }
public boolean containsKey(Object arg0) { return context.containsKey(arg0); }
@Override public boolean invokeProtocolHandlersHandleFault(boolean requestor, MessageContext context) { if (context.containsKey(KEY)) { return true; } return super.invokeProtocolHandlersHandleFault(requestor, context); }
public boolean containsKey(Object key) { return context.containsKey(key) && context.getScope((String)key) == Scope.APPLICATION; }
public Object remove(Object key) { if (context.containsKey(key) && context.getScope((String)key) == Scope.HANDLER) { throw new IllegalArgumentException( "Attempt to remove property with scope HANDLER from provider context."); } return context.remove(key); }
public Object put(String key, Object value) { if (context.containsKey(key) && context.getScope(key) == Scope.HANDLER) { throw new IllegalArgumentException( "Attempt to set property with scope HANDLER in provider context."); } Object o = context.put(key, value); context.setScope(key, Scope.APPLICATION); return o; }
protected void storeOperationName() { AbstractServerBinding sb = (AbstractServerBinding)binding; if (bindingCtx.containsKey(MessageContext.WSDL_OPERATION)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Determined operation using pre-existing operation name: " + bindingCtx.get(MessageContext.WSDL_OPERATION)); } return; } QName operationName = sb.getOperationName(bindingCtx); if (null != operationName) { bindingCtx.put(MessageContext.WSDL_OPERATION, operationName); } else { throw new WebServiceException("No operation matching message was found"); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Determined operation name using server binding endpoint callback: " + operationName); } }
/** * Checks if a method object is stored in the context and if it is annotated * with a Oneway annotation. * * @param context * @return true if a method object is stored in the context and it has a Oneway annotation. */ public static boolean isOnewayMethod(MessageContext context) { DataBindingCallback cb = retrieveDataBindingCallback(context); if (cb == null) { if (!context.containsKey(OutputStreamMessageContext.ONEWAY_MESSAGE_TF)) { return false; } return ((Boolean)context.get(OutputStreamMessageContext.ONEWAY_MESSAGE_TF)).booleanValue(); } return cb.isOneWay(); }
protected void updateHeader(Exchange exchange, MessageContext ctx) { if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>) { List<?> list = (List<?>) ctx.get(Header.HEADER_LIST); if (list != null && !list.isEmpty()) { SoapMessage sm = (SoapMessage) createResponseMessage(exchange); if (sm != null) { Iterator<?> iter = list.iterator(); while (iter.hasNext()) { Header header = (Header) iter.next(); if (header.getDirection() != Header.Direction.DIRECTION_IN && !header.getName().getNamespaceURI(). equals("http://docs.oasis-open.org/wss/2004/01/" + "oasis-200401-wss-wssecurity-secext-1.0.xsd") && !header.getName().getNamespaceURI(). equals("http://docs.oasis-open.org/" + "wss/oasis-wss-wssecurity-secext-1.1.xsd")) { //don't copy over security header, out interceptor chain will take care of it. sm.getHeaders().add(header); } } } } } }
protected void updateWebServiceContext(Exchange exchange, MessageContext ctx) { // Guard against wrong type associated with header list. // Need to copy header only if the message is going out. if (ctx.containsKey(Header.HEADER_LIST) && ctx.get(Header.HEADER_LIST) instanceof List<?>) { List<?> list = (List<?>) ctx.get(Header.HEADER_LIST); if (list != null && !list.isEmpty()) { SoapMessage sm = (SoapMessage) createResponseMessage(exchange); if (sm != null) { Iterator<?> iter = list.iterator(); while (iter.hasNext()) { sm.getHeaders().add((Header) iter.next()); } } } } if (exchange.getOutMessage() != null) { Message out = exchange.getOutMessage(); if (out.containsKey(Message.PROTOCOL_HEADERS)) { Map<String, List<String>> heads = CastUtils .cast((Map<?, ?>)exchange.getOutMessage().get(Message.PROTOCOL_HEADERS)); if (heads.containsKey("Content-Type")) { List<String> ct = heads.get("Content-Type"); exchange.getOutMessage().put(Message.CONTENT_TYPE, ct.get(0)); heads.remove("Content-Type"); } } } }
protected List<String> getHandlerInfoList(MessageContext ctx) { List<String> handlerInfoList = null; if (ctx.containsKey("handler.info")) { handlerInfoList = CastUtils.cast((List<?>)ctx.get("handler.info")); } else { handlerInfoList = new ArrayList<>(); ctx.put("handler.info", handlerInfoList); ctx.setScope("handler.info", MessageContext.Scope.APPLICATION); } return handlerInfoList; }
private boolean checkContext() { boolean success = false; MessageContext ctx = context == null ? null : context.getMessageContext(); if (ctx.containsKey(Header.HEADER_LIST)) { List<?> oobHdr = (List<?>) ctx.get(Header.HEADER_LIST); Iterator<?> iter = oobHdr.iterator();