Author: julien(a)jboss.com
Date: 2008-02-06 13:49:08 -0500 (Wed, 06 Feb 2008)
New Revision: 9805
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
Removed:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/classes/
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
modules/portlet/trunk/test/src/test/build.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml
modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
Log:
add support for response buffering
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-06
16:52:29 UTC (rev 9804)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/controller/PortletURLRenderer.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -90,6 +90,7 @@
buffer.append(':');
buffer.append(Integer.toString(clientReq.getServerPort()));
buffer.append(clientReq.getContextPath());
+ buffer.append(clientReq.getServletPath());
buffer.append('/');
buffer.append(StringCodec.encode(windowId));
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/ControllerServlet.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp;
+
+import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
+import org.jboss.portal.portlet.test.jsp.response.Chunk;
+import org.jboss.portal.portlet.test.jsp.response.BytesChunk;
+import org.jboss.portal.portlet.test.jsp.response.CharsChunk;
+import org.jboss.portal.portlet.test.jsp.response.PortletChunk;
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.servlet.RequestDispatcher;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ControllerServlet extends HttpServlet
+{
+
+
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
+ {
+ RequestDispatcher dispatcher = req.getRequestDispatcher("/index.jsp");
+
+ //
+ BufferingResponse bufferingResponse = new BufferingResponse(resp);
+
+ //
+ dispatcher.include(req, bufferingResponse);
+
+ //
+ ResponseBuffer buffer = bufferingResponse.getBuffer();
+ buffer.close();
+
+ //
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+ for (Chunk chunk : buffer.getChunks())
+ {
+ if (chunk instanceof BytesChunk)
+ {
+ BytesChunk bytesChunk = (BytesChunk)chunk;
+ writer.write(new String(bytesChunk.getBytes()));
+ }
+ else if (chunk instanceof CharsChunk)
+ {
+ CharsChunk bytesChunk = (CharsChunk)chunk;
+ writer.write(bytesChunk.getChars());
+ }
+ else if (chunk instanceof PortletChunk)
+ {
+ PortletChunk portletChunk = (PortletChunk)chunk;
+ writer.write("Portlet[" + portletChunk.getPortletName() +
"," + portletChunk.getApplicationName() + "]");
+ }
+ }
+
+ //
+ writer.close();
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BufferingResponse.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp.response;
+
+import org.jboss.portal.portlet.test.jsp.response.ResponseBuffer;
+import org.jboss.portal.portlet.test.jsp.response.Chunk;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class BufferingResponse extends HttpServletResponseWrapper
+{
+
+ /** . */
+ private final ResponseBuffer buffer = new ResponseBuffer();
+
+ public BufferingResponse(HttpServletResponse response)
+ {
+ super(response);
+ }
+
+ public ResponseBuffer getBuffer()
+ {
+ return buffer;
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return buffer.getOutputStream();
+ }
+
+ public PrintWriter getWriter() throws IOException
+ {
+ return buffer.getWriter();
+ }
+
+ public void close()
+ {
+ buffer.close();
+ }
+
+ public void addChunk(Chunk chunk)
+ {
+ buffer.addChunk(chunk);
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/BytesChunk.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class BytesChunk extends Chunk
+{
+
+ /** . */
+ private final byte[] bytes;
+
+ public BytesChunk(byte[] bytes)
+ {
+ this.bytes = bytes;
+ }
+
+ public byte[] getBytes()
+ {
+ return bytes;
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/CharsChunk.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class CharsChunk extends Chunk
+{
+
+ /** . */
+ private final char[] chars;
+
+ public CharsChunk(char[] chars)
+ {
+ this.chars = chars;
+ }
+
+ public char[] getChars()
+ {
+ return chars;
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/Chunk.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class Chunk
+{
+
+
+
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/PortletChunk.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp.response;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletChunk extends Chunk
+{
+
+ /** . */
+ private final String portletName;
+
+ /** . */
+ private final String applicationName;
+
+ public PortletChunk(String portletName, String applicationName)
+ {
+ this.portletName = portletName;
+ this.applicationName = applicationName;
+ }
+
+ public String getPortletName()
+ {
+ return portletName;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/response/ResponseBuffer.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,181 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp.response;
+
+import javax.servlet.ServletOutputStream;
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+import java.io.StringWriter;
+import java.io.PrintWriter;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ResponseBuffer
+{
+
+ /** . */
+ private final List<Chunk> chunks = new LinkedList<Chunk>();
+
+ /** . */
+ private ChunkOutputStream chunkOutputStream;
+
+ /** . */
+ private ChunkWriter chunkWriter;
+
+ /** . */
+ private PrintWriter writer;
+
+ public List<Chunk> getChunks()
+ {
+ return chunks;
+ }
+
+ public void close()
+ {
+ try
+ {
+ if (chunkWriter != null)
+ {
+ chunkWriter.close();
+ }
+ else if (chunkOutputStream != null)
+ {
+ chunkOutputStream.close();
+ }
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public ServletOutputStream getOutputStream()
+ {
+ if (chunkOutputStream == null)
+ {
+ if (writer != null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ chunkOutputStream = new ChunkOutputStream();
+ }
+
+ //
+ return chunkOutputStream;
+ }
+
+ public PrintWriter getWriter()
+ {
+ if (chunkWriter == null)
+ {
+ if (chunkOutputStream != null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ chunkWriter = new ChunkWriter();
+ writer = new PrintWriter(chunkWriter);
+ }
+
+ //
+ return writer;
+ }
+
+ public void addChunk(Chunk chunk)
+ {
+ if (chunkWriter != null)
+ {
+ chunkWriter.writeChunk();
+ }
+ else if (chunkOutputStream != null)
+ {
+ chunkOutputStream.writeChunk();
+ }
+
+ //
+ chunks.add(chunk);
+ }
+
+ private class ChunkWriter extends StringWriter
+ {
+
+ public void writeChunk()
+ {
+ StringBuffer sb = getBuffer();
+ if (sb.length() > 0)
+ {
+ char[] chars = new char[sb.length()];
+ sb.getChars(0, sb.length(), chars, 0);
+ CharsChunk chunk = new CharsChunk(chars);
+ chunks.add(chunk);
+ sb.setLength(0);
+ }
+ }
+
+ public void close() throws IOException
+ {
+ super.close();
+
+ //
+ writeChunk();
+ }
+ }
+
+ private class ChunkOutputStream extends ServletOutputStream
+ {
+
+ /** . */
+ private final ByteArrayOutputStream bytebuffer = new ByteArrayOutputStream();
+
+ public void write(int b) throws IOException
+ {
+ bytebuffer.write(b);
+ }
+
+ public void writeChunk()
+ {
+ if (bytebuffer.size() > 0)
+ {
+ byte[] bytes = bytebuffer.toByteArray();
+ bytebuffer.reset();
+ BytesChunk chunk = new BytesChunk(bytes);
+ chunks.add(chunk);
+ }
+ }
+
+ public void close() throws IOException
+ {
+ super.close();
+
+ //
+ writeChunk();
+ }
+ }
+}
Copied: modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib
(from rev 9804,
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib)
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/taglib/PageTag.java 2008-02-06
16:52:29 UTC (rev 9804)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PageTag.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -20,9 +20,8 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
******************************************************************************/
-package org.jboss.portal.portlet.test.taglib;
+package org.jboss.portal.portlet.test.jsp.taglib;
-import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.JspException;
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/jsp/taglib/PortletTag.java 2008-02-06
18:49:08 UTC (rev 9805)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.test.jsp.taglib;
+
+import org.jboss.portal.portlet.test.jsp.response.BufferingResponse;
+import org.jboss.portal.portlet.test.jsp.response.PortletChunk;
+
+import javax.servlet.jsp.tagext.SimpleTagSupport;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class PortletTag extends SimpleTagSupport
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private String applicationName;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getApplicationName()
+ {
+ return applicationName;
+ }
+
+ public void setApplicationName(String applicationName)
+ {
+ this.applicationName = applicationName;
+ }
+
+ public void doTag() throws JspException, IOException
+ {
+ PageContext pageCtx = (PageContext)getJspContext();
+ pageCtx.getOut().flush();
+ BufferingResponse response = (BufferingResponse)pageCtx.getResponse();
+ response.addChunk(new PortletChunk(name, applicationName));
+ }
+}
Modified: modules/portlet/trunk/test/src/test/build.xml
===================================================================
--- modules/portlet/trunk/test/src/test/build.xml 2008-02-06 16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/test/build.xml 2008-02-06 18:49:08 UTC (rev 9805)
@@ -15,9 +15,6 @@
<antcall target="tests.call.single"/>
<antcall target="tests.call.all"/>
- <!--Cleanup-->
- <!--<delete dir="${test.temp.dir}"/>-->
-
</target>
<target name="tests.call.all" unless="tests">
Modified:
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld
===================================================================
---
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-06
16:52:29 UTC (rev 9804)
+++
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/portal.tld 2008-02-06
18:49:08 UTC (rev 9805)
@@ -10,8 +10,24 @@
<tag>
<name>page</name>
- <tag-class>org.jboss.portal.portlet.test.taglib.PageTag</tag-class>
+
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PageTag</tag-class>
<body-content>JSP</body-content>
</tag>
+ <tag>
+ <name>portlet</name>
+
<tag-class>org.jboss.portal.portlet.test.jsp.taglib.PortletTag</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <name>applicationName</name>
+ <required>true</required>
+ <type>java.lang.String</type>
+ </attribute>
+ </tag>
+
</taglib>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml
===================================================================
---
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml 2008-02-06
16:52:29 UTC (rev 9804)
+++
modules/portlet/trunk/test/src/test/resources/simple-portal-war/WEB-INF/web.xml 2008-02-06
18:49:08 UTC (rev 9805)
@@ -38,8 +38,16 @@
<servlet-name>PortalServlet</servlet-name>
<servlet-class>org.jboss.portal.simple.SimplePortalServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>ControllerServlet</servlet-name>
+
<servlet-class>org.jboss.portal.portlet.test.jsp.ControllerServlet</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>PortalServlet</servlet-name>
- <url-pattern>/*</url-pattern>
+ <url-pattern>/</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ControllerServlet</servlet-name>
+ <url-pattern>/jsp/*</url-pattern>
+ </servlet-mapping>
</web-app>
Modified: modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp
===================================================================
--- modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-06
16:52:29 UTC (rev 9804)
+++ modules/portlet/trunk/test/src/test/resources/simple-portal-war/index.jsp 2008-02-06
18:49:08 UTC (rev 9805)
@@ -5,7 +5,11 @@
<html>
<body>
<portal:page>
- HELLO!!!
+ BEFORE
+ <portal:portlet
+ name="GoogleMap"
+ applicationName="google-map-portlet"/>
+ AFTER
</portal:page>
</body>
</html>