本文整理汇总了Java中com.ebay.jetstream.util.CommonUtils.isEmptyTrimmed方法的典型用法代码示例。如果您正苦于以下问题:Java CommonUtils.isEmptyTrimmed方法的具体用法?Java CommonUtils.isEmptyTrimmed怎么用?Java CommonUtils.isEmptyTrimmed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ebay.jetstream.util.CommonUtils
的用法示例。
在下文中一共展示了CommonUtils.isEmptyTrimmed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
public Object process(Map<String, String[]> parameters) throws Exception {
Object result = null;
if (m_bean instanceof ControlBean) {
result = ((ControlBean) m_bean).process(parameters);
}
else {
for (Entry<String, String[]> entry : parameters.entrySet()) {
String name = entry.getKey();
String values[] = entry.getValue();
if (values == null || values.length == 0 || CommonUtils.isEmptyTrimmed(values[0])) {
executeAction(name);
}
else {
setProperty(name, values);
}
}
}
return result;
}
示例2: getLdapContexts
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
/**
* Returns the ldap urls to get configuration information from. Currently only one ldap url is returned, and only if
* the LDAPINFORMATION property or env var is populated.
*
* @return the list of ldap urls
*/
public static List<String> getLdapContexts(ApplicationInformation ai) {
List<String> ldap = new ArrayList<String>();
String ldapInfo = ConfigUtils.getPropOrEnv("LDAPINFORMATION");
if (ldapInfo != null) {
int indexOfAt = ldapInfo.indexOf('@');
if (indexOfAt != -1 && ai.containsKey("ldapHostPort") && ldapInfo.charAt(indexOfAt + 1) == '/') {
ldapInfo = ldapInfo.substring(0, indexOfAt + 1) + ai.get("ldapHostPort") + ldapInfo.substring(indexOfAt + 1);
}
else if (indexOfAt != -1 && !ai.containsKey("ldapHostPort") && ldapInfo.charAt(indexOfAt + 1) == '/') {
throw new RuntimeException("Ldap host/port not set");
}
if (!ldapInfo.contains("application=") && ai.containsKey("applicationName"))
ldapInfo = addToUrlEnd(ldapInfo, "application=" + ai.get("applicationName"));
if (!ldapInfo.contains("version=") && ai.containsKey("configVersion"))
ldapInfo = addToUrlEnd(ldapInfo, "version=" + ai.get("configVersion"));
if (!ldapInfo.contains("scope="))
ldapInfo = addToUrlEnd(ldapInfo, "scope=" + ai.get("scope"));
}
if (!CommonUtils.isEmptyTrimmed(ldapInfo))
ldap.add(ldapInfo);
return ldap;
}
示例3: getApplicationName
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Override
public String getApplicationName() {
String result = super.getApplicationName();
if (CommonUtils.isEmptyTrimmed(result)) {
setApplicationName(result = m_jetstreamApplication.getClass().getSimpleName());
}
return result;
}
示例4: getDnsMap
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
protected DNSMap getDnsMap() throws ConfigException {
if (m_dnsMap == null) {
String zone = getZone();
if (CommonUtils.isEmptyTrimmed(zone))
m_dnsMap = new DNSJNDIMap();
else {
m_dnsMap = new DNSFileMap();
((DNSFileMap) m_dnsMap).setSource(zone);
}
}
return m_dnsMap;
}
示例5: afterPropertiesSet
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
public void afterPropertiesSet() throws Exception {
if (CommonUtils.isEmptyTrimmed(getKeyStorePassword()) && CommonUtils.isEmptyTrimmed(getKeyStorePath()))
throw new Exception("Keystore Path/Password required for hosting a SSL port !!!");
LOGGER.warn( "Keystore Path And Password Not Empty/Nul. Keystore Path: " + getKeyStorePath());
if (CommonUtils.isEmptyTrimmed(getTrustStorePath()))
setTrustStorePath(getKeyStorePath());
if (CommonUtils.isEmptyTrimmed(getTrustStorePassword()))
setTrustStorePassword(getKeyStorePassword());
}
示例6: formatOperation
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Override
protected void formatOperation(Method method) throws IOException {
PrintWriter pw = getWriter();
pw.print(method.getName());
String help = method.getAnnotation(ManagedOperation.class).description();
if (!CommonUtils.isEmptyTrimmed(help)) {
pw.print(": " + help);
}
pw.println();
}
示例7: beginFormat
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Override
protected void beginFormat() throws IOException {
pushElement("html", null);
getWriter().println(
"<H1>Viewing as <B>" + getFormat() + "</B></H1><P/>");
formatTitleLink(1, makeFormattedPath(getFormat(), getPrefix()),
"Directory Root");
formatTitleLink(3, "/visualpipeline", "Visual Data Pipeline");
if (!CommonUtils.isEmptyTrimmed(getPath())) {
formatTitleLink(2,
makeFormattedPath(getFormat(), getPrefix(), getPath()),
getPath());
}
}
示例8: formatBean
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
protected void formatBean(boolean end, Class<?> bclass, String help)
throws IOException {
PrintWriter pw = getWriter();
if (!CommonUtils.isEmptyTrimmed(help)) {
pw.print("<I>" + help + "</I>: ");
}
pw.println("type " + bclass.getName() + "<P/>");
}
示例9: formatOperation
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
protected void formatOperation(Method method) throws IOException {
PrintWriter pw = getWriter();
String text = method.getName();
formatHRef(makePath(getPrefix(), getPath(), "?" + text), text);
text = method.getAnnotation(ManagedOperation.class).description();
if (!CommonUtils.isEmptyTrimmed(text)) {
pw.print(" (" + text + ")");
}
pw.println();
}
示例10: addURLProtocols
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
/**
* Adds a package to the list of URL protocol supporters. Each protocol must be in a separate package with the name of
* the protocol below the given classes package, and must contain a Handler that extends URLStreamHandler.
*
* @param location
* the class whose package is added as a root for URLStreamHandlers.
*
* @return true iff the location was added, else false.
*/
public static boolean addURLProtocols(Class<?> location) {
String ln = location.getPackage().getName();
String p = System.getProperty(PKGS);
boolean add = p == null || !p.contains(ln);
if (add) {
p = (CommonUtils.isEmptyTrimmed(p) ? "" : p + "|") + ln;
System.setProperty(PKGS, p);
}
return add;
}
示例11: getMongoContexts
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
public static List<String> getMongoContexts() {
List<String> mongo = new ArrayList<String>();
String mongoInfo = ConfigUtils.getPropOrEnv("MONGO_HOME");
//if (!CommonUtils.isEmptyTrimmed(mongoInfo))
if(mongoInfo != null && !CommonUtils.isEmptyTrimmed(mongoInfo)) {
mongo.add(mongoInfo);
} else {
mongo.add("mongo:null");
}
return mongo;
}
示例12: formatProperty
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
protected void formatProperty(Object bean, PropertyDescriptor pd)
throws Exception {
PrintWriter pw = getWriter();
Method getter = pd.getReadMethod();
Class<?> pclass = pd.getPropertyType();
ManagedAttribute attr = getter.getAnnotation(ManagedAttribute.class);
String text = attr != null ? attr.description() : null;
if (CommonUtils.isEmptyTrimmed(text)) {
text = pd.getDisplayName();
} else {
text = pd.getDisplayName() + " (" + text + ")";
}
pw.print(text + ": " + pclass.getName() + " = ");
getter.setAccessible(true);
Object value = getter.invoke(bean);
Method setter = pd.getWriteMethod();
attr = setter == null ? null : setter
.getAnnotation(ManagedAttribute.class);
boolean isComplex = !(String.class.isAssignableFrom(pclass) || ClassUtils
.isPrimitiveOrWrapper(pclass));
if (isComplex) {
value = StringEscapeUtils.escapeXml(getSerializer()
.getXMLStringRepresentation(value));
}
if (attr == null) {
if (isComplex) {
pushElement("code", null);
}
pw.println(value);
if (isComplex) {
popElement();
}
} else {
pw.println(attr.description());
pushElement(
"form",
"action="
+ makePath(getPrefix(), getPath(),
isComplex ? "?form" : "?" + pd.getName())
+ " method=" + (isComplex ? "POST" : "GET"));
if (isComplex) {
pw.print("<TEXTAREA name=" + pd.getName() + " rows=4 cols=32>"
+ value + "</TEXTAREA>");
} else {
pw.print("<input type=text name=" + pd.getName() + " value=\""
+ value + "\"/>");
}
pw.println("<input type=submit Value=\"Go\"/>");
popElement();
}
pw.println("<P/>");
}
示例13: doGet
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (!checkAuthorized(request, response, false))
return;
response.setCharacterEncoding("UTF-8");
Map<String, String[]> parameters = getParameterMap(request);
boolean isHelp = parameters.remove("help") != null;
if (isHelp && parameters.size() > 0) {
sendError(response, HttpServletResponse.SC_BAD_REQUEST, "help cannot be combined with other parameters");
return;
}
String format = getParameter(parameters, AbstractResourceFormatter.BEAN_FORMAT_PARAM);
if (isHelp || CommonUtils.isEmptyTrimmed(format)) {
format = "help";
}
String beanLocation[] = getBeanLocation(request);
for(String bloc : beanLocation){
if(!validate(bloc)){
sendError(response, HttpServletResponse.SC_BAD_REQUEST, "Invalid Request URL");
}
}
try {
response.setHeader("Cache-Control", "no-cache");
BeanController bc = new BeanController(beanLocation[0], beanLocation[1]);
bc.setRequestedFields(request.getParameterValues("field"));
parameters.remove("field");
if (parameters.size() > 0) {
if (!checkAuthorized(request, response, true))
return;
bc.process(parameters);
}
else {
bc.setFormat(format);
response.setContentType(bc.getContentType());
bc.write(response.getWriter());
}
}
catch (Throwable t) {
sendException(response, "failed for " + beanLocation[1], t);
}
}
示例14: doPost
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (!checkAuthorized(request, response, true))
return;
// Reading post content must happen early
String content = CommonUtils.getStreamAsString(request.getInputStream(), "\n");
Map<String, String[]> parameters = getParameterMap(request);
String format = getParameter(parameters, AbstractResourceFormatter.BEAN_FORMAT_PARAM);
String form[] = parameters.remove("form");
String actions[] = parameters.remove("action");
String properties[] = parameters.remove("property");
if (format == null) {
format = "spring";
}
if (form != null) {
content = URLDecoder.decode(content, "UTF-8");
if (form.length != 1 && CommonUtils.isEmptyTrimmed(form[0]) || properties != null) {
sendError(response, HttpServletResponse.SC_BAD_REQUEST, "Cannot specify both form and property");
return;
}
int p = content.indexOf("=");
properties = new String[] { content.substring(0, p) };
content = content.substring(p + 1);
}
if (actions != null && properties != null) {
sendError(response, HttpServletResponse.SC_BAD_REQUEST, "Cannot specify both action and property");
return;
}
if (properties != null && CommonUtils.isEmptyTrimmed(content)) {
sendError(response, HttpServletResponse.SC_BAD_REQUEST, "Must send content to set property");
return;
}
if (actions != null)
for (String action : actions)
parameters.put(action, null);
if (properties != null)
for (String property : properties)
parameters.put(property, new String[] { format, content });
if(!validate(request.getPathInfo()) || !validate(request.getRequestURL().toString())){
sendError(response, HttpServletResponse.SC_BAD_REQUEST, "Invalid Request URL");
}
String beanLocation[] = getBeanLocation(request);
for(String bloc : beanLocation){
if(!validate(bloc)){
sendError(response, HttpServletResponse.SC_BAD_REQUEST, "Invalid Request URL");
}
}
try {
response.setHeader("Cache-Control", "no-cache");
BeanController bc = new BeanController(beanLocation[0], beanLocation[1]);
bc.process(parameters);
response.setContentType(bc.getContentType());
}
catch (Throwable t) {
sendException(response, "POST failed", t);
}
}
示例15: getBeanOrFolder
import com.ebay.jetstream.util.CommonUtils; //导入方法依赖的package包/类
/**
* Gets a managed bean or bean folder. An exception is thrown if the path is illegal or does not exist.
*
* @param path
* the path to the Bean or BeanFolder.
*
* @return the Bean or BeanFolder described by the given path.
*/
public static Object getBeanOrFolder(String path) {
return CommonUtils.isEmptyTrimmed(path) ? s_directory : getPath(path.split(PATH_SEPARATOR), 0);
}