Hello,
I was trying out "The Multi-Device Challenge" example in the PortletHowTo
section of the Jetspeed documentation and ran into a few errors.
On testing with Openwave 5.0, I got the following error when I tried to
login to the portal as user "turbine":
Translation failed for content-type: text/vnd.wap.wml
With the Nokia WAP Simulator, the error was:
Content could not be encoded by the gateway
Has anyone run into this problem or better still, solved it? Looking forward
to your replies. I am including the code I wrote and also the deployment
descriptor for this portlet.
Thanks,
Vipul.
-------------------------------------------------
DESCRIPTOR
-------------------------------------------------
<portlet-entry name="HelloWorldMultiDevicePortlet" hidden="false"
type="instance" parent="RSS" application="false">
<meta-info>
<title>HelloWorldMultiDevicePortlet</title>
<description>Multi Device Portlet How To Example 4</description>
</meta-info>
<classname>
com.bluesunrise.portal.portlets.HelloWorldMultiDevicePortlet</classname>
<media-type ref="wml"/>
<media-type ref="html"/>
<parameter name="greeting" value="Howdy "/>
</portlet-entry>
-------------------------------------------------
CODE
-------------------------------------------------
package com.bluesunrise.portal.portlets;
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;
public class HelloWorldMultiDevicePortlet extends AbstractPortlet
{
public ConcreteElement getContent(RunData aRunData)
{
StringBuffer text = new StringBuffer();
text.append (getPortletConfig().getInitParameter("greeting"));
String name = aRunData.getUser().getFirstName();
if (name == null)
name = "World";
text.append(name);
text.append("!");
ElementContainer base = new ElementContainer();
CapabilityMap cap = CapabilityMapFactory.getCapabilityMap(aRunData);
//here we go different ways
if (cap.getPreferredType().equals(MimeType.HTML))
{
base.addElement(new
org.apache.ecs.html.P().addElement(text.toString()));
}
else if (cap.getPreferredType().equals(MimeType.WML))
{
base.addElement (new
org.apache.ecs.wml.P().addElement(text.toString()));
}
return(base);
}
public boolean supportsType(MimeType aMimeType)
{
return(MimeType.HTML.equals(aMimeType) ||
MimeType.WML.equals(aMimeType));
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>