org.apache.cxf.message.Message.getContextualProperty()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中org.apache.cxf.message.Message.getContextualProperty()方法的一些代码示例,展示了Message.getContextualProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getContextualProperty()方法的具体详情如下:
包路径:org.apache.cxf.message.Message
类名称:Message
方法名:getContextualProperty

Message.getContextualProperty介绍

[英]Queries the Message object's metadata for a specific property.
[中]查询消息对象的元数据以获取特定属性。

代码示例

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

private boolean isClientDisconnected(Throwable ex) {
  String exName = (String)inMessage.getContextualProperty("disconnected.client.exception.class");
  if (exName != null) {
    return exName.equals(IOException.class.getName()) || exName.equals(ex.getClass().getName());
  }
  return false;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

private boolean logSensitiveHeaders() {
  // Not allowed by default
  return PropertyUtils.isTrue(message.getContextualProperty(ALLOW_LOGGING_SENSITIVE_HEADERS));
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

private static void checkAllowedRedirectUri(String conduitName,
                      String lastURL,
                      String newURL,
                      Message message) throws IOException {
  if (newURL != null) {
    URI newUri = URI.create(newURL);
    if (MessageUtils.getContextualBoolean(message, AUTO_REDIRECT_SAME_HOST_ONLY)) {
      URI lastUri = URI.create(lastURL);
      // This can be further restricted to make sure newURL completely contains lastURL
      // though making sure the same HTTP scheme and host are preserved should be enough
      if (!newUri.getScheme().equals(lastUri.getScheme())
        || !newUri.getHost().equals(lastUri.getHost())) {
        String msg = "Different HTTP Scheme or Host Redirect detected on Conduit '"
          + conduitName + "' on '" + newURL + "'";
        LOG.log(Level.INFO, msg);
        throw new IOException(msg);
      }
    }
    String allowedRedirectURI = (String)message.getContextualProperty(AUTO_REDIRECT_ALLOWED_URI);
    if (allowedRedirectURI != null && !newURL.startsWith(allowedRedirectURI)) {
      String msg = "Forbidden Redirect URI " + newURL + "detected on Conduit '" + conduitName;
      LOG.log(Level.INFO, msg);
      throw new IOException(msg);
    }
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

public Servlet3Continuation() {
  req.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE,
           inMessage.getExchange().getInMessage());
  callback = inMessage.getExchange().get(ContinuationCallback.class);
  blockRestart = PropertyUtils.isTrue(inMessage.getContextualProperty(BLOCK_RESTART));
  context = req.startAsync();
  context.addListener(this);
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

public String getAuthorization(AuthorizationPolicy  authPolicy,
                URI currentURI,
                Message message,
                String fullHeader) {
  if (authPolicy.getUserName() != null && authPolicy.getPassword() != null) {
    boolean encodeBasicAuthWithIso8859 = PropertyUtils.isTrue(
      message.getContextualProperty(ENCODE_BASIC_AUTH_WITH_ISO8859));
    return getBasicAuthHeader(authPolicy.getUserName(),
                 authPolicy.getPassword(),
                 encodeBasicAuthWithIso8859);
  }
  return null;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

(GSSCredential)message.getContextualProperty(GSSCredential.class.getName());

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

Object setCtForEmptyRequestProp = message.getContextualProperty(SET_EMPTY_REQUEST_CT_PROPERTY);

代码示例来源:origin: apache/cxf

@SuppressWarnings("unchecked")
private <T, Y> SearchConditionVisitor<T, Y> getVisitor() {
  Object visitor = message.getContextualProperty(SearchUtils.SEARCH_VISITOR_PROPERTY);
  if (visitor == null) {
    return null;
  }
  //TODO: consider introducing SearchConditionVisitor.getBeanClass &&
  //      SearchConditionVisitor.getQueryClass to avoid such casts
  return (SearchConditionVisitor<T, Y>)visitor;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

public void handleMessage(Message message) throws Fault {
  final CertConstraints certConstraints
    = (CertConstraints)message.getContextualProperty(CertConstraints.class.getName());
  if (certConstraints == null) {
    return;

代码示例来源:origin: apache/cxf

public static String getKeyAlgorithm(Message m, Properties props, String propName, String defaultAlg) {
  String algo = props != null ? props.getProperty(propName) : null;
  if (algo == null && m != null) {
    algo = (String)m.getContextualProperty(propName);
  }
  if (algo == null) {
    algo = defaultAlg;
  }
  return algo;
}

代码示例来源:origin: apache/cxf

private static void mapSecurityProps(Message message, Map<String, Object> ctx) {
  for (String s : SecurityConstants.ALL_PROPERTIES) {
    Object v = message.getContextualProperty(s);
    if (v != null) {
      ctx.put(s, v);
    }
  }
}

代码示例来源:origin: org.apache.cxf/cxf-core

public static Integer getInteger(Message message, String key) {
    Object o = message.getContextualProperty(key);
    if (o instanceof Integer) {
      return (Integer)o;
    } else if (o instanceof Number) {
      return ((Number)o).intValue();
    } else if (o instanceof String) {
      return Integer.valueOf((String)o);
    }
    return null;
  }
}

代码示例来源:origin: apache/cxf

public static URL getConfigFileURL(Message message, String configFileKey, String configFileDefault) {
  Object o = message.getContextualProperty(configFileKey);
  if (o == null) {
    o = configFileDefault;
  }
  return loadResource(message, o);
}

代码示例来源:origin: apache/cxf

protected BeanValidationProvider getProvider(Message message) {
  if (provider == null) {
    Object prop = message.getContextualProperty(BeanValidationProvider.class.getName());
    if (prop != null) {
      provider = (BeanValidationProvider)prop;
    } else {
      provider = new BeanValidationProvider();
    }
  }
  return provider;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

public void setPayload(Source s) {
  Message message = msgContext.getWrappedMessage();
  Service.Mode mode = (Service.Mode)msgContext.getWrappedMessage()
    .getContextualProperty(Service.Mode.class.getName());
  SOAPMessage m = message.getContent(SOAPMessage.class);
  if (m != null && !MessageUtils.isOutbound(message)) {

代码示例来源:origin: apache/cxf

protected boolean shouldBuffer(Message message) {
  Object en = message.getContextualProperty(OUT_BUFFERING);
  boolean allowBuffer = true;
  boolean buffer = false;
  if (en != null) {
    buffer = Boolean.TRUE.equals(en) || "true".equals(en);
    allowBuffer = !(Boolean.FALSE.equals(en) || "false".equals(en));
  }
  // need to cache the events in case validation fails or buffering is enabled
  return buffer || (allowBuffer && shouldValidate(message) && !isRequestor(message));
}

代码示例来源:origin: apache/cxf

public Object getContextualProperty(Object key) {
  Object value = m.getContextualProperty(key.toString());
  if (value == null && key.getClass() == Class.class) {
    return m.getExchange().get((Class<?>)key);
  }
  return value;
}

代码示例来源:origin: apache/cxf

public static Properties loadEncryptionOutProperties(boolean required) {
  Message m = PhaseInterceptorChain.getCurrentMessage();
  String keyEncryptionAlgorithm =
    (String)m.getContextualProperty(JoseConstants.RSSEC_ENCRYPTION_KEY_ALGORITHM);
  if (keyEncryptionAlgorithm != null && AlgorithmUtils.PBES_HS_SET.contains(keyEncryptionAlgorithm)) {
    // We don't need to load the keystore properties for the PBES case
    required = false;
  }
  return KeyManagementUtils.loadStoreProperties(m, required,
                         JoseConstants.RSSEC_ENCRYPTION_OUT_PROPS,
                         JoseConstants.RSSEC_ENCRYPTION_PROPS);
}

代码示例来源:origin: apache/cxf

@Override
public <T> T getResource(Class<T> cls) {
  ResourceProvider rp = null;
  Object propValue = m.getContextualProperty(CONTEXT_PROVIDER_PROP);
  if (propValue instanceof ResourceContextProvider) {
    rp = ((ResourceContextProvider)propValue).getResourceProvider(cls);
  } else {
    rp = new PerRequestResourceProvider(cls);
  }
  T resource = cls.cast(rp.getInstance(m));
  return doInitResource(cls, resource);
}

代码示例来源:origin: apache/cxf

public Servlet3Continuation() {
  req.setAttribute(AbstractHTTPDestination.CXF_CONTINUATION_MESSAGE,
           inMessage.getExchange().getInMessage());
  callback = inMessage.getExchange().get(ContinuationCallback.class);
  blockRestart = PropertyUtils.isTrue(inMessage.getContextualProperty(BLOCK_RESTART));
  context = req.startAsync();
  context.addListener(this);
}

相关文章