RE: Problem with custom mode

"Nicolas Lafaury" <[email protected]>
Newsgroups gmane.comp.jakarta.pluto.user
Message-ID <[email protected]>
Hello, thanks for answer

Yes I have also declared this part in my portlet.xml

		<supports>
			<mime-type>text/html</mime-type>
			<portlet-mode>edit</portlet-mode>
			<portlet-mode>help</portlet-mode>
			<portlet-mode>about</portlet-mode>
			<portlet-mode>print</portlet-mode>
		</supports>

Then I add 

		<custom-portlet-mode>
			<description>Mode pour indiquer l'auteur de la portlet par exemple</description>
			<name>about</name>
		</custom-portlet-mode>

		<custom-portlet-mode>
			<description>Mode pour l'impression</description>
			<name>print</name>
		</custom-portlet-mode> 

But is it enough?  Because when I test the supported mode in doView

		Enumeration modeEnum = request.getPortalContext().getSupportedPortletModes();
		writer.write("<p>Modes <br />");
		while (modeEnum.hasMoreElements()) {
			PortletMode pMode = (PortletMode) modeEnum.nextElement();
			PortletURL modeUrl = response.createRenderURL();
			modeUrl.setPortletMode(pMode);
			writer.write("<li> <a href=\"" + modeUrl.toString() + "\">" + pMode + "</a></li>");
		}
		writer.write("</p>");

I didn't retrieve my custom mode. 

My error appears when I tried to create a link on it :  javax.portlet.PortletModeException: unsupported Portlet Mode used: print

		PortletURL printModeUrl = response.createRenderURL();
		printModeUrl.setPortletMode(PRINT);


I have exactly the same probleme on Jboss and Jetspeed.

Thanks for your help.

Nicolas

Nicolas LAFAURY
Smile- Motoriste Internet
01-41-40-11-05
[email protected]
 

-----Message d'origine-----
De : Ate Douma [mailto:[email protected]] 
Envoyé : jeudi 6 avril 2006 09:34
À : [email protected]
Objet : Re: Problem with custom mode

Nicolas Lafaury wrote:
> Hello
> 
> I use uPortal that use pluto to run portlet.
> 
> I am trying to build custom mode in my portlet, but I have an error.
> 
> In portlet.xml, I add
> 
> *<custom-portlet-mode>*
> 
> *<description>Mode pour l'impression</description>*
> 
> *<name>print</name>*
> 
> *</custom-portlet-mode>*
> 
> In my *"public class ExemplePortlet extends GenericPortlet {"*, I add, 
> as I see on the forum,
> 
> public final static PortletMode PRINT =3D new PortletMode("print");
> 
> but when I tried to create a link to this custom mode, I have an error : 
> /javax.portlet.PortletModeException: unsupported Portlet Mode used: 
> print/
> 
> Do I need to do something else to create my own custom mode?
I don't know what other restrictions uPortal might have, but one thing you at least need to do is specifying your portlet actually supports it.
Like:

   <portlet>
     ...
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>print</portlet-mode>
     </supports>
     ...
   </portlet>

> 
> thanks for your help.
> 
> Nicolas
> 
>  
> Nicolas LAFAURY
> Smile- Motoriste Internet
> 01-41-40-11-05
> [email protected] <mailto:[email protected]>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.