Package org.xbill.DNS

Examples of org.xbill.DNS.TXTRecord


                                            records.add(new SPFRecord(hostname,
                                                    DClass.IN, 3600, (String) value));
                                        }
                                    } else if ("TXT".equals(type)) {
                                        if (value instanceof List) {
                                            records.add(new TXTRecord(hostname,
                                                    DClass.IN, 3600, (List) value));
                                        } else {
                                            records.add(new TXTRecord(hostname,
                                                    DClass.IN, 3600, (String) value));
                                        }
                                    } else {
                                        if (!((String) value).endsWith(".")) {
                                            value = ((String) value)+".";
View Full Code Here


                    case Type.PTR:
                        PTRRecord ptr = (PTRRecord) rr[i];
                        records.add(IPAddr.stripDot(ptr.getTarget().toString()));
                        break;
                    case Type.TXT:
                        TXTRecord txt = (TXTRecord) rr[i];
                        if (txt.getStrings().size() == 1) {
                            records.add(txt.getStrings().get(0));
                        } else {
                            StringBuffer sb = new StringBuffer();
                            for (Iterator it = txt.getStrings().iterator(); it
                                    .hasNext();) {
                                String k = (String) it.next();
                                sb.append(k);
                            }
                            records.add(sb.toString());
View Full Code Here

                        case PTR:
                            PTRRecord ptr = (PTRRecord) rr[i];
                            res = IPAddr.stripDot(ptr.getTarget().toString());
                            break;
                        case TXT:
                            TXTRecord txt = (TXTRecord) rr[i];
                            res = txt.rdataToString();
                            break;
                        case SPF:
                            SPFRecord spf = (SPFRecord) rr[i];
                            res = spf.rdataToString();
                            break;
View Full Code Here

        private String concatenateTxtRecordValues(Record[] records) {
            if (records == null || records.length == 0)
                return null;
            StringBuilder builder = new StringBuilder();
            for (Record record : records) {
                TXTRecord txtRecord = (TXTRecord) record;
                if (builder.length() != 0)
                    builder.append(EOL);
                for (Object string : txtRecord.getStrings()) {
                    if (builder.length() != 0)
                        builder.append(EOL);
                    builder.append(string);
                }
            }
View Full Code Here

                                            records.add(new SPFRecord(hostname,
                                                    DClass.IN, 3600, (String) value));
                                        }
                                    } else if ("TXT".equals(type)) {
                                        if (value instanceof List) {
                                            records.add(new TXTRecord(hostname,
                                                    DClass.IN, 3600, (List) value));
                                        } else {
                                            records.add(new TXTRecord(hostname,
                                                    DClass.IN, 3600, (String) value));
                                        }
                                    } else {
                                        if (!((String) value).endsWith(".")) {
                                            value = ((String) value)+".";
View Full Code Here

        List<String> txtR = new ArrayList<String>();
        Record[] records = lookupNoException(hostname, Type.TXT, "TXT");
   
        if (records != null) {
           for (int i = 0; i < records.length; i++) {
               TXTRecord txt = (TXTRecord) records[i];
               txtR.add(txt.rdataToString());
           }
       
        }
        return txtR;
    }
View Full Code Here

        if (rr != null && rr.length > 0) {
            records = new ArrayList<String>();
            for (int i = 0; i < rr.length; i++) {
                switch (rr[i].getType()) {
                case Type.TXT:
                    TXTRecord txt = (TXTRecord) rr[i];
                    if (txt.getStrings().size() == 1) {
                        // This was required until dnsjava 2.0.6 because dnsjava
                        // was escaping
                        // the result like it was doublequoted (JDKIM-7).
                        // records.add(((String)txt.getStrings().get(0)).replaceAll("\\\\",
                        // ""));
                        records.add(((String) txt.getStrings().get(0)));
                    } else {
                        StringBuilder sb = new StringBuilder();
                        for (Iterator<String> it = txt.getStrings()
                                .iterator(); it.hasNext();) {
                            String k = it.next();
                            // This was required until dnsjava 2.0.6 because
                            // dnsjava was escaping
                            // the result like it was doublequoted (JDKIM-7).
View Full Code Here

    else if (rec instanceof PTRRecord) {
      PTRRecord ptr = (PTRRecord) rec;
      rmap.put("target", ptr.getTarget().toString());
    }
    else if (rec instanceof TXTRecord) {
      TXTRecord textRec = (TXTRecord) rec;
      rmap.put("text", textRec.toString());
    }
    else if (rec instanceof CNAMERecord) {
      CNAMERecord cname = (CNAMERecord) rec;
      rmap.put("alias", cname.getAlias().toString());
    }
View Full Code Here

                                            records.add(new SPFRecord(hostname,
                                                    DClass.IN, 3600, (String) value));
                                        }
                                    } else if ("TXT".equals(type)) {
                                        if (value instanceof List<?>) {
                                            records.add(new TXTRecord(hostname,
                                                    DClass.IN, 3600, (List<?>) value));
                                        } else {
                                            records.add(new TXTRecord(hostname,
                                                    DClass.IN, 3600, (String) value));
                                        }
                                    } else {
                                        if (!((String) value).endsWith(".")) {
                                            value = ((String) value)+".";
View Full Code Here

                    case Type.PTR:
                        PTRRecord ptr = (PTRRecord) rr[i];
                        records.add(IPAddr.stripDot(ptr.getTarget().toString()));
                        break;
                    case Type.TXT:
                        TXTRecord txt = (TXTRecord) rr[i];
                        if (txt.getStrings().size() == 1) {
                            records.add((String)txt.getStrings().get(0));
                        } else {
                            StringBuffer sb = new StringBuffer();
                            for (Iterator<String> it = txt.getStrings().iterator(); it
                                    .hasNext();) {
                                String k = (String) it.next();
                                sb.append(k);
                            }
                            records.add(sb.toString());
View Full Code Here

TOP

Related Classes of org.xbill.DNS.TXTRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.