本文整理匯總了Java中org.apache.cxf.message.Message.getContextualProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Message.getContextualProperty方法的具體用法?Java Message.getContextualProperty怎麽用?Java Message.getContextualProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.cxf.message.Message
的用法示例。
在下文中一共展示了Message.getContextualProperty方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createContext
import org.apache.cxf.message.Message; //導入方法依賴的package包/類
@Override
public ServiceContext createContext(Message message) {
ServiceContext serviceContext = null;
// get the current HttpServletRequest for building the service context
// instance.
HttpServletRequest request = (HttpServletRequest) message.getContextualProperty(PROPKEY_HTTP_REQUEST);
try {
// now we can create a service context
serviceContext = ServiceContextFactory.getInstance(request);
// done!
} catch (PortalException e) {
_log.warn("Failed creating service context: " + e.getMessage(), e);
}
// return the new instance.
return serviceContext;
}
示例2: createContext
import org.apache.cxf.message.Message; //導入方法依賴的package包/類
/**
* Returns the {@link Connection} for the given {@link Message} and saves it as a
* contextual property.
* If a {@link Connection} was already opened for the given {@link Message} than
* the already opened one will returned.
*/
@Override
public Connection createContext(final Message message) {
Connection con = (Connection) message.getContextualProperty(PROPERTY_CONNECTION);
if(con == null) {
con = DBConnectionProvider.getInstance().acquire();
message.setContextualProperty(PROPERTY_CONNECTION, con);
}
return con;
}
示例3: shouldBuffer
import org.apache.cxf.message.Message; //導入方法依賴的package包/類
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));
}
示例4: shouldValidate
import org.apache.cxf.message.Message; //導入方法依賴的package包/類
protected boolean shouldValidate(Message m) {
// add by jirunfang ---start
boolean result = ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, m);
Object validateRes = m.getContextualProperty("schema-validation-response-enabled");
String str = validateRes != null ? validateRes.toString() : "";
// add by jirunfang ---end
return !"false".equalsIgnoreCase(str) && result;
}
示例5: setupConnection
import org.apache.cxf.message.Message; //導入方法依賴的package包/類
protected void setupConnection(Message message, Address address, HTTPClientPolicy csPolicy) throws IOException {
HttpURLConnection connection = createConnection(message, address, csPolicy);
// --add by jirunfang start
CookieHandler.setDefault(null);
// --add by jirunfang end
connection.setDoOutput(true);
int ctimeout = determineConnectionTimeout(message, csPolicy);
connection.setConnectTimeout(ctimeout);
int rtimeout = determineReceiveTimeout(message, csPolicy);
connection.setReadTimeout(rtimeout);
connection.setUseCaches(false);
// We implement redirects in this conduit. We do not
// rely on the underlying URLConnection implementation
// because of trust issues.
connection.setInstanceFollowRedirects(false);
// If the HTTP_REQUEST_METHOD is not set, the default is "POST".
String httpRequestMethod =
(String)message.get(Message.HTTP_REQUEST_METHOD);
if (httpRequestMethod == null) {
httpRequestMethod = "POST";
message.put(Message.HTTP_REQUEST_METHOD, "POST");
}
try {
connection.setRequestMethod(httpRequestMethod);
} catch (java.net.ProtocolException ex) {
Object o = message.getContextualProperty(HTTPURL_CONNECTION_METHOD_REFLECTION);
boolean b = DEFAULT_USE_REFLECTION;
if (o != null) {
b = MessageUtils.isTrue(o);
}
if (b) {
try {
java.lang.reflect.Field f = ReflectionUtil.getDeclaredField(HttpURLConnection.class, "method");
ReflectionUtil.setAccessible(f).set(connection, httpRequestMethod);
message.put(HTTPURL_CONNECTION_METHOD_REFLECTION, true);
} catch (Throwable t) {
t.printStackTrace();
throw ex;
}
} else {
throw ex;
}
}
// We place the connection on the message to pick it up
// in the WrappedOutputStream.
message.put(KEY_HTTP_CONNECTION, connection);
message.put(KEY_HTTP_CONNECTION_ADDRESS, address);
}