Package org.sonews.storage
Klasse ArticleImpl
java.lang.Object
org.sonews.storage.ArticleImpl
- Alle implementierten Schnittstellen:
Article
Represents a newsgroup article.
- Seit:
- n3tpd/0.1
- Autor:
- Christian Lins, Dennis Schwerdel
-
Feldübersicht
Felder -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungArticleImpl(jakarta.mail.Message msg) Creates an Article instance using the data from the javax.mail.Message object.ArticleImpl(String headers, byte[] body) Creates a new Article object using the date from the given raw data. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprivate StringGenerates a message id for this article and sets it into the header object.Enumeration<?> byte[]getBody()Returns the body string.String[]Convenience method for getHeader(name, false).String[]Returns the header field with given name.Returns the Message-ID of this ArticleImpl.getUser()booleanhasBody()private byte[]readContent(jakarta.mail.Message in) Reads from the given Message into a byte array.voidremoveHeader(String headerKey) Removes the header identified by the given key.voidsetBody(byte[] body) voidvoidSets the header value identified through the header name.voidsetHeaders(jakarta.mail.internet.InternetHeaders headers) Sets the headers of this Article.voidThis method is to be called from POST Command implementation.toString()private voidprivate voidChecks some headers for their validity and generates an appropriate Path-header for this host if not yet existing.private void
-
Felddetails
-
headers
protected jakarta.mail.internet.InternetHeaders headers -
headerSrc
-
body
private byte[] body -
sender
-
log
private final org.slf4j.Logger log
-
-
Konstruktordetails
-
ArticleImpl
public ArticleImpl() -
ArticleImpl
Creates a new Article object using the date from the given raw data.- Parameter:
headers-body-
-
ArticleImpl
Creates an Article instance using the data from the javax.mail.Message object. This constructor is called by the Mailinglist gateway.- Parameter:
msg-- Löst aus:
IOExceptionjakarta.mail.MessagingException- Siehe auch:
-
-
Methodendetails
-
readContent
private byte[] readContent(jakarta.mail.Message in) throws IOException, jakarta.mail.MessagingException Reads from the given Message into a byte array.- Parameter:
in-- Gibt zurück:
- Löst aus:
IOExceptionjakarta.mail.MessagingException
-
removeHeader
Removes the header identified by the given key.- Angegeben von:
removeHeaderin SchnittstelleArticle- Parameter:
headerKey-
-
generateMessageID
Generates a message id for this article and sets it into the header object. You have to update the JDBCDatabase manually to make this change persistent. Note: a Message-ID should never be changed and only generated once.- Löst aus:
UnsupportedEncodingException
-
getBody
public byte[] getBody()Returns the body string. -
getGroups
-
setBody
public void setBody(byte[] body) -
setGroup
-
getMessageID
Returns the Message-ID of this ArticleImpl. If the appropriate header is empty, a new Message-ID is created.- Angegeben von:
getMessageIDin SchnittstelleArticle- Gibt zurück:
- Message-ID of this ArticleImpl.
-
toString
-
getUser
- Gibt zurück:
- sender – currently logged user – or null, if user is not authenticated.
-
setUser
This method is to be called from POST Command implementation.- Parameter:
sender- current username – or null, if user is not authenticated.
-
getHeader
Returns the header field with given name. -
getHeader
Beschreibung aus Schnittstelle kopiert:ArticleConvenience method for getHeader(name, false). -
setHeader
Sets the header value identified through the header name. -
getAllHeaders
- Angegeben von:
getAllHeadersin SchnittstelleArticle
-
getHeaderSource
- Angegeben von:
getHeaderSourcein SchnittstelleArticle- Gibt zurück:
- Header source code of this Article.
-
setHeaders
public void setHeaders(jakarta.mail.internet.InternetHeaders headers) Sets the headers of this Article. If headers contain no Message-Id a new one is created.- Angegeben von:
setHeadersin SchnittstelleArticle- Parameter:
headers-
-
validateHeaders
private void validateHeaders()Checks some headers for their validity and generates an appropriate Path-header for this host if not yet existing. This method is called by some Article constructors and the method setHeaders(). -
validatePathHeader
private void validatePathHeader() -
validateDateHeader
private void validateDateHeader() -
hasBody
public boolean hasBody()
-