[jboss-user] [JBoss Portal] - deploy portlet to display applets failure

hubery do-not-reply at jboss.com
Tue Sep 30 04:42:08 EDT 2008


What I want to do is try to deploy a portlet to display applets, I used the example "helloworldjspportlet" downloaded from jboss portletswap.

My jboss portal version: GA2.6.6 

I both changed helloworldjspportlet.java and porlet.xml file as following:

1, helloworldjspportlet.java 

package org.jboss.portlet.hello;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.UnavailableException;
import java.io.IOException;
import java.applet.*;
import java.awt.*;

public class HelloWorldJSPPortlet extends GenericPortlet
{
   protected void doView(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
   {
      rResponse.setContentType("text/html");

      String sYourName = (String) rRequest.getParameter("yourname");

      if(sYourName != null)
      {
         rRequest.setAttribute("yourname", sYourName);
         PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view2.jsp");
         prd.include(rRequest, rResponse);
      }
      else
      {
         PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/view.jsp");
         prd.include(rRequest, rResponse);
      }
   }

   public void processAction(ActionRequest aRequest, ActionResponse aResponse) throws PortletException, IOException, UnavailableException
   {
      String sYourname = (String) aRequest.getParameter("yourname");

      // do something

      aResponse.setRenderParameter("yourname", sYourname);
   }

   protected void doHelp(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
   {
      rResponse.setContentType("application/x-java-serialized-object");
      PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/help.jsp");
      prd.include(rRequest, rResponse);
   }

   protected void doEdit(RenderRequest rRequest, RenderResponse rResponse) throws PortletException, IOException, UnavailableException
   {
      rResponse.setContentType("text/html");
      PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/edit.jsp");
      prd.include(rRequest, rResponse);
   }
}

accoring to the setContextType ,I have tried "application/x-java-applet" "application/x-java-serialized-object" ,both failed.

2. portlet.xml file


      <portlet-name>HelloWorldJSPPortlet</portlet-name>
      <portlet-class>org.jboss.portlet.hello.HelloWorldJSPPortlet</portlet-class>
      
		 <mime-type>application/x-java-applet</mime-type>
         <portlet-mode>VIEW</portlet-mode>
         <portlet-mode>EDIT</portlet-mode>
         <portlet-mode>HELP</portlet-mode>
      
      <portlet-info>
         HelloWorld JSP Portlet
      </portlet-info>
   
</portlet-app>


I have to say, the help.jsp in first file is a jsp which has applet inside.

When I use ant deploy and ant explode to re-deploy this example portlet and put it under /default/deploy directory, it gave me this error:

	
ERROR
Cause: java.lang.IllegalArgumentException: Content type not accepted
Message: Content type not accepted
StackTrace:

java.lang.IllegalArgumentException: Content type not accepted
	at org.jboss.portal.portlet.impl.jsr168.api.RenderResponseImpl.setContentType(RenderResponseImpl.java:110)
	at org.jboss.portlet.hello.HelloWorldJSPPortlet.doHelp(Unknown Source)
	at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:137)
	at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
	at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:405)
	at org.jboss.portal.portlet.container.PortletContainerInvoker$1.invoke(PortletContainerInvoker.java:86)
	at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:131)
	at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org$jboss$portal$core$aspects$portlet$TransactionInterceptor$invokeNotSupported$aop(TransactionInterceptor.java:86)
	at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N4547270787964792031.invokeNext(TransactionInterceptor$invokeNotSupported_N4547270787964792031.java)
	at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
	at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:112)
	at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N4547270787964792031.invokeNext(TransactionInterceptor$invokeNotSupported_N4547270787964792031.java)
	at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
	at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:102)
	at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N4547270787964792031.invokeNext(TransactionInterceptor$invokeNotSupported_N4547270787964792031.java)
	at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.invokeNotSupported(TransactionInterceptor.java)
	at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.invoke(TransactionInterceptor.java:56)
	at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38)
	at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)
	at org.jboss.portal.core.aspects.portlet.HeaderInterceptor.invoke(HeaderInterceptor.java:50)
	at org.jboss.portal.portlet.invocation.PortletInterceptor.invoke(PortletInterceptor.java:38)
	at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:115)

------ just a piece , from the error, it is not difficult to understand it is the 

context type problem, but how to fix it ,anybody can give me a hand?

Thanks!
Hubery

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

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



More information about the jboss-user mailing list