Subject:
|
Re: Almost there...almost there... :-,
|
Newsgroups:
|
lugnet.admin.nntp
|
Date:
|
Sat, 13 May 2000 01:04:02 GMT
|
Reply-To:
|
jsproat@[AvoidSpam]io.com
|
Viewed:
|
534 times
|
| |
| |
Todd Lehman wrote:
> In lugnet.admin.nntp, Jeremy H. Sproat writes:
> > It turns out I didn't need cookies after all!
> Well, cookies are an HTTP thing. If your client is posting articles, I think
> you'll find NTTP to be much simpler and cleaner for that. :-) All the HTTP
> posting mechanism does is opens up a single-use temporary NNTP session from
> the HTTP server to the NNTP server, IOW it's just a wrapper with extra
> encoding & decoding messes to worry about.
I'm using the HTTP interface, since there is support for that protocol in the
official Java libs.
There is no "official" NNTP lib for Java, though there is a 3rd-party lib I
will be evaluating when time permits. Then again, a minimalist NNTP session
would be very easy to implement by myself.
> If you send messages via HTTP, you'll have to write a custom layer to encode
> the data specially for LUGNET's news-posting submission script, versus simply
> opening a standard NNTP connection. :-)
That's pretty much what I'm doing. (1) However, I'm still not trapping any
errors encoded in the HTML after the POST. I'm not sure if I'll need to parse
the HTML or not. Is there a quick-and-dirty value in the HTTP header I can
exploit?
> Another disadvantage of posting via HTTP is that there is no defined API for
> that. IOW, the names of the fields are subject to change without notice (not
> likely, but possible if the scripts are ever reworked).
Good to know. I guess I'll have to throw together an NNTP or SMTP layer.
> > In slightly unrelated news, I *really* need a small-ish catchy name for this
> > app, and I frankly can't come up with anything decent. I am
> > eagerly entertaining suggestions. "Lugnetreader" is my preference, but it's
> > taken. (2) Would Java Lugnetreader ruffle any feathers? Dan?
> Are there things along the lines of "news ticker" or "stream(er)" or "avid"
> or "voracious" (just to toss out a few words) that you could incorporate?
Well, I like "avid". Can't say why, except: "Java" + "avid" = "Javid". :-,
> Some more random quetsions: What are your plans/hopes/dreams/etc. for the
> use and distribution of the app? Is it (or will it be) something that can
> be launched from a web browser and run separately? Or something that can be
> launched from a web browser and run in another window? Can it be installed
> locally and then launched via
> <A HREF="file:///path/to/reader">Launch The Reader</A>
The browser thing is pretty much out of the question at this time. Until Dan
and I come together on a common spooler->client protocol, there wouldn't be
much of a point of launching this as a browser applet.
Not that there isn't support for the browser applet paradigm! The GUI code is
completely separate from the client code. It's possible to put a spooler
client back-end onto this GUI, without changing the GUI code.
> Suzanne just reminded me that one of her design rework drawings/diagrams a
> while back for a new user-friendly LUGNET homepage had a spot for a thing to
> launch a "ticker tape" type of news app. Would you desire or allow your app
> to be launched or launchable from the LUGNET homepage?
That would be great. In fact, unless you implement a spooler on LUGNET for
LUGNET messages, the applet be very happy to use the existing avid client
code. However, I'm not sure how far away I am from at least a late-beta
stage. How nervous are you about serving beta-quality applets?
> A quick-win alternative is to invoke an instance of your web browser for
> composing a reply -- just point it at
> http://www.lugnet.com/news/post/?newsgroup:artnum
> and away it goes like magic. :-)
I have implemented this; in fact, the version currently on Sourceforge does
this. (2) I think I'll keep it, and allow the user to choose which posting
method (browser, HTTP, NNTP, SMTP, hocus-pocus, etc.) to invoke.
Cheers,
- jsproat
1. Here's a snippet of the HTTP-posting layer, for possible future reference:
String replyBody="NAME="+URLEncoder.encode(userName);
replyBody+="&EMAIL="+URLEncoder.encode(userEmail);
replyBody+="&ORG="+URLEncoder.encode(userOrg);
replyBody+="&newsgroups="+URLEncoder.encode(getHeader("Newsgroups:"));
replyBody+="&followupto="+URLEncoder.encode(getHeader("Followup-To:"));
replyBody+="&subject="+URLEncoder.encode(getHeader("Subject:"));
replyBody+="&body="+URLEncoder.encode(getText());
replyBody+="&acceptterms=1";
replyBody+="&submit="+URLEncoder.encode("Post Message");
replyBody+="&references="+URLEncoder.encode(getHeader("References:"));
replyBody+="&backtourl="+URLEncoder.encode("");
try {
URL postURL=new URL(postAddress);
HttpURLConnection conn=
(HttpURLConnection)postURL.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
PrintStream out=new PrintStream(conn.getOutputStream());
out.println(replyBody);
out.close();
System.err.println(conn.getResponseCode()+" "+
conn.getResponseMessage());
} catch (Exception e) {
e.printStackTrace();
}
2. Another snippet for reference:
void launchReply() {
String url=xrefToReplyUrl(getHeader("Xref:"));
viewUrl(url);
}
--
Jeremy H. Sproat <jsproat@io.com> ~~~ http://www.io.com/~jsproat/
Never leave a ferret to do a bunny's job.
- Bun Bun
|
|
Message is in Reply To:
| | Re: Almost there...almost there... :-,
|
| (...) Cool!!! (...) Well, cookies are an HTTP thing. If your client is posting articles, I think you'll find NTTP to be much simpler and cleaner for that. :-) All the HTTP posting mechanism does is opens up a single-use temporary NNTP session from (...) (25 years ago, 12-May-00, to lugnet.admin.nntp)
|
7 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|