You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Cabio, Michelle (Michelle)" <ca...@avaya.com> on 2002/06/03 22:17:35 UTC

WML problems...

I'm trying to simply print out a txt msg to a WAP device on the Open wave simulator...

My portlet looks like this....and it gives the following error after login...

No translator for content-type: text/html
sometimes it gives 
Translation failed for content-type: text/vnd.wap.wml

Any pointers on how to fix this problem??


package com.avaya.portlet;

import java.io.*;
import java.util.*;
import java.rmi.*;


import javax.servlet.*;
import javax.ejb.*;
import javax.naming.*;
import javax.jms.*;

import org.apache.jetspeed.portal.portlets.AbstractPortlet;
import org.apache.turbine.util.RunData;
import org.apache.turbine.om.security.User;
import org.apache.ecs.*;
import org.apache.jetspeed.capability.*;
import org.apache.jetspeed.util.MimeType;
import org.apache.jetspeed.util.servlet.EcsServletElement;
import org.apache.log4j.Category;
import org.apache.log4j.PropertyConfigurator;
import org.apache.jetspeed.services.*;
import org.apache.jetspeed.portal.*;

import org.xml.sax.SAXException;


public class RuleManagerPortlet extends AbstractPortlet 
{
    
    public RuleManagerPortlet()
    {
    }
    
    public ConcreteElement getContent(RunData aRunData)
    {

        String filePath = getPortletConfig().getInitParameter("filePath");
        
        ElementContainer base = new ElementContainer();

        CapabilityMap cap = CapabilityMapFactory.getCapabilityMap(aRunData);
        
        
        try{
            
            
            if (cap.getPreferredType().equals(MimeType.WML)) {

                String text = new StringBuffer()
               .append("<?xml version='1.0'?>")
               .append("<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML 1.1//EN' 'http://www.wapforum.org/DTD/wml_1.1.xml'>")
               .append("<wml>")
               .append("<card id='card1' title='Card 1'>")
               .append("<p>HELLO! CAN U SEE ME?</p>")
               .append("</card>")
               .append("</wml>")
               .toString()
               .trim();
           
                base.addElement(new StringElement(text));
              
            }
          
        }catch (Exception e) {

            e.printStackTrace();

        }
         
        return(base);  

    }//end of getContent   


    public boolean supportsType(MimeType aMimeType){

        return(MimeType.HTML.equals(aMimeType) || MimeType.WML.equals(aMimeType));

    }


}//end of RuleManagerPortlet










--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: WML problems...

Posted by Chris Kimpton <ki...@yahoo.com>.
Hi,

--- "Cabio, Michelle (Michelle)" <ca...@avaya.com> wrote:
> 
> I'm trying to simply print out a txt msg to a WAP device on the
> Open wave simulator...
> 
> My portlet looks like this....and it gives the following error
> after login...
> 
> No translator for content-type: text/html
> sometimes it gives 
> Translation failed for content-type: text/vnd.wap.wml
> 
> Any pointers on how to fix this problem??
> 
> 
[snip]

> 
>                 String text = new StringBuffer()
>                .append("<?xml version='1.0'?>")
>                .append("<!DOCTYPE wml PUBLIC '-//WAPFORUM//DTD WML
> 1.1//EN' 'http://www.wapforum.org/DTD/wml_1.1.xml'>")
>                .append("<wml>")

Are you using the default jetspeed config of controllers/controls?

I believe they wrap the portlet output in the <wml> elements - so you
only need to return a card in your portlet.

You should be able to see the wml returned by jetspeed in the
OpenWave DOS window - does that look correct to you?  

I also tried the nokia simulator - its shows more info on the wml
returned (although it seemed buggy to me), that might help.

I assume you have the basics like the anon psml returning your
portlet and your portlet is configured in an xreg file with support
for media-type wml...

>                .append("<card id='card1' title='Card 1'>")
>                .append("<p>HELLO! CAN U SEE ME?</p>")
>                .append("</card>")
>                .append("</wml>")
>                .toString()
>                .trim();
>            

HTH,
Chris

=====
------------------------------------------
http://www.soccer2002.org.uk - The Game is On!

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>