Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 39246 invoked from network); 26 Aug 2006 12:45:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Aug 2006 12:45:42 -0000 Received: (qmail 93665 invoked by uid 500); 26 Aug 2006 12:45:40 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 93197 invoked by uid 500); 26 Aug 2006 12:45:38 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 93186 invoked by uid 99); 26 Aug 2006 12:45:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Aug 2006 05:45:38 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Aug 2006 05:45:36 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 873EC714293 for ; Sat, 26 Aug 2006 12:42:24 +0000 (GMT) Message-ID: <20465315.1156596144550.JavaMail.jira@brutus> Date: Sat, 26 Aug 2006 05:42:24 -0700 (PDT) From: "Rory Winston (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Resolved: (NET-128) [PATCH] Add support for XHDR NNTP command MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/NET-128?page=all ] Rory Winston resolved NET-128. ------------------------------ Resolution: Fixed Should have resolved, not closed > [PATCH] Add support for XHDR NNTP command > ----------------------------------------- > > Key: NET-128 > URL: http://issues.apache.org/jira/browse/NET-128 > Project: Commons Net > Issue Type: Improvement > Affects Versions: 1.1.0 > Environment: Operating System: other > Platform: Other > Reporter: Ted Wise > Priority: Minor > > Index: net/src/java/org/apache/commons/net/nntp/NNTP.java > =================================================================== > RCS file: > /home/cvspublic/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTP.java,v > retrieving revision 1.7 > diff -u -p -r1.7 NNTP.java > --- net/src/java/org/apache/commons/net/nntp/NNTP.java 4 Sep 2003 20:32:43 -0000 1.7 > +++ net/src/java/org/apache/commons/net/nntp/NNTP.java 23 Oct 2003 19:37:57 -0000 > @@ -110,9 +110,11 @@ import org.apache.commons.net.SocketClie > *

> *

> * @author Daniel F. Savarese > + * @author Ted Wise > * @see NNTPClient > * @see NNTPConnectionClosedException > * @see org.apache.commons.net.MalformedServerReplyException > + * @version $Id$ > ***/ > > public class NNTP extends SocketClient > @@ -998,6 +1000,35 @@ public class NNTP extends SocketClient > ***/ > public int xover(String selectedArticles) throws IOException { > return sendCommand(NNTPCommand.XOVER, selectedArticles); > + } > + > + /*** > + * A convenience method to send the NNTP XHDR command to the server, > + * receive the reply, and return the reply code. > + *

> + * @param header a String naming a header line (e.g., "subject"). See > + * RFC-1036 for a list of valid header lines. > + * @param selectedArticles a String representation of the range of > + * article headers required. This may be an article number, or a > + * range of article numbers in the form "XXXX-YYYY", where XXXX > + * and YYYY are valid article numbers in the current group. It > + * also may be of the form "XXX-", meaning "return XXX and all > + * following articles" In this revision, the last format is not > + * possible (yet). > + * @return The reply code received from the server. > + * @exception NNTPConnectionClosedException > + * If the NNTP server prematurely closes the connection as a result > + * of the client being idle or some other reason causing the server > + * to send NNTP reply code 400. This exception may be caught either > + * as an IOException or independently as itself. > + * @exception IOException If an I/O error occurs while either sending the > + * command or receiving the server reply. > + ***/ > + public int xhdr(String header, String selectedArticles) throws IOException { > + StringBuffer command = new StringBuffer(header); > + command.append(" "); > + command.append(selectedArticles); > + return sendCommand(NNTPCommand.XHDR, command.toString()); > } > > /** > Index: net/src/java/org/apache/commons/net/nntp/NNTPClient.java > =================================================================== > RCS file: > /home/cvspublic/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPClient.java,v > retrieving revision 1.5 > diff -u -p -r1.5 NNTPClient.java > --- net/src/java/org/apache/commons/net/nntp/NNTPClient.java 4 Sep 2003 > 20:32:43 -0000 1.5 > +++ net/src/java/org/apache/commons/net/nntp/NNTPClient.java 23 Oct 2003 > 19:37:58 -0000 > @@ -116,9 +116,11 @@ import org.apache.commons.net.MalformedS > *

> *

> * @author Daniel F. Savarese > + * @author Ted Wise > * @see NNTP > * @see NNTPConnectionClosedException > * @see org.apache.commons.net.MalformedServerReplyException > + * @version $Id$ > ***/ > > public class NNTPClient extends NNTP > @@ -1245,6 +1247,59 @@ public class NNTPClient extends NNTP > { > return > __retrieveArticleInfo(new String(lowArticleNumber + "-" + > + highArticleNumber)); > + } > + > + /*** > + * Private implementation of XHDR functionality. > + * > + * See > + * for legal agument formats. Alternatively, read RFC 1036. > + *

> + * @param header > + * @param articleRange > + * @return Returns a DotTerminatedMessageReader if successful, null > + * otherwise > + * @exception IOException > + */ > + private Reader __retrieveHeader(String header, String articleRange) > + throws IOException > + { > + if (!NNTPReply.isPositiveCompletion(xhdr(header, articleRange))) > + return null; > + > + return new DotTerminatedMessageReader(_reader_); > + } > + > + /** > + * Return an article header for a specified post. > + *

> + * @param header the header to retrieve > + * @param articleNumber the article to retrieve the header for > + * @return a DotTerminatedReader if successful, null otherwise > + * @throws IOException > + */ > + public Reader retrieveHeader(String header, int articleNumber) throws > IOException > + { > + return __retrieveHeader(header, new Integer(articleNumber).toString()); > + } > + > + /** > + * Return an article header for all articles between lowArticleNumber > + * and highArticleNumber, inclusively. > + *

> + * @param header > + * @param lowArticleNumber > + * @param highArticleNumber > + * @return a DotTerminatedReader if successful, null otherwise > + * @throws IOException > + */ > + public Reader retrieveHeader(String header, int lowArticleNumber, > + int highArticleNumber) > + throws IOException > + { > + return > + __retrieveHeader(header, new String(lowArticleNumber + "-" + > highArticleNumber)); > } > } > Index: net/src/java/org/apache/commons/net/nntp/NNTPCommand.java > =================================================================== > RCS file: > /home/cvspublic/jakarta-commons/net/src/java/org/apache/commons/net/nntp/NNTPCommand.java,v > retrieving revision 1.4 > diff -u -p -r1.4 NNTPCommand.java > --- net/src/java/org/apache/commons/net/nntp/NNTPCommand.java 4 Sep 2003 > 20:32:43 -0000 1.4 > +++ net/src/java/org/apache/commons/net/nntp/NNTPCommand.java 23 Oct 2003 > 19:37:58 -0000 > @@ -59,6 +59,8 @@ package org.apache.commons.net.nntp; > * the meaning of the codes, familiarity with RFC 977 is assumed. > *

> * @author Daniel F. Savarese > + * @author Ted Wise > + * @version $Id$ > ***/ > > public final class NNTPCommand > @@ -81,6 +83,7 @@ public final class NNTPCommand > public static final int STAT = 14; > public static final int AUTHINFO = 15; > public static final int XOVER = 16; > + public static final int XHDR = 17; > > // Cannot be instantiated > private NNTPCommand() > @@ -89,7 +92,7 @@ public final class NNTPCommand > static final String[] _commands = { > "ARTICLE", "BODY", "GROUP", "HEAD", "HELP", "IHAVE", "LAST", "LIST", > "NEWGROUPS", "NEWNEWS", "NEXT", "POST", "QUIT", "SLAVE", "STAT", > - "AUTHINFO", "XOVER" > + "AUTHINFO", "XOVER", "XHDR" > }; -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org