本文整理汇总了Java中org.apache.cxf.common.util.StringUtils类的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringUtils类属于org.apache.cxf.common.util包,在下文中一共展示了StringUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeCommand
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
protected static void executeCommand (String command)
{
System.err.printf("Executing: " + command.toString());
try
{
SimpleProcess p = new SimpleProcess(true, null, "csh", "-c", command.toString());
if (!StringUtils.isEmpty(p.getProgramOutput()))
System.err.println(p.getProgramOutput());
if (!StringUtils.isEmpty(p.getProgramErrorOutput()))
System.err.println(p.getProgramErrorOutput());
}
catch(Exception e)
{
throw new Error(e);
}
}
示例2: saveSDKSession
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
@Override
public synchronized boolean saveSDKSession(String sdkSession)
{
if (StringUtils.isEmpty(sdkSession))
{
return false;
}
SessionInfo ds = sessionMap.get(sdkSession);
if (null != ds)
{
return false;
}
ds = new SessionInfo();
try
{
sessionMap.put(sdkSession, ds);
}
catch (Exception e)
{
LOGGER.error("", e);
return false;
}
return true;
}
示例3: saveSecretKey
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
public synchronized boolean saveSecretKey(String sdkSession, byte[] secretKey, byte[] iv)
{
if (StringUtils.isEmpty(sdkSession))
{
return false;
}
SessionInfo info = sessionMap.get(sdkSession);
if (null == info)
{
info = new SessionInfo();
}
info.setSecretKey(secretKey);
info.setIv(iv);
sessionMap.put(sdkSession, info);
return true;
}
示例4: removeSDKSession
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
@Override
public synchronized void removeSDKSession(String sdkSession)
{
if (StringUtils.isEmpty(sdkSession))
{
return;
}
try
{
if (!sessionMap.containsKey(sdkSession))
return;
sessionMap.remove(sdkSession);
}
catch (Exception e)
{
LOGGER.error("", e);
}
}
示例5: isSecurityObjectValid
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
protected boolean isSecurityObjectValid(Security security) {
if(security == null) {
return false;
}
if(StringUtils.isEmpty(security.getPassword())) {
return false;
}
if(StringUtils.isEmpty(security.getProviderNo())) {
return false;
}
if(StringUtils.isEmpty(security.getUserName())) {
return false;
}
return true;
}
示例6: errorHandling
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
/**
* Performs the error handling
* @param password
* @param newPassword
* @param confirmPassword
* @param oldPassword
* @return
*/
private String errorHandling(String password, String newPassword, String confirmPassword, String encodedOldPassword, String oldPassword){
String newURL = "";
if (!encodedOldPassword.equals(password)) {
newURL = newURL + "?errormsg=Your old password, does NOT match the password in the system. Please enter your old password.";
} else if(StringUtils.isEmpty(newPassword)) {
newURL = newURL + "?errormsg=Your new password is empty.";
} else if (!newPassword.equals(confirmPassword)) {
newURL = newURL + "?errormsg=Your new password does NOT match the confirmed password. Please try again.";
} else if (!Boolean.parseBoolean(OscarProperties.getInstance().getProperty("IGNORE_PASSWORD_REQUIREMENTS")) && newPassword.equals(oldPassword)) {
newURL = newURL + "?errormsg=Your new password is the same as your old password. Please choose a new password.";
}
return newURL;
}
示例7: errorHandling2
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
private String errorHandling2(String pin, String newPin, String confirmPin, String oldPin){
String newURL = "";
if (!oldPin.equals(pin)) {
newURL = newURL + "?errormsg=Your old PIN, does NOT match the PIN in the system. Please enter your old PIN.";
} else if(StringUtils.isEmpty(newPin)) {
newURL = newURL + "?errormsg=Your new PIN is empty.";
} else if (!newPin.equals(confirmPin)) {
newURL = newURL + "?errormsg=Your new PIN does NOT match the confirmed PIN. Please try again.";
} else if (!Boolean.parseBoolean(OscarProperties.getInstance().getProperty("IGNORE_PASSWORD_REQUIREMENTS")) && newPin.equals(oldPin)) {
newURL = newURL + "?errormsg=Your new PIN is the same as your old PIN. Please choose a new PIN.";
}
return newURL;
}
示例8: validateCallbackURL
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
protected void validateCallbackURL(Client client,
String oauthCallback) throws OAuthProblemException {
// the callback must not be empty or null, and it should either match
// the pre-registered callback URI or have the common root with the
// the pre-registered application URI
if (!StringUtils.isEmpty(oauthCallback)
&& (!StringUtils.isEmpty(client.getCallbackURI())
&& oauthCallback.equals(client.getCallbackURI())
|| !StringUtils.isEmpty(client.getApplicationURI())
&& oauthCallback.startsWith(client.getApplicationURI()))) {
return;
}
OAuthProblemException problemEx = new OAuthProblemException(
OAuth.Problems.PARAMETER_REJECTED + " - " + OAuth.OAUTH_CALLBACK);
problemEx
.setParameter(OAuthProblemException.HTTP_STATUS_CODE,
HttpServletResponse.SC_BAD_REQUEST);
throw problemEx;
}
示例9: getRecipientsAddresses
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
protected List<String> getRecipientsAddresses(Event event, GeneralNotifierType generalNotifierType, ExpressionVariables variables,
UserType defaultRecipient, String transportName, Transport transport, Task task, OperationResult result) {
List<String> addresses = new ArrayList<>();
if (!generalNotifierType.getRecipientExpression().isEmpty()) {
for (ExpressionType expressionType : generalNotifierType.getRecipientExpression()) {
List<String> r = evaluateExpressionChecked(expressionType, variables, "notification recipient", task, result);
if (r != null) {
addresses.addAll(r);
}
}
if (addresses.isEmpty()) {
getLogger().info("Notification for " + event + " will not be sent, because there are no known recipients.");
}
} else if (defaultRecipient == null) {
getLogger().info("Unknown default recipient, notification will not be sent.");
} else {
String address = transport.getDefaultRecipientAddress(defaultRecipient);
if (StringUtils.isEmpty(address)) {
getLogger().info("Notification to " + defaultRecipient.getName() + " will not be sent, because the user has no address (mail, phone number, etc) for transport '" + transportName + "' set.");
} else {
addresses.add(address);
}
}
return addresses;
}
示例10: loginUser
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
@Override
public ApiResponse<UserSession> loginUser( LoginCredentials login ) {
if( login == null ) {
return new ApiResponse<>( ApiResponse.FAILURE, "login data is required", null );
}
if( StringUtils.isEmpty( login.getLogin() ) ) { // TODO: add unit tests
return new ApiResponse<>( ApiResponse.FAILURE, "username or email is required", null );
}
if( StringUtils.isEmpty( login.getPassword() ) ) { // TODO: add unit tests
return new ApiResponse<>( ApiResponse.FAILURE, "password is required", null );
}
// BaseResponse<UserSession> authResp = userManager.authenticateUser( login );
ValueResponse<UserSession> authResp = new ValueResponse( 1, "moo!", new UserSession() );
return new ApiResponse<>( authResp.getResultCode(), authResp.getMessage(), authResp.getValue() );
}
示例11: mapToProperty
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
/**
* Override mapToProperty() to handle the '#' reference notation ourselves. We put those
* properties with '#' in property map and let component to invoke setProperties() on the
* endpoint.
*/
@Override
protected void mapToProperty(BeanDefinitionBuilder bean, String propertyName, String val) {
if (ID_ATTRIBUTE.equals(propertyName)) {
return;
}
if (org.springframework.util.StringUtils.hasText(val)) {
if (val.startsWith("#")) {
Map<String, Object> map = getPropertyMap(bean, true);
map.put(propertyName, val);
} else {
bean.addPropertyValue(propertyName, val);
}
}
}
示例12: createBeanMetadata
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
public MutableBeanMetadata createBeanMetadata(Element element, ParserContext context, Class<?> runtimeClass) {
MutableBeanMetadata answer = context.createMetadata(MutableBeanMetadata.class);
answer.setRuntimeClass(runtimeClass);
answer.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
answer.addProperty("bundleContext", createRef(context, "blueprintBundleContext"));
// set the Bean scope to be prototype, so we can get a new instance per looking up
answer.setScope(BeanMetadata.SCOPE_PROTOTYPE);
if (!StringUtils.isEmpty(getIdOrName(element))) {
answer.setId(getIdOrName(element));
} else {
// TODO we may need to throw exception for it
answer.setId("camel.cxf.endpoint." + runtimeClass.getSimpleName() + "." + context.generateId());
}
return answer;
}
示例13: isDeclared
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
private static boolean isDeclared(Element e, String namespaceURI, String prefix) {
while (e != null) {
Attr att;
if (prefix != null && prefix.length() > 0) {
att = e.getAttributeNodeNS(XML_NS, prefix);
} else {
att = e.getAttributeNode("xmlns");
}
if (att != null && att.getNodeValue().equals(namespaceURI)) {
return true;
}
if (e.getParentNode() instanceof Element) {
e = (Element)e.getParentNode();
} else if (StringUtils.isEmpty(prefix) && StringUtils.isEmpty(namespaceURI)) {
//A document that probably doesn't have any namespace qualifies elements
return true;
} else {
e = null;
}
}
return false;
}
示例14: generate
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
/**
* Method inserts id for prism container values, which didn't have ids,
* also returns all container values which has generated id
*/
public IdGeneratorResult generate(@NotNull PrismObject object, @NotNull Operation operation) {
IdGeneratorResult result = new IdGeneratorResult();
boolean adding = Operation.ADD.equals(operation);
result.setGeneratedOid(adding);
if (StringUtils.isEmpty(object.getOid())) {
String oid = UUID.randomUUID().toString();
object.setOid(oid);
result.setGeneratedOid(true);
}
List<PrismContainer<?>> values = listAllPrismContainers(object);
generateContainerIds(values, result, operation);
return result;
}
示例15: getRecipientsAddresses
import org.apache.cxf.common.util.StringUtils; //导入依赖的package包/类
protected List<String> getRecipientsAddresses(Event event, GeneralNotifierType generalNotifierType, ExpressionVariables variables,
UserType defaultRecipient, String transportName, Transport transport, Task task, OperationResult result) {
List<String> addresses = new ArrayList<>();
if (!generalNotifierType.getRecipientExpression().isEmpty()) {
for (ExpressionType expressionType : generalNotifierType.getRecipientExpression()) {
List<String> r = evaluateExpressionChecked(expressionType, variables, "notification recipient", task, result);
if (r != null) {
addresses.addAll(r);
}
}
if (addresses.isEmpty()) {
getLogger().info("Notification for " + event + " will not be sent, because there are no known recipients.");
}
} else if (defaultRecipient == null) {
getLogger().info("Unknown default recipient, notification will not be sent.");
} else {
String address = transport.getDefaultRecipientAddress(defaultRecipient);
if (StringUtils.isEmpty(address)) {
getLogger().info("Notification to " + defaultRecipient.getName() + " will not be sent, because the user has no address (mail, phone number, etc) for transport '" + transportName + "' set.");
} else {
addresses.add(address);
}
}
return addresses;
}