Changeset 61b8e35


Ignore:
Timestamp:
Sep 5, 2005 5:33:33 AM (15 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
6afc64a
Parents:
3bb445f
git-author:
jrandom <jrandom> (09/05/05 05:33:33)
git-committer:
zzz <zzz@…> (09/05/05 05:33:33)
Message:

added rss2.0 support via rss.jsp
rss.jsp can in turn receive all the filters that index.jsp can - e.g. ?blog=blah or ?selector=group://foo,
and by default returns the latest 10 values (overridden with ?wanted=15). If you want it to pull
with a user's blog's preferences (filters, groups, etc), you can specify ?login=user&password=password

Location:
apps/syndie
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • apps/syndie/java/src/net/i2p/syndie/BlogManager.java

    r3bb445f r61b8e35  
    185185   
    186186    public String login(User user, String login, String pass) {
     187        if ( (login == null) || (pass == null) ) return "Login not specified";
    187188        Hash userHash = _context.sha().calculateHash(DataHelper.getUTF8(login));
    188189        Hash passHash = _context.sha().calculateHash(DataHelper.getUTF8(pass));
  • apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java

    r3bb445f r61b8e35  
    8484    }
    8585    public void render(User user, Archive archive, EntryContainer entry, String rawSML, Writer out, boolean cutBody, boolean showImages) throws IOException {
     86        prepare(user, archive, entry, rawSML, out, cutBody, showImages);
     87       
     88        _out.write(_preBodyBuffer.toString());
     89        _out.write(_bodyBuffer.toString());
     90        _out.write(_postBodyBuffer.toString());
     91        //int len = _preBodyBuffer.length() + _bodyBuffer.length() + _postBodyBuffer.length();
     92        //System.out.println("Wrote " + len);
     93    }
     94    protected void prepare(User user, Archive archive, EntryContainer entry, String rawSML, Writer out, boolean cutBody, boolean showImages) throws IOException {
    8695        _user = user;
    8796        _archive = archive;
     
    101110        _cutSize = 1024;
    102111        _parser.parse(rawSML, this);
    103         _out.write(_preBodyBuffer.toString());
    104         _out.write(_bodyBuffer.toString());
    105         _out.write(_postBodyBuffer.toString());
    106         //int len = _preBodyBuffer.length() + _bodyBuffer.length() + _postBodyBuffer.length();
    107         //System.out.println("Wrote " + len);
    108112    }
    109113   
     
    788792    }
    789793   
    790     private String getEntryURL() { return getEntryURL(_user != null ? _user.getShowImages() : false); }
    791     private String getEntryURL(boolean showImages) {
     794    public static final String sanitizeXML(String orig) {
     795        if (orig.indexOf('&') < 0) return orig;
     796        StringBuffer rv = new StringBuffer(orig.length()+32);
     797        for (int i = 0; i < orig.length(); i++) {
     798            if (orig.charAt(i) == '&')
     799                rv.append("&amp;");
     800            else
     801                rv.append(orig.charAt(i));
     802        }
     803        return rv.toString();
     804    }
     805    public static final String sanitizeXML(StringBuffer orig) {
     806        if (orig.indexOf("&") < 0) return orig.toString();
     807        for (int i = 0; i < orig.length(); i++) {
     808            if (orig.charAt(i) == '&') {
     809                orig = orig.replace(i, i+1, "&amp;");
     810                i += "&amp;".length();
     811            }
     812        }
     813        return orig.toString();
     814    }
     815   
     816    protected String getEntryURL() { return getEntryURL(_user != null ? _user.getShowImages() : false); }
     817    protected String getEntryURL(boolean showImages) {
    792818        if (_entry == null) return "unknown";
    793819        return "index.jsp?" + ArchiveViewerBean.PARAM_BLOG + "=" +
  • apps/syndie/java/src/net/i2p/syndie/web/ArchiveViewerBean.java

    r3bb445f r61b8e35  
    490490    }
    491491   
    492     private static List pickEntryURIs(User user, ArchiveIndex index, Hash blog, String tag, long entryId, String group) {
     492    public static List pickEntryURIs(User user, ArchiveIndex index, Hash blog, String tag, long entryId, String group) {
    493493        if ( (blog != null) && ( (blog.getData() == null) || (blog.getData().length != Hash.HASH_LENGTH) ) )
    494494            blog = null;
  • apps/syndie/jsp/index.jsp

    r3bb445f r61b8e35  
    55<title>SyndieMedia</title>
    66<link href="style.jsp" rel="stylesheet" type="text/css" />
     7<link href="rss.jsp?<%
     8if (request.getParameter("blog") != null)
     9  out.write("blog=" + request.getParameter("blog") + "&");
     10if (request.getParameter("entry") != null)
     11  out.write("entry=" + request.getParameter("entry") + "&");
     12if (request.getParameter("tag") != null)
     13  out.write("tag=" + request.getParameter("tag") + "&");
     14if (request.getParameter("selector") != null)
     15  out.write("selector=" + request.getParameter("selector") + "&");
     16%>" rel="alternate" type="application/rss+xml" />
    717</head>
    818<body>
  • apps/syndie/jsp/web.xml

    r3bb445f r61b8e35  
    88     <servlet-name>net.i2p.syndie.web.ArchiveServlet</servlet-name>
    99     <servlet-class>net.i2p.syndie.web.ArchiveServlet</servlet-class>
     10    </servlet>
     11     
     12    <servlet>
     13     <servlet-name>net.i2p.syndie.web.RSSServlet</servlet-name>
     14     <servlet-class>net.i2p.syndie.web.RSSServlet</servlet-class>
    1015    </servlet>
    1116     
     
    2025      <url-pattern>/archive/*</url-pattern>
    2126    </servlet-mapping>
     27    <servlet-mapping>
     28      <servlet-name>net.i2p.syndie.web.RSSServlet</servlet-name>
     29      <url-pattern>/rss.jsp</url-pattern>
     30    </servlet-mapping>
    2231   
    2332    <session-config>
Note: See TracChangeset for help on using the changeset viewer.