Thanks Thomas for your response.
Yes, I've already startd coding the 'workaround', but in the back of my head
Im saying - is there a better way.
I was just reading about the ServletResponseWrapper class described in the
2.3 servlet specification draft.
It looks like it is designed for this kind of situation.
http://java.sun.com/aboutJava/communityprocess/review/jsr053/

Im not sure how well Turbine runs with the Tomcat 3.2 beta along with all
the servlet 2.3 classes required.
I also like your proposal, but its not clear to me how this would integrate
with the current servlet classes

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, October 24, 2000 1:04 PM
To: JetSpeed
Subject: Re: JSP portlet





How to use JSPs within Jetspeed is a very relevant question. I can
imagine the following "workaround" to use JSPs together with ECS:
You could write a class that implements the interface HTTPServletResponse
and uses an output stream that writes to a buffer. You may get the content
out of the buffer after invocation of the JSP and put it into an ECS
concrete element that you return.
Whether this approach works may depend on the application server you're
using. Some app servers may require their particular HTTPServletResponse
implementations to be passed as second parameter of the include-method,
in this case this workaround wouldn't work and you'd get a class cast
exception when the servlet engine tries to cast your class to the
expected servlet-engine specific class.

To really allow for good integration of servlets or JSPs,the portal
page generation mechanism needs to follow the servlet paradigm:
Each component would have a service method and would sequentially call
the service methods of all its sub-components. During traversal of the
component tree, all markup elements would be written to the servlet
output stream of the response that gets passed through from component
to component. The following example shows how this works:

component1.service(req,rsp)
writes "<TABLE>"
calls component11.service(req,rsp)
    - writes "<TABLE>"
    - calls portlet111.service(req,rsp)
        -- writes "<TABLE> ... portlet 111 markup ... </TABLE>"
    - calls portlet112.service(req,rsp)
        -- writes "<TABLE> ... portlet 112 markup ... </TABLE>"
    - writes "</TABLE>"
calls component12.service(req,rsp)
    - writes "<TABLE>"
    - calls portlet121.service(req,rsp)
        -- writes "<TABLE> ... portlet 121 markup ... </TABLE>"
    - writes "</TABLE>"
writes "</TABLE>"

Using an ECS-portlet with stream-based page aggregation like described
above works like this: The service-method would get the content from
the ECS portlet and let the ECS tree write itself to the servlet output
stream of the response object.

Best regards,

Thomas

Thomas Schaeck
Pervasive Computing Division
Phone: +49-(0)7031-16-3479  e-mail: [EMAIL PROTECTED]
Address: IBM Deutschland Entwicklung GmbH,
Schoenaicher Str. 220, 71032 Boeblingen, Germany


"David Sean Taylor" <[EMAIL PROTECTED]> on 24.10.2000 20:25:41

Please respond to "JetSpeed" <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:
Subject:  JSP portlet




Im trying to write a JspPortlet.
My approach is flawed, and Im wondering if anyone else has discovered a way
for this to work.
Im using a RequestDispatcher, and the problem is that the JSP writes its
output directly to the Response
So the JSP output cannot be incorporated into ECS since (i believe) ECS
must
render its entire element tree before setting it into the response
Has anyone ever 'redirected' the output of another servlet (.i.e. JSP) and
found a way to take this output
and put it into ECS, which is not flushed to the Response until the
complete
ECS elements are rendered.

Here's the code from my JspPortlet implementation:

    public ConcreteElement getContent() {

        RunData rundata = this.getPortletConfig().getRunData();
        PortletConfig pc = this.getPortletConfig();

        String url = "/jsp/dates/date.jsp";
        String myContent = null;

        try {

          String jspOutput = null;
          ServletContext ctx = rundata.getServletContext();
          RequestDispatcher dispatcher = ctx.getRequestDispatcher(url);
          try
          {
               //rundata.getOut().flush();
               // include the JSP
               dispatcher.include( rundata.getRequest(),
rundata.getResponse() );
        } catch (Exception e) {
            String message = "JSPPortlet: Could not include the following
URL:  " + url + " : " + e.getMessage();
            Log.error( message, e );
            return new StringElement( message );
        }

        ElementContainer content = new ElementContainer();
          // there is nothing to add to ecs since dispatcher.include() has
already
written into the response



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]






--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]




--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to