[JBoss-user] [Installation & Configuration] - After upgrading from 3.2.3 to 3.2.6, now xslt routines throw

2004-11-15 Thread greiezer
Hi, our webhoster forced us to upgrade our jboss 3.2.3 installation to 3.2.6. 
The deployed application still runs as expected but there are now many xslt 
related error messages in the server log.

This is what I see:
12:44:08,699 INFO  [STDOUT] [Error] :99:80: Document root element 
"xsl:stylesheet", must match DOCTYPE root "stylesheet".
12:44:08,700 INFO  [STDOUT] [Error] :99:80: Element type "xsl:stylesheet" must 
be declared.
12:44:08,704 INFO  [STDOUT] [Error] :105:27: Element type "xsl:output" must be 
declared.
12:44:08,710 INFO  [STDOUT] [Error] :107:29: Element type "xsl:template" must 
be declared.
12:44:08,712 INFO  [STDOUT] [Error] :108:15: Element type "html" must be 
declared.
12:44:08,714 INFO  [STDOUT] [Error] :109:19: Element type "head" must be 
declared.
12:44:08,715 INFO  [STDOUT] [Error] :110:49: Element type "xsl:call-template" 
must be declared.
12:44:08,717 INFO  [STDOUT] [Error] :112:19: Element type "body" must be 
declared.

I am not so much into xslt anymore, but maybe some of you have experienced the 
same problem and can point me to the couse of this problem :-)

---
Transomer setup
---

  | try {
  | // Step 1: create a DocumentBuilderFactory and configure it
  | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
  | 
  | // Optional: set various configuration options
  | factory.setValidating( false );
  | factory.setIgnoringComments( true );
  | factory.setIgnoringElementContentWhitespace( true );
  | factory.setCoalescing( false );
  | factory.setExpandEntityReferences( true );
  | 
  | // Step 2: create a DocumentBuilder that satisfies the constraints
  | // specified by the DocumentBuilderFactory
  | DocumentBuilder builder = factory.newDocumentBuilder();
  | Document document = builder.parse( new ByteArrayInputStream( 
inputXML.getBytes(encoding) ) );
  | DOMSource domsource = new DOMSource( document );
  | //
  | StreamSource stylesource = 
  |  new StreamSource( new ByteArrayInputStream( 
mailTemplate.getBytes(encoding) ) );
  | StringWriter sw = new StringWriter();
  | StreamResult result = new StreamResult( sw );
  | //
  | TransformerFactory tFactory = TransformerFactory.newInstance();
  | Transformer transformer = tFactory.newTransformer( stylesource );   
 
  | // 
  | transformer.setOutputProperty(OutputKeys.METHOD, outputMethod);
  | //transformer.setOutputProperty(OutputKeys.METHOD, "xml");
  | transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
  | transformer.setOutputProperty(OutputKeys.INDENT, "yes");
  | transformer.transform( domsource, result );
  | 
  | emailBody = sw.toString();
  | }
  | 

one of the stylesheets


  | 
  |  
  |  
  | ...
  | many more of them
  | ...
  |  
  |  
  | ]>
  | http://www.w3.org/1999/XSL/Transform";>
  | http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
  | encoding="ISO-8859-1"
  | indent="yes" />
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  | 
  |
  | 
  | XY
  |  some styles here 
  |
  |
  |
  | http://domain.com/ui/media/firmnamebanner.gif"; 
alt="firmnamebanner.gif"  />
  |
  | 
  |
  | 
  | Thank you for contacting  XY.
  | 
  | 
  | 
  | Text for transfer:  ()
  | 
  | Amount to transfer:  
  | Thank you for using XY.
  | 
  |  
  |
  |
  |
  | 
  | This e-mail is automatically forwarded. Please do not reply on 
this e-mail since you will not get an answer back.
  | 
  |
  | 
  | 
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3855194#3855194

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3855194


---
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Security & JAAS/JBoss] - Re: JAAS not picking up

2004-09-01 Thread greiezer
thanks :-)

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3846946#3846946

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3846946


---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Security & JAAS/JBoss] - JAAS not picking up

2004-09-01 Thread greiezer
Hi

I'm trying to secure the admin pages of my applications.
The problem is that I do not get promted for login/password when using this 
/ppwebshop/admin/*
I do get get promted for login/password when using /* 
though.

Any ideas?

An url to secure:
http://127.0.0.1:8080/ppwebshop/admin/categoryedit.jspa


   

HtmlAdaptor
security config that only allows users with the role 
PPShopAdmin to access shop admin pages.
/ppwebshop/admin/*
GET
POST


PPShopAdmin




BASIC
PPWebShop Admin



PPShopAdmin



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3846856#3846856

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3846856


---
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - Re: OFFSET & LIMIT does not make it into the generated sql

2004-07-04 Thread greiezer
Joachim,

Resetting the ql-compiler to its default value did the trick!

org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLCompiler
  | 

I am a lucky man now:-)
Thank you for your help

Andreas

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840892#3840892

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840892


---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - Re: OFFSET & LIMIT does not make it into the generated sql

2004-07-04 Thread greiezer
Hi Joachim,

Sorry, didn't want do upset you :-)
It was and is also my intention to post a working solution to the forum.
I am not able to figure it out my self and you wrote in your reply that you have it 
working for you.
I would very much appreciate if you could find some time to look at the code and 
debugging output below.

Regards

Andreas
I am using the following code:

  | -
  |   CategoryEJB
  | -
  | 
  |  * @jboss.query
  |  *  description="This generates jboss-ql and overwrites the original query 
from the ejbSelectMethod"
  |  *  signature="java.util.Collection ejbSelectActiveProducts( 
my.domain.catalog.interfaces.CategoryLocal category, int start, int count )"
  |  *  query="SELECT OBJECT(p) FROM Category AS c, IN (c.products) AS p WHERE c = 
?1
  |  * AND p.state IS NOT NULL
  |  * AND p.state = 'passiv'
  |  * ORDER BY p.name OFFSET ?2 LIMIT ?3"
  |  *  strategy="on-load"
  |  *  page-size="6"
  |  *
  |  * @jboss.persistence
  |  *  create-table="${jboss.create.table}"
  |  *  remove-table="${jboss.remove.table}"
  |  */
  | public abstract class CategoryEJB   implements EntityBean
  | ...
  | 
  | /**
  |  * @ejb.interface-method
  |  */
  | public Collection getActiveProducts( int start, int count ) 
  | throws javax.ejb.FinderException {
  | CategoryLocal category = (CategoryLocal) _ctx.getEJBLocalObject();
  | return ejbSelectActiveProducts( category, start, count );
  | }
  | 
  | ...
  | 
  | //==
  | // ejbSelect methods
  | //==
  | 
  | /** 
  |  * @ejb.select
  |  *  query="SELECT OBJECT(p) FROM Category AS c, IN (c.products) AS p WHERE 
c = ?1 
  |  * AND p.state IS NOT NULL
  |  * AND p.state = 'passiv'"
  |  */
  | public abstract Collection ejbSelectActiveProducts( CategoryLocal category, 
int start, int count ) throws FinderException;
  | 
  | -
  |   ejb-jar.xml
  | -
  | 
  |   
  |  Category
  |  my.domain.catalog.interfaces.CategoryLocalHome
  |  my.domain.catalog.interfaces.CategoryLocal
  |  
  | 
  | 
  |ejbSelectActiveProducts
  |
  |   
my.domain.catalog.interfaces.CategoryLocal
  |   int
  |   int
  |
  | 
  | 
  |  
  |   
  | 
  | -
  |   jbosscmp-jdbc.xml
  | -
  | 
  |   
  |  Category
  |  true
  |  false
  |  T_CATEGORY
  |  
  | 
  | 
  |ejbSelectActiveProducts
  |
  |   
my.domain.catalog.interfaces.CategoryLocal
  |   int
  |   int
  |
  | 
  | 
  | 
  | on-load
  | 6
  | 
  |  
  |   
  | 
  | -
  |   PPWebShopEJB, (SLSB session facade)
  | -
  | 
  | public abstract class PPWebShopEJB implements SessionBean {
  | 
  | /**
  |  * @throws FinderException if the category not found
  |  * @ejb.interface-method
  |  */
  | public Page getProducts( String categoryId, int offset, int limit )
  | throws FinderException
  | {
  | try
  | {
  | CategoryLocal cat = CategoryUtil.getLocalHome(  ).findByPrimaryKey( 
categoryId );
  | return toPage( cat.getActiveProducts( offset, limit ), offset, limit, 
ProductValue.class );
  | }
  | catch ( NamingException n )
  | {
  | throw new EJBException( n );
  | }
  | }
  | 
  | private Page toPage( Collection col, int start, int count, Class type )
  | {
  | _log.debug(" toPage( col, start, count, type )" );
  | _log.debug("  --> col   : " + col );
  | _log.debug("  --> start : " + start );
  | _log.debug("  --> count : " + count );
  | _log.debug("  --> type  : " + type );
  | _log.debug("");
  |
  | int size = col.size(  );
  | _log.debug("  --> size() : " + size );
  | 
  | if ( size == 0 ) { return Page.EMPTY_PAGE; }
  | 
  | ArrayList lst = new ArrayList(  );
  | Iterator  it = col.iterator(  );
  | 
  | for ( int i = 0, imax = start + count; ( i

[JBoss-user] [Persistence & CMP/JBoss] - Error for findAll( ) with EJBQLToSQL92Compiler on

2004-07-04 Thread greiezer
I think this is a bug in the EJBQLToSQL92Compiler:
If there is a space character between the () in in the findAll() finder method, 
jboss3.2.5 will throw the following error at deployment time:
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
  | at java.lang.String.charAt(String.java:444)
  | at 
org.jboss.mx.loading.UnifiedClassLoader.loadClassLocally(UnifiedClassLoader.java:305)
  | 
So if you use:
  |  * @ejb.finder
  |  *  signature="java.util.Collection findAll( )"
  |  *  query="SELECT OBJECT(o) FROM WebOrder AS o" 
  | 
You will get the error described above, but then you wont if you use:

  |  * @ejb.finder
  |  *  signature="java.util.Collection findAll()"
  |  *  query="SELECT OBJECT(o) FROM WebOrder AS o" 
  | 

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840883#3840883

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840883


---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - Re: OFFSET & LIMIT does not make it into the generated sql

2004-07-03 Thread greiezer
Thanks for the reply Joachim.

OK,  I have 107 products which are related to a category.
CategoryLocal cat = CategoryUtil.getLocalHome(  ).findByPrimaryKey( categoryId );
  | Collection products = cat.getActiveProducts( offset, limit )

At this point I would expect that 'products' has size=limit, but the actual size is 
107.

So to actually actually access the wanted data in the first run, one must use a for 
loop.

  | for ( int i = 0, imax = offset + limit; ( i < imax ) && it.hasNext(  ); i++ )
  | {
  | _log.debug("  --> for : i : " + i );
  | Object obj = it.next(  );
  | if ( i >= offset )
  | {
  |  _log.debug("  --> lst.add( getData( obj, type ) ) : " + obj + ", " + type 
);
  |  lst.add( getData( obj, type ) );
  | }
  | }
  | 

Is this also the case for you, or can you just iterate over a 'limit'-sizes collection?

Andreas

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840863#3840863

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840863


---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - OFFSET & LIMIT does not make it into the generated sql

2004-07-02 Thread greiezer
Hi,

Im using the following JBoss-QL query in JBoss 3.2.3 for a ejbSelect method:

SELECT OBJECT(p) FROM Category AS c, IN (c.products) AS p 
WHERE c = ?1 
AND p.state IS NOT NULL 
AND p.state = 'passiv' 
ORDER BY p.name 
OFFSET ?2 
LIMIT ?3

But as yoy can see in the following the generated sql does not contain the OFFSET & 
LIMIT options.

21:02:35,221 DEBUG [Category#ejbSelectActiveProducts] SQL: 
SELECT t0_p.productId, t0_p.type, t0_p.manufacturer, t0_p.productLink, 
t0_p.name, t0_p.description, t0_p.listPrice, t0_p.marge, t0_p.porto, t0_p.state, 
t0_p.registered, t0_p.modified, t0_p.weight, t0_p.keyWords, t0_p.category_fk 
FROM t_category t1_c INNER JOIN t_product t0_p ON 
t1_c.categoryId=t0_p.category_fk 
WHERE (t1_c.categoryId=?) 
AND t0_p.state IS  NOT NULL 
AND t0_p.state = 'passiv' 
ORDER BY t0_p.name ASC

I have also downloaded jboss-3.2.5, but the generated sql is here too missing the 
OFFSET & LIMIT options.
Then I experimented with the EJBQLToSQL92Compiler setting in 
(jboss-3.2.5/server/default/conf/standardjbosscmp-jdbc.xml) but that does not help 
either.
What else could I try?
Has anybody managed to get this working?

Regards

Andreas



Code snippets from the class:

 * @jboss.query
 *  description="This generates jboss-ql and overwrites the original query from 
the ejbSelectMethod"
 *  signature="java.util.Collection ejbSelectActiveProducts( 
my.domain.catalog.interfaces.CategoryLocal category, int start, int count )"
 *  query="SELECT OBJECT(p) FROM Category AS c, IN (c.products) AS p WHERE c = ?1
 * AND p.state IS NOT NULL
 * AND p.state = 'passiv'
 * ORDER BY p.name OFFSET ?2 LIMIT ?3"
 *  strategy="on-load"
 *  page-size="128"
 *
 * @jboss.persistence
 *  create-table="${jboss.create.table}"
 *  remove-table="${jboss.remove.table}"
 */
public abstract class CategoryEJB   implements EntityBean
{
...



/** 
 * @ejb.select
 *  query="SELECT OBJECT(p) FROM Category AS c, IN (c.products) AS p WHERE c = 
?1 
 * AND p.state IS NOT NULL
 * AND p.state = 'passiv'"
 */
public abstract Collection ejbSelectActiveProducts( CategoryLocal category, int 
start, int count ) throws FinderException;




   
  ...
  org.jboss.ejb.plugins.cmp.jdbc.EJBQLToSQL92Compiler
   







View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840824#3840824

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840824


---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - Re: Foreign key constraint not added as requested

2004-06-30 Thread greiezer
Good to know, thank you for your answer.
Regards,

Andreas

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840511#3840511

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840511


---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - Foreign key constraint not added as requested

2004-06-29 Thread greiezer
Hei all,

This is a question for JBoss 3.2.3 
I have an application running with several EJB that use CMP/CMR.
At server startup i see the following output in the log, which makes me worrying if 
there is something wrong here:

20:12:44,126 DEBUG [Customer] Executing SQL: CREATE TABLE t_customer (userId 
varchar(20) NOT NULL, firstname varchar(20), lastname varchar(20), email varchar(40), 
telephone varchar(20), language varchar(3), currency varchar(3), securityquestion_fk 
varchar(32), account_fk varchar(20), CONSTRAINT pk_t_customer PRIMARY KEY (userId))
20:12:44,137 INFO  [Customer] Created table 't_customer' successfully.
20:12:44,138 DEBUG [Customer] Foreign key constraint not added as requested: 
relationshipRolename=customer-has-securityquestion
20:12:44,139 DEBUG [Customer] Foreign key constraint not added as requested: 
relationshipRolename=securityquestion-belongs_to-customer
20:12:44,141 DEBUG [Customer] Foreign key constraint not added as requested: 
relationshipRolename=customer-has-account
20:12:44,165 DEBUG [Customer] Foreign key constraint not added as requested: 
relationshipRolename=account-belongs_to-customer
20:12:44,167 DEBUG [Customer] Foreign key constraint not added as requested: 
relationshipRolename=customer-has-orders
20:12:44,172 DEBUG [Customer] Foreign key constraint not added as requested: 
relationshipRolename=order-belongs_to-customer
20:12:44,173 DEBUG [Customer#findByPrimaryKey] SQL: SELECT userId FROM t_customer 
WHERE userId=?
20:12:44,174 DEBUG [Customer] Added findByPrimaryKey query command for local home 
interface
20:12:44,175 DEBUG [Customer#findByEmail] EJB-QL: SELECT OBJECT(c) FROM Customer AS c 
WHERE c.email = ?1

The app is working and I have not yet observed any problems, but maybe there are 
problems on the way..?

Please tell me if I have to take any action in regard to the output in  the log.

Regards

Andreas

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840337#3840337

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840337


---
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Installation & Configuration] - Re: JBoss, JavaMail and non-asscii characters

2004-02-27 Thread greiezer
To bad that nobody could give me some hints on my problem.

Found the solution by my self:
Had to set the encoding attribute for the javac ant task



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823361#3823361

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3823361


---
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Installation & Configuration] - JBoss, JavaMail and non-asscii characters

2004-02-25 Thread greiezer
Using the emailer application attached to end of this mail - I'am sending text/plain 
and text/html multipart messages containing non-ascii (danish) characters.

When executed inside NetBeans, mails get encoded as expected.

But my EmailerMDB uses exactly the same code for sending emails and executed inside 
the JBoss container produces incorrect email messages.
Non-ascii characters are not encoded as expected.

Does anybody know if there is some property that needs to be set at server startup?
Or is there something else I have not been aware of?

Regards

Andreas



  JBoss Bootstrap Environment

  JBOSS_HOME: /usr/local/jboss/home

  JAVA: /Library/Java/Home/bin/java

  JAVA_OPTS:  -Dprogram.name=run.sh -Dfile.encoding=UTF-8

  CLASSPATH: /usr/local/jboss/home/bin/run.jar:/Library/Java/Home/lib/tools.jar



00:29:25,163 INFO  [Server] Starting JBoss (MX MicroKernel)...
00:29:25,167 INFO  [Server] Release ID: JBoss [WonderLand] 3.2.3 (build: 
CVSTag=JBoss_3_2_3 date=200311301445)
00:29:25,652 INFO  [ServerInfo] Java version: 1.4.2_01,Apple Computer, Inc.
00:29:25,653 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Client VM 
1.4.2-001-31,"Apple Computer, Inc."
00:29:25,654 INFO  [ServerInfo] OS-System: Mac OS X 10.3.2,ppc



/*
 * MailSender2.java
 *
 * Created on February 25, 2004, 9:27 PM
 */

package xpetstore.util;

import java.awt.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;
import javax.activation.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.swing.*;


/**
 *
 * @author  andreas
 */
public class MailSender2 extends JFrame implements ActionListener {

JTextField field = new JTextField();
JButton button = new JButton("Send");

public MailSender2() {
getContentPane().setLayout(new BorderLayout());
getContentPane().add("Center", field);
getContentPane().add("South", button);
button.addActionListener(this);
String s = "Hvis du ikke kan lÃ|se denne e-mail, "
.concat("kan det skyldes, at dit e-mail-program ikke kan lÃ|se HTML.\nDu har 
")
.concat("mulighed for at modtage e-mailen som almindelig tekst, ")
.concat("hvis du Ã|ndrer dine indstillinger ")
.concat("http://prispiraten.kgbinternet.com/ppwebshop/signon.jspa";);

field.setText(s);
}

public void actionPerformed(ActionEvent ev) {
if (ev.getSource() == button) {
String text = field.getText();
send(text);
}
}

void send(String msg) {
try {
Properties props = new Properties();
props.put("mail.smtp.host", "mail.tiscali.dk");
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);

MimeMessage message = new MimeMessage( session );
ByteArrayInputStream is = new ByteArrayInputStream(msg.getBytes());
MimeBodyPart plaintext = new MimeBodyPart( );
plaintext.setContent(msg, "text/plain; charset=\"UTF-8\"");


MimeBodyPart htmltext = new MimeBodyPart( );
htmltext.setContent(
EmailMessages.getWelcomeMessage("ÃÂÃÂÃÂ Ã? ÃÂ ÃÂ"),
"text/html; charset=\"UTF-8\""
);

Multipart mp = new MimeMultipart("alternative"); // result -> 
multipart/alternative
mp.addBodyPart( plaintext );
mp.addBodyPart( htmltext );
message.setContent( mp );
message.saveChanges();

InternetAddress from = new InternetAddress("[EMAIL PROTECTED]");
message.setFrom(from);
InternetAddress[] recipients = {new InternetAddress("[EMAIL PROTECTED]")};
message.setRecipients(Message.RecipientType.TO, recipients);
message.setSubject("RÃÂdgrÃÂd med flÃÂde", "UTF-8");

System.out.println(message.getContentType());
System.out.println(message.getSize());
System.out.println(message.getEncoding());
System.out.println(message.getContent().getClass());
System.out.println(message.getContent()); // does not work if setContent 
is not called.

System.out.println("");
System.out.println(message.getDataHandler());
System.out.println(message.getDataHandler().getContent());
System.out.println(message.getDataHandler().getDataSource());

System.out.println(message.getDataHandler().getDataSource().getContentType());

message.writeTo(System.out);

message.writeTo( new PrintStream(
new FileOutputStream("/tmp/mailtest.txt"), true, "UTF-8")
);

Trans