Codota Logo
CastUtils.cast
Code IndexAdd Codota to your IDE (free)

How to use
cast
method
in
org.apache.cxf.helpers.CastUtils

Best Java code snippets using org.apache.cxf.helpers.CastUtils.cast (Showing top 20 results out of 909)

Refine searchRefine arrow

  • Map.get
  • List.add
  • Message.get
  • List.get
  • Map.put
  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: org.apache.cxf/cxf-rt-transports-http

public String determineContentType() {
  String ct = null;
  List<Object> ctList = CastUtils.cast(headers.get(Message.CONTENT_TYPE));
  if (ctList != null && ctList.size() == 1 && ctList.get(0) != null) {
    ct = ctList.get(0).toString();
  } else {
    ct = (String)message.get(Message.CONTENT_TYPE);
  }
  String enc = (String)message.get(Message.ENCODING);
  if (null != ct) {
    if (enc != null
      && ct.indexOf("charset=") == -1
      && !ct.toLowerCase().contains("multipart/related")) {
      ct = ct + "; charset=" + enc;
    }
  } else if (enc != null) {
    ct = "text/xml; charset=" + enc;
  } else {
    ct = "text/xml";
  }
  return ct;
}
origin: org.apache.cxf/cxf-rt-transports-http

/**
 * While extracting the Message.PROTOCOL_HEADERS property from the Message,
 * this call ensures that the Message.PROTOCOL_HEADERS property is
 * set on the Message. If it is not set, an empty map is placed there, and
 * then returned.
 *
 * @param message The outbound message
 * @return The PROTOCOL_HEADERS map
 */
public static Map<String, List<String>> getSetProtocolHeaders(final Message message) {
  Map<String, List<String>> headers =
    CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
  if (null == headers) {
    headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
  } else if (headers instanceof HashMap) {
    Map<String, List<String>> headers2
      = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
    headers2.putAll(headers);
    headers = headers2;
  }
  message.put(Message.PROTOCOL_HEADERS, headers);
  return headers;
}
origin: org.apache.cxf/cxf-rt-frontend-jaxws

protected Map<String, Object> removeHandlerProperties(WrappedMessageContext ctx) {
  Map<String, Scope> scopes = CastUtils.cast((Map<?, ?>)ctx.get(WrappedMessageContext.SCOPES));
  Map<String, Object> handlerScopedStuff = new HashMap<>();
  if (scopes != null) {
    for (Map.Entry<String, Scope> scope : scopes.entrySet()) {
      if (scope.getValue() == Scope.HANDLER) {
        handlerScopedStuff.put(scope.getKey(), ctx.get(scope.getKey()));
      }
    }
    for (String key : handlerScopedStuff.keySet()) {
      ctx.remove(key);
    }
  }
  return handlerScopedStuff;
}
origin: org.apache.cxf/cxf-rt-frontend-jaxws

private Object createAttachments(Map<String, Object> mc, String propertyName) {
  if (mc == null) {
    return null;
  }
  Collection<Attachment> attachments = CastUtils.cast((Collection<?>)mc.get(Message.ATTACHMENTS));
  Map<String, DataHandler> dataHandlers;
  if (attachments instanceof WrappedAttachments) {
    dataHandlers = ((WrappedAttachments) attachments).getAttachments();
  } else {
    if (attachments == null) {
      attachments = new ArrayList<>();
      mc.put(Message.ATTACHMENTS, attachments);
    }
    dataHandlers = AttachmentUtil.getDHMap(attachments);
    mc.put(propertyName,
        dataHandlers);
    scopes.put(propertyName, Scope.APPLICATION);
  }
  return dataHandlers;
}
origin: org.apache.cxf/cxf-rt-transports-http

String fname = e.nextElement();
String mappedName = HttpHeaderHelper.getHeaderKey(fname);
List<String> values = headers.get(mappedName);
if (values == null) {
  values = new ArrayList<>();
  headers.put(mappedName, values);
  if ("Accept".equals(mappedName) && values.size() > 0) {
    String firstAccept = values.get(0);
    firstAccept = firstAccept + ", " + val;
    values.set(0, firstAccept);
  values.add(val);
headers.put(Message.CONTENT_TYPE, Collections.singletonList(req.getContentType()));
Map<String, List<Object>> theHeaders = CastUtils.cast(headers);
LOG.log(Level.FINE, "Request Headers: " + toString(theHeaders,
                          logSensitiveHeaders()));
origin: org.apache.cxf/cxf-rt-frontend-jaxws

public Object[] getHeaders(QName name, JAXBContext context, boolean allRoles) {
  SOAPMessage msg = getMessage();
  SOAPHeader header;
  try {
    header = msg.getSOAPPart().getEnvelope().getHeader();
    if (header == null || !header.hasChildNodes()) {
      return new Object[0];
    }
    List<Object> ret = new ArrayList<>();
    Iterator<SOAPHeaderElement> it = CastUtils.cast(header.examineAllHeaderElements());
    while (it.hasNext()) {
      SOAPHeaderElement she = it.next();
      if ((allRoles
        || roles.contains(she.getActor()))
        && name.equals(she.getElementQName())) {
        ret.add(JAXBUtils.unmarshall(context, she));
      }
    }
    return ret.toArray(new Object[0]);
  } catch (SOAPException | JAXBException e) {
    throw new WebServiceException(e);
  }
}
origin: apache/cxf

public Binding[] getCorbaBindings() {
  List<Binding> result = new ArrayList<>();
  Map<QName, Binding> bindings = CastUtils.cast(definition.getBindings());
  for (Binding binding : bindings.values()) {
    List<ExtensibilityElement> extElements
      = CastUtils.cast(binding.getExtensibilityElements());
    for (int i = 0; i < extElements.size(); i++) {
      ExtensibilityElement el = extElements.get(i);
      if (el.getElementType().equals(CorbaConstants.NE_CORBA_BINDING)) {
        result.add(binding);
        break;
      }
    }
  }
  return result.toArray(new Binding[0]);
}
origin: org.apache.cxf/cxf-rt-databinding-jibx

private void parseImports(Definition def, List<Definition> defList) {
  List<Import> importList = new ArrayList<Import>();
  Collection<List<Import>> ilist = CastUtils.cast(def.getImports().values());
  for (List<Import> list : ilist) {
    importList.addAll(list);
  }
  for (Import impt : importList) {
    if (!defList.contains(impt.getDefinition())) {
      defList.add(impt.getDefinition());
      parseImports(impt.getDefinition(), defList);
    }
  }
}
origin: org.apache.cxf/cxf-rt-core

public static Collection<Import> getImports(final Definition wsdlDef) {
  Collection<Import> importList = new ArrayList<Import>();
  Map<?, ?> imports = wsdlDef.getImports();
  for (Iterator<?> iter = imports.keySet().iterator(); iter.hasNext();) {
    String uri = (String)iter.next();
    List<Import> lst = CastUtils.cast((List<?>)imports.get(uri));
    importList.addAll(lst);
  }
  return importList;
}
origin: org.apache.cxf/cxf-rt-transports-http

                  String newURL,
                  Message message) throws IOException {
Map<String, Integer> visitedURLs = CastUtils.cast((Map<?, ?>)message.get(KEY_VISITED_URLS));
if (visitedURLs == null) {
  visitedURLs = new HashMap<>();
  message.put(KEY_VISITED_URLS, visitedURLs);
Integer visitCount = visitedURLs.get(lastURL);
if (visitCount == null) {
  visitCount = 1;
  visitCount++;
visitedURLs.put(lastURL, visitCount);
Integer newURLCount = visitedURLs.get(newURL);
if (newURL != null && newURLCount != null) {
origin: apache/cxf

private Map<String, String> getHeaders(Message message) {
  Map<String, List<Object>> headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
  Map<String, String> result = new HashMap<>();
  if (headers == null) {
    return result;
  }
  for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {
    if (entry.getValue().size() == 1) {
      Object value = entry.getValue().get(0);
      if (value != null) {
        result.put(entry.getKey(), value.toString());
      }
    } else {
      result.put(entry.getKey(), Arrays.deepToString(entry.getValue().toArray()));
    }
  }
  return result;
}
origin: org.apache.cxf/cxf-rt-frontend-jaxws

protected void processAttachments(SoapMessage message, SoapBodyInfo sbi) {
  Collection<Attachment> atts = setupAttachmentOutput(message);
  List<Object> outObjects = CastUtils.cast(message.getContent(List.class));
    Object o = outObjects.get(idx);
origin: apache/cxf

void addHeader(String key, String value) {
  Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
  if (headers == null) {
    headers = new HashMap<>();
    message.put(Message.PROTOCOL_HEADERS, headers);
  }
  headers.put(key, Arrays.asList(value));
}
origin: org.apache.cxf/cxf-rt-bindings-http

public void handleMessage(Message message) throws Fault {
  Map<String, List<String>> headers = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
  if (headers == null) {
    headers = new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
    message.put(Message.PROTOCOL_HEADERS, headers);
  }
  String ct = (String)message.getExchange().get(Endpoint.class).get(HttpHeaderHelper.CONTENT_TYPE);
  if (ct != null) {
    List<String> contentType = new ArrayList<String>();
    contentType.add(ct);
    headers.put(HttpHeaderHelper.getHeaderKey(HttpHeaderHelper.CONTENT_TYPE), contentType);
    message.put(HttpHeaderHelper.CONTENT_TYPE, ct);
  }
  
}
origin: apache/cxf

protected Map<String, Object> getRequestContext(Message outMessage) {
  Map<String, Object> invContext
    = CastUtils.cast((Map<?, ?>)outMessage.get(Message.INVOCATION_CONTEXT));
  return CastUtils.cast((Map<?, ?>)invContext.get(REQUEST_CONTEXT));
}
origin: apache/cxf

public static void addMultipartOutFilter(MultipartOutputFilter filter) {
  Message m = JAXRSUtils.getCurrentMessage();
  List<MultipartOutputFilter> outFilters = CastUtils.cast((List<?>)m.get(OUT_FILTERS));
  if (outFilters == null) {
    outFilters = new ArrayList<>();
    m.put(OUT_FILTERS, outFilters);
  }
  outFilters.add(filter);
}

origin: org.apache.cxf/cxf-rt-frontend-jaxws

  SoapVersion soapVersion = (SoapVersion)message.get(SoapVersion.class.getName());
  if (soapVersion != null && soapVersion.getVersion() != 1.1) {
    if (f instanceof SoapFault) {
      for (Iterator<QName> it = CastUtils.cast(sf.getFault().getFaultSubcodes()); it.hasNext();) {
        ((SoapFault) f).addSubCode(it.next());
    Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0),
                             message.getExchange().getBus());
    writer.setSchema(schema);
FaultMode mode = message.get(FaultMode.class);
if (mode == FaultMode.CHECKED_APPLICATION_FAULT) {
origin: org.apache.cxf/cxf-rt-frontend-jaxws

  params = Collections.singletonList(null);
res = CastUtils.cast((List<?>)super.invoke(exchange, serviceObject, m, params));
                     "jaxws.provider.interpretNullAsOneway",
                     true)
  && (res != null && !res.isEmpty() && res.get(0) == null)
  && exchange.getInMessage().getInterceptorChain().getState() == InterceptorChain.State.EXECUTING) {
origin: apache/cxf

public HttpHeadersImpl(Message message) {
  this.message = message;
  this.headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
  if (headers == null) {
    headers = Collections.emptyMap();
  }
}
origin: apache/cxf

@Override
public void handleMessage(Message message) throws Fault {
  final Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>)message.get(Message.PROTOCOL_HEADERS));
  final TraceScopeHolder<TraceScope> holder = super.startTraceSpan(headers,
    getUri(message), (String)message.get(Message.HTTP_REQUEST_METHOD));
  if (holder != null) {
    message.getExchange().put(TRACE_SPAN, holder);
  }
}
org.apache.cxf.helpersCastUtilscast

Popular methods of CastUtils

    Popular in Java

    • Making http post requests using okhttp
    • putExtra (Intent)
    • startActivity (Activity)
    • scheduleAtFixedRate (Timer)
      Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
    • Socket (java.net)
      Provides a client-side TCP socket.
    • URLConnection (java.net)
      The abstract class URLConnection is the superclass of all classes that represent a communications li
    • SimpleDateFormat (java.text)
      Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
    • Arrays (java.util)
      This class contains various methods for manipulating arrays (such as sorting and searching). This cl
    • ReentrantLock (java.util.concurrent.locks)
      A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
    • DateTimeFormat (org.joda.time.format)
      Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now