You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by we...@apache.org on 2003/10/20 05:44:32 UTC
cvs commit: jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container JetspeedContainerServlet.java
weaver 2003/10/19 20:44:32
Modified: commons/src/java/org/apache/jetspeed/container
JetspeedContainerServlet.java
Log:
Revision Changes Path
1.2 +65 -66 jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedContainerServlet.java
Index: JetspeedContainerServlet.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/commons/src/java/org/apache/jetspeed/container/JetspeedContainerServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JetspeedContainerServlet.java 10 Oct 2003 05:12:11 -0000 1.1
+++ JetspeedContainerServlet.java 20 Oct 2003 03:44:32 -0000 1.2
@@ -71,6 +71,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.jetspeed.factory.JetspeedPortletFactory;
+import org.apache.pluto.core.CoreUtils;
+import org.apache.pluto.core.InternalPortletRequest;
+import org.apache.pluto.core.InternalPortletResponse;
import org.apache.pluto.om.portlet.PortletDefinition;
// import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
@@ -80,9 +83,7 @@
* @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
* @version $Id$
*/
-public class JetspeedContainerServlet
- extends HttpServlet
- implements ServletContainerConstants
+public class JetspeedContainerServlet extends HttpServlet implements ServletContainerConstants
{
private final static Log log = LogFactory.getLog(JetspeedContainerServlet.class);
private final static Log console = LogFactory.getLog(CONSOLE_LOGGER);
@@ -116,14 +117,13 @@
/**
* Intialize Servlet.
*/
- public final void init(ServletConfig config)
- throws ServletException
+ public final void init(ServletConfig config) throws ServletException
{
synchronized (this.getClass())
{
log.info(INIT_START_MSG);
super.init(config);
-
+
if (!firstInit)
{
log.info("Double initialization of Jetspeed was attempted!");
@@ -136,30 +136,30 @@
try
{
ServletContext context = config.getServletContext();
-/*
- String propertiesFilename =
- ServletHelper.findInitParameter(context, config,
- JETSPEED_PROPERTIES_KEY,
- JETSPEED_PROPERTIES_DEFAULT);
-
- String applicationRoot =
- ServletHelper.findInitParameter(context, config,
- APPLICATION_ROOT_KEY,
- APPLICATION_ROOT_DEFAULT);
- */
+ /*
+ String propertiesFilename =
+ ServletHelper.findInitParameter(context, config,
+ JETSPEED_PROPERTIES_KEY,
+ JETSPEED_PROPERTIES_DEFAULT);
+
+ String applicationRoot =
+ ServletHelper.findInitParameter(context, config,
+ APPLICATION_ROOT_KEY,
+ APPLICATION_ROOT_DEFAULT);
+ */
webappRoot = config.getServletContext().getRealPath("/");
-/*
- if (applicationRoot == null || applicationRoot.equals(WEB_CONTEXT))
- {
- applicationRoot = webappRoot;
- }
-
- Configuration properties = (Configuration)
- new PropertiesConfiguration(ServletHelper.getRealPath(config, propertiesFilename));
-
- properties.setProperty(APPLICATION_ROOT_KEY, applicationRoot);
- properties.setProperty(WEBAPP_ROOT_KEY, webappRoot);
- */
+ /*
+ if (applicationRoot == null || applicationRoot.equals(WEB_CONTEXT))
+ {
+ applicationRoot = webappRoot;
+ }
+
+ Configuration properties = (Configuration)
+ new PropertiesConfiguration(ServletHelper.getRealPath(config, propertiesFilename));
+
+ properties.setProperty(APPLICATION_ROOT_KEY, applicationRoot);
+ properties.setProperty(WEBAPP_ROOT_KEY, webappRoot);
+ */
}
catch (Exception e)
{
@@ -168,7 +168,7 @@
System.err.println(ExceptionUtils.getStackTrace(e));
throw new ServletException("Jetspeed: init() failed", e);
}
-
+
console.info(INIT_DONE_MSG);
log.info(INIT_DONE_MSG);
}
@@ -191,22 +191,21 @@
}
}
}
-
+
// -------------------------------------------------------------------
// R E Q U E S T P R O C E S S I N G
// -------------------------------------------------------------------
static private final String PHONEY_PORTLET_WINDOW = "<P>----------------------------------</P>";
-
+
/**
* The primary method invoked when the Jetspeed servlet is executed.
*
- * @param req Servlet request.
- * @param res Servlet response.
+ * @param request Servlet request.
+ * @param ressponse Servlet response.
* @exception IOException a servlet exception.
* @exception ServletException a servlet exception.
*/
- public final void doGet(HttpServletRequest req, HttpServletResponse res)
- throws IOException, ServletException
+ public final void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
try
{
@@ -219,41 +218,41 @@
// If this is the first invocation, perform some late initialization.
if (firstDoGet)
{
- init(req, res);
+ init(request, response);
}
-
- PortletDefinition portletDefinition =
- (PortletDefinition)req.getAttribute(ContainerConstants.PORTLET_ENTITY);
+
+ PortletDefinition portletDefinition = (PortletDefinition) request.getAttribute(ContainerConstants.PORTLET_ENTITY);
Portlet portlet = JetspeedPortletFactory.getPortlet(this.getServletConfig(), portletDefinition);
-
- Integer method = (Integer)req.getAttribute(ContainerConstants.METHOD_ID);
+
+ Integer method = (Integer) request.getAttribute(ContainerConstants.METHOD_ID);
if (method == ContainerConstants.METHOD_NOOP)
{
- return;
+ return;
}
-
+
//res.getWriter().print("Rendering: Portlet Class = " + entity.getPortletClass() + "<BR/>");
if (method == ContainerConstants.METHOD_ACTION)
{
- ActionRequest request = (ActionRequest)req.getAttribute(ContainerConstants.PORTLET_REQUEST);
- ActionResponse response = (ActionResponse)req.getAttribute(ContainerConstants.PORTLET_RESPONSE);
- portlet.processAction(request, response);
- }
- else if (method == ContainerConstants.METHOD_RENDER)
- {
- RenderRequest request = (RenderRequest)req.getAttribute(ContainerConstants.PORTLET_REQUEST);
- RenderResponse response = (RenderResponse)req.getAttribute(ContainerConstants.PORTLET_RESPONSE);
-
- res.getWriter().print(PHONEY_PORTLET_WINDOW);
- res.getWriter().print(portletDefinition.getName());
- res.getWriter().print(PHONEY_PORTLET_WINDOW);
-
- portlet.render(request, response);
-
- res.getWriter().print(PHONEY_PORTLET_WINDOW);
+ ActionRequest actionRequest = (ActionRequest) request.getAttribute(ContainerConstants.PORTLET_REQUEST);
+ ActionResponse actionResponse = (ActionResponse) request.getAttribute(ContainerConstants.PORTLET_RESPONSE);
+
+ portlet.processAction(actionRequest, actionResponse);
+ }
+ else if (method == ContainerConstants.METHOD_RENDER)
+ {
+ RenderRequest renderRequest = (RenderRequest) request.getAttribute(ContainerConstants.PORTLET_REQUEST);
+ RenderResponse renderResponse = (RenderResponse) request.getAttribute(ContainerConstants.PORTLET_RESPONSE);
+
+ response.getWriter().print(PHONEY_PORTLET_WINDOW);
+ response.getWriter().print(portletDefinition.getName());
+ response.getWriter().print(PHONEY_PORTLET_WINDOW);
+
+ portlet.render(renderRequest, renderResponse);
+
+ response.getWriter().print(PHONEY_PORTLET_WINDOW);
}
-
+
}
catch (Throwable t)
{
@@ -269,8 +268,7 @@
* @exception IOException a servlet exception.
* @exception ServletException a servlet exception.
*/
- public final void doPost(HttpServletRequest req, HttpServletResponse res)
- throws IOException, ServletException
+ public final void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException
{
doGet(req, res);
}
@@ -290,6 +288,7 @@
log.info("Done shutting down!");
}
-
-}
+
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org