當前位置: 首頁>>代碼示例>>Java>>正文


Java TextUtils.isBlank方法代碼示例

本文整理匯總了Java中org.apache.http.util.TextUtils.isBlank方法的典型用法代碼示例。如果您正苦於以下問題:Java TextUtils.isBlank方法的具體用法?Java TextUtils.isBlank怎麽用?Java TextUtils.isBlank使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.http.util.TextUtils的用法示例。


在下文中一共展示了TextUtils.isBlank方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: verifyPortText

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private boolean verifyPortText(){
    final String text = mPort.getText();

    if(TextUtils.isBlank(text)){
        return false;
    }

    try {
        int port = Integer.valueOf(text);

        if(port >= 0 && port < 65535){
            return true;
        }
    }catch (Exception e){
        e.printStackTrace();

    }

    return false;
}
 
開發者ID:huazhouwang,項目名稱:WIFIADB,代碼行數:21,代碼來源:RootWindow.java

示例2: verifyIpText

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private boolean verifyIpText(){
    for (JTextField field : mIPTextFields){
        final String text = field.getText();

        if(TextUtils.isBlank(text)){
            return false;
        }

        try{
            int ip = Integer.valueOf(text);
            if(ip < 0 || ip > 255){
                return false;
            }
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }

    return true;
}
 
開發者ID:huazhouwang,項目名稱:WIFIADB,代碼行數:22,代碼來源:RootWindow.java

示例3: extractCNs

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
static String[] extractCNs(final String subjectPrincipal) throws SSLException {
    if (subjectPrincipal == null) {
        return null;
    }
    final List<String> cns = new ArrayList<String>();
    final List<NameValuePair> nvps = DistinguishedNameParser.INSTANCE.parse(subjectPrincipal);
    for (int i = 0; i < nvps.size(); i++) {
        final NameValuePair nvp = nvps.get(i);
        final String attribName = nvp.getName();
        final String attribValue = nvp.getValue();
        if (TextUtils.isBlank(attribValue)) {
            throw new SSLException(subjectPrincipal + " is not a valid X500 distinguished name");
        }
        if (attribName.equalsIgnoreCase("cn")) {
            cns.add(attribValue);
        }
    }
    return cns.isEmpty() ? null : cns.toArray(new String[ cns.size() ]);
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:20,代碼來源:AbstractVerifierHC4.java

示例4: start

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
public void start() {
	this.getUuid();// 獲取uuid
	if (!TextUtils.isBlank(uuid)) {
		this.downQrCode();// 下載二維碼圖片
		this.showQrCode();// 顯示二維碼圖片
	}
	this.login();// 登錄操作
	if (!TextUtils.isBlank(redirectUri)) {// 跳轉到登錄後頁麵
		this.wxNewLoginPage();
	}
	if (!TextUtils.isBlank(skey)) {// 初始化微信
		this.wxInit();
	}
	if (syncKeyJsonObject != null) {// 開啟微信狀態通知
		this.wxStatusNotify();
		this.listenMsg();
	}
}
 
開發者ID:codingau,項目名稱:WxBot,代碼行數:19,代碼來源:WxBot.java

示例5: parse

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void parse(final SetCookie cookie, final String value)
        throws MalformedCookieException {
    Args.notNull(cookie, "Cookie");
    if (TextUtils.isBlank(value)) {
        throw new MalformedCookieException("Blank or null value for domain attribute");
    }
    // Ignore domain attributes ending with '.' per RFC 6265, 4.1.2.3
    if (value.endsWith(".")) {
        return;
    }
    String domain = value;
    if (domain.startsWith(".")) {
        domain = domain.substring(1);
    }
    domain = domain.toLowerCase(Locale.ROOT);
    cookie.setDomain(domain);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:19,代碼來源:BasicDomainHandler.java

示例6: parse

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void parse(final SetCookie cookie, final String value) throws MalformedCookieException {
    Args.notNull(cookie, "Cookie");
    if (TextUtils.isBlank(value)) {
        return;
    }
    final Matcher matcher = MAX_AGE_PATTERN.matcher(value);
    if (matcher.matches()) {
        final int age;
        try {
            age = Integer.parseInt(value);
        } catch (final NumberFormatException e) {
            return;
        }
        final Date expiryDate = age >= 0 ? new Date(System.currentTimeMillis() + age * 1000L) :
                new Date(Long.MIN_VALUE);
        cookie.setExpiryDate(expiryDate);
    }
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:20,代碼來源:LaxMaxAgeHandler.java

示例7: perform

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
/**
 * Publishes JSON payload to notify URL.
 */
@SuppressWarnings({ "MethodWithMultipleReturnPoints", "SuppressionAnnotation" })
@Override
public boolean perform ( AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener )
    throws InterruptedException, IOException
{
    this.listener              = notNull( listener, "Build listener" );
    boolean isIntermediateStep = build.getUrl().contains( "$" );
    boolean isSuccessResult    = build.getResult().isBetterOrEqualTo( Result.SUCCESS );

    if ( isIntermediateStep || TextUtils.isBlank ( notifyUrl ) || ( ! isSuccessResult )) { return true; }

    listener.getLogger().println( String.format( "Building notify JSON payload" ));
    String notifyJson = buildNotifyJson( build, build.getEnvironment( listener ));

    listener.getLogger().println( String.format( "Publishing notify JSON payload to %s", notifyUrl ));
    // noinspection ConstantConditions
    sendNotifyRequest( notifyUrl, notifyJson );
    return true;
}
 
開發者ID:evgeny-goldin,項目名稱:jenkins-notify-plugin,代碼行數:23,代碼來源:NotifyRecorder.java

示例8: doCheckNotifyUrl

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
public FormValidation doCheckNotifyUrl( @QueryParameter String notifyUrl ) {

            if ( TextUtils.isBlank( notifyUrl )) {
                return FormValidation.ok();
            }

            try {
                URI urlObject = new URI(notifyUrl);
                String scheme = urlObject.getScheme();
                String host   = urlObject.getHost();

                if ( ! (( "http".equals( scheme )) || ( "https".equals( scheme )))) {
                    return FormValidation.error( "URL should start with 'http://' or 'https://'" );
                }

                if ( TextUtils.isBlank( host )) {
                    return FormValidation.error( "URL should contain a host" );
                }

            } catch ( Exception e ) {
                return FormValidation.error( e, "Invalid URL provided" );
            }

            return FormValidation.ok();
        }
 
開發者ID:evgeny-goldin,項目名稱:jenkins-notify-plugin,代碼行數:26,代碼來源:NotifyRecorder.java

示例9: contribute

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@POST
public Object contribute(Contribution contribution) {
    LOG.debug("Contribution: " + contribution);

    if (contribution == null || TextUtils.isBlank(contribution.getToken())) {
        return getResponse(Response.Status.BAD_REQUEST);
    }

    Stripe.apiKey = "";
    Map<String, Object> params = new HashMap<>();
    params.put("amount", contribution.getAmount());
    params.put("currency", "eur");
    params.put("description", "REST Countries");
    params.put("source", contribution.getToken());

    try {
        Charge.create(params);
    } catch (AuthenticationException | InvalidRequestException | CardException | APIConnectionException | APIException e) {
        LOG.error(e.getMessage(), e);
        return getResponse(Response.Status.BAD_REQUEST);
    }

    return getResponse(Response.Status.ACCEPTED);
}
 
開發者ID:fayder,項目名稱:restcountries,代碼行數:25,代碼來源:StripeRest.java

示例10: processFileContents

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private GeneFeature processFileContents(GeneFile geneFile, File indexFile,
                                 File largeScaleIndexFile, File transcriptIndexFile,
                                      FeatureIndexedFileRegistrationRequest request) throws
        IOException {
    boolean doIndex = TextUtils.isBlank(request.getIndexPath());
    GeneFeature feature = null;
    GeneFeature firstFeature = null;
    lastFeature = null;

    // histogram stuff
    int featuresCount = 0;

    List<FeatureIndexEntry> allEntries = new ArrayList<>();
    // main loop - here we process gene file, add it's features to an index and create helper files: large scale
    // and transcript
    while (iterator.hasNext()) {
        // read the next line if available
        final long filePointer = iterator.getPosition();
        //add the feature to the index
        feature = (GeneFeature) iterator.next();

        if (firstFeature == null) {
            firstFeature = feature;
            lastFeature = feature;
            initializeHistogram(firstFeature);
        }

        featuresCount = processFeature(feature, featuresCount, doIndex, allEntries, request.isDoIndex(),
                                       filePointer);
    }

    processLastFeature(feature, featuresCount, geneFile, allEntries, request.isDoIndex());

    makeIndexes(geneFile, metaMap, indexFile, largeScaleIndexFile, transcriptIndexFile, doIndex, request);

    writerLargeScale.flush();
    writerTranscript.flush();

    return firstFeature;
}
 
開發者ID:react-dev26,項目名稱:NGB-master,代碼行數:41,代碼來源:GeneRegisterer.java

示例11: ContentType

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
ContentType(
        final String mimeType,
        final NameValuePair[] params) throws UnsupportedCharsetException {
    this.mimeType = mimeType;
    this.params = params;
    final String s = getParameter("charset");
    this.charset = !TextUtils.isBlank(s) ? Charset.forName(s) : null;
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:9,代碼來源:ContentType.java

示例12: CookieOrigin

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
public CookieOrigin(final String host, final int port, final String path, final boolean secure) {
    super();
    Args.notBlank(host, "Host");
    Args.notNegative(port, "Port");
    Args.notNull(path, "Path");
    this.host = host.toLowerCase(Locale.ROOT);
    this.port = port;
    if (!TextUtils.isBlank(path)) {
        this.path = path;
    } else {
        this.path = "/";
    }
    this.secure = secure;
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:15,代碼來源:CookieOrigin.java

示例13: parse

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void parse(final SetCookie cookie, final String value) throws MalformedCookieException {
    Args.notNull(cookie, "Cookie");
    if (TextUtils.isBlank(value)) {
        throw new MalformedCookieException("Blank or null value for domain attribute");
    }
    cookie.setDomain(value);
}
 
開發者ID:MyPureCloud,項目名稱:purecloud-iot,代碼行數:9,代碼來源:NetscapeDomainHandler.java

示例14: extractHost

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
/**
 * Extracts target host from the given {@link URI}.
 *
 * @param uri
 * @return the target host if the URI is absolute or <code>null</null> if the URI is
 * relative or does not contain a valid host name.
 *
 * @since 4.1
 */
public static HttpHost extractHost(final URI uri) {
    if (uri == null) {
        return null;
    }
    HttpHost target = null;
    if (uri.isAbsolute()) {
        int port = uri.getPort(); // may be overridden later
        String host = uri.getHost();
        if (host == null) { // normal parse failed; let's do it ourselves
            // authority does not seem to care about the valid character-set for host names
            host = uri.getAuthority();
            if (host != null) {
                // Strip off any leading user credentials
                final int at = host.indexOf('@');
                if (at >= 0) {
                    if (host.length() > at+1 ) {
                        host = host.substring(at+1);
                    } else {
                        host = null; // @ on its own
                    }
                }
                // Extract the port suffix, if present
                if (host != null) {
                    final int colon = host.indexOf(':');
                    if (colon >= 0) {
                        final int pos = colon + 1;
                        int len = 0;
                        for (int i = pos; i < host.length(); i++) {
                            if (Character.isDigit(host.charAt(i))) {
                                len++;
                            } else {
                                break;
                            }
                        }
                        if (len > 0) {
                            try {
                                port = Integer.parseInt(host.substring(pos, pos + len));
                            } catch (final NumberFormatException ex) {
                            }
                        }
                        host = host.substring(0, colon);
                    }
                }
            }
        }
        final String scheme = uri.getScheme();
        if (!TextUtils.isBlank(host)) {
            target = new HttpHost(host, port, scheme);
        }
    }
    return target;
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:62,代碼來源:URIUtilsHC4.java

示例15: split

import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private static String[] split(final String s) {
    if (TextUtils.isBlank(s)) {
        return null;
    }
    return s.split(" *, *");
}
 
開發者ID:xxonehjh,項目名稱:remote-files-sync,代碼行數:7,代碼來源:HttpClientBuilder.java


注:本文中的org.apache.http.util.TextUtils.isBlank方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。