📄 htmlparseddocument.java
字号:
/* CVS ID: $Id: HTMLParsedDocument.java,v 1.3 2000/09/13 10:35:46 wastl Exp $ */
package net.wastl.webmail.ui.html;
import gnu.regexp.*;
import net.wastl.webmail.server.HTTPSession;
import net.wastl.webmail.server.Storage;
// XXX This class is broken!
/*
* HTMLParsed.java
*
* Created: Fri Feb 5 08:34:34 1999
*
* Copyright (C) 1999-2000 Sebastian Schaffert
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
*
* @author Sebastian Schaffert
* @version $Revision: 1.3 $
*/
public class HTMLParsedDocument extends HTMLDocument {
protected static RE regexp;
public HTMLParsedDocument(HTTPSession sess, String cont) {
super("WebMail Mailbox for "+sess.getEnv("LOGIN"),cont);
long start=System.currentTimeMillis();
if(regexp == null) {
try {
regexp=new RE("<<([^>]+)>>",RE.REG_ICASE & RE.REG_MULTILINE,RESyntax.RE_SYNTAX_PERL5);
} catch(Exception e) {
e.printStackTrace();
}
}
String subst="";
REMatch[] matches=regexp.getAllMatches(cont);
for(int i=0;i<matches.length;i++) {
try {
subst=sess.getEnv(matches[i].substituteInto("$1"));
if(subst==null) {
subst="";
}
} catch(Exception e) {
e.printStackTrace();
subst="";
}
try {
content=regexp.substitute(content,subst,0);
} catch(NullPointerException e) {
System.err.println(content);
System.err.println(subst);
System.err.println(regexp);
e.printStackTrace();
}
}
}
public HTMLParsedDocument(Storage loader, HTTPSession sess, String docname) {
// this(sess,loader.getTextFile(loader.getStringResource(docname,sess.getLocale()),sess.getLocale()));
}
} // HTMLFrameSet
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -