Author: julien(a)jboss.com
Date: 2007-05-29 04:44:29 -0400 (Tue, 29 May 2007)
New Revision: 7345
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
Log:
minor javadoc and renaming
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -148,11 +148,11 @@
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
ControllerCommand commeand,
- ControllerResponse response) throws ResponseHandlerException
+ ControllerResponse controllerResponse) throws ResponseHandlerException
{
- if (response instanceof PortletWindowResponse)
+ if (controllerResponse instanceof PortletWindowResponse)
{
- PortletWindowResponse pwr = (PortletWindowResponse)response;
+ PortletWindowResponse pwr = (PortletWindowResponse)controllerResponse;
PortletInvocationResponse pir = pwr.getResult();
if (pir instanceof RenderResponse)
{
@@ -172,20 +172,20 @@
}
else
{
- throw new Error("todo " + response);
+ throw new Error("todo " + controllerResponse);
}
}
- else if (response instanceof UpdatePageResponse)
+ else if (controllerResponse instanceof UpdatePageResponse)
{
- UpdatePageResponse upr = (UpdatePageResponse)response;
+ UpdatePageResponse upr = (UpdatePageResponse)controllerResponse;
ViewPageCommand rpc = new ViewPageCommand(upr.getPageId());
String url = controllerContext.renderURL(rpc, null, null);
UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
return new AjaxResponse(dresp);
}
- else if (response instanceof UpdateWindowResponse)
+ else if (controllerResponse instanceof UpdateWindowResponse)
{
- UpdateWindowResponse upw = (UpdateWindowResponse)response;
+ UpdateWindowResponse upw = (UpdateWindowResponse)controllerResponse;
// Obtain page and portal
final Window window =
(Window)portalObjectContainer.getObject(upw.getWindowId());
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -65,18 +65,18 @@
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
- ControllerCommand command,
+ ControllerCommand controllerCommand,
ControllerResponse commandResponse) throws ResponseHandlerException
{
- HandlerResponse handlerResponse = processHandlers(controllerContext, command,
commandResponse);
+ HandlerResponse handlerResponse = processHandlers(controllerContext,
controllerCommand, commandResponse);
// Handle redirection here
if (handlerResponse instanceof CommandForward)
{
CommandForward forward = (CommandForward)handlerResponse;
URLContext urlContext =
controllerContext.getServerInvocation().getServerContext().getURLContext();
- if (requiresRedirect(command, urlContext, forward))
+ if (requiresRedirect(controllerCommand, urlContext, forward))
{
String url = controllerContext.renderURL(forward.getCommand(),
forward.getURLContext(), null);
return new HTTPResponse.SendRedirect(url);
@@ -108,12 +108,12 @@
private static class OtherResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand cdmand, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand cdmand, ControllerResponse controllerResponse) throws
ResponseHandlerException
{
final ServerInvocation invocation = controllerContext.getServerInvocation();
- if (response instanceof PageRendition)
+ if (controllerResponse instanceof PageRendition)
{
- final PageRendition rendition = (PageRendition)response;
+ final PageRendition rendition = (PageRendition)controllerResponse;
// Defer execution of rendition to the right place which is in the classic
controller send response
return new HTTPResponse()
@@ -126,10 +126,10 @@
}
};
}
- else if (response instanceof SignOutResponse)
+ else if (controllerResponse instanceof SignOutResponse)
{
// Get the optional signout location
- String location = ((SignOutResponse)response).getLocation();
+ String location = ((SignOutResponse)controllerResponse).getLocation();
// Indicate that we want a sign out to be done
invocation.getResponse().setWantSignOut(true);
@@ -147,9 +147,9 @@
//
return new HTTPResponse.SendRedirect(location);
}
- else if (response instanceof StreamContentResponse)
+ else if (controllerResponse instanceof StreamContentResponse)
{
- StreamContentResponse scr = (StreamContentResponse)response;
+ StreamContentResponse scr = (StreamContentResponse)controllerResponse;
return new HTTPResponse.SendBinary(scr.getContentType(),
scr.getInputStream());
}
else
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/controller/classic/ThrowableResponseHandler.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -44,11 +44,11 @@
*/
public class ThrowableResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand controllerCommand, ControllerResponse controllerResponse) throws
ResponseHandlerException
{
- if (response instanceof ThrowableResponse)
+ if (controllerResponse instanceof ThrowableResponse)
{
- ThrowableResponse tr = (ThrowableResponse)response;
+ ThrowableResponse tr = (ThrowableResponse)controllerResponse;
Throwable t = tr.getThrowable();
URLContext urlContext =
controllerContext.getServerInvocation().getServerContext().getURLContext();
@@ -62,7 +62,7 @@
else
{
urlContext = URLContext.newInstance(urlContext.isSecure(), true);
- ServerURL serverURL =
controllerContext.getController().getURLFactory().doMapping(controllerContext,
controllerContext.getServerInvocation(), command);
+ ServerURL serverURL =
controllerContext.getController().getURLFactory().doMapping(controllerContext,
controllerContext.getServerInvocation(), controllerCommand);
String url =
controllerContext.getServerInvocation().getResponse().renderURL(serverURL, urlContext,
null);
return new HTTPResponse.SendRedirect(url);
}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandler.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -28,13 +28,25 @@
import org.jboss.portal.core.controller.ControllerResponse;
/**
+ * The response handler interface defines the contract for translating the result of the
execution
+ * of a command into a new type of result.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public interface ResponseHandler
{
+ /**
+ * Process the command response and provides an handler response.
+ *
+ * @param controllerContext the controller context
+ * @param controllerCommand the controller command
+ * @param controllerResponse the controller response
+ * @return the handler response
+ * @throws ResponseHandlerException
+ */
public HandlerResponse processCommandResponse(
ControllerContext controllerContext,
- ControllerCommand command,
- ControllerResponse response) throws ResponseHandlerException;
+ ControllerCommand controllerCommand,
+ ControllerResponse controllerResponse) throws ResponseHandlerException;
}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/controller/handler/ResponseHandlerSelector.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -61,15 +61,15 @@
this.ajaxResponseHandler = ajaxResponseHandler;
}
- public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand controllerCommand, ControllerResponse controllerResponse) throws
ResponseHandlerException
{
if (ControllerContext.AJAX_TYPE == controllerContext.getType())
{
- return ajaxResponseHandler.processCommandResponse(controllerContext, command,
response);
+ return ajaxResponseHandler.processCommandResponse(controllerContext,
controllerCommand, controllerResponse);
}
else
{
- return classicResponseHandler.processCommandResponse(controllerContext, command,
response);
+ return classicResponseHandler.processCommandResponse(controllerContext,
controllerCommand, controllerResponse);
}
}
}
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletResponseHandler.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -84,12 +84,12 @@
}
}
- public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand command, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand controllerCommand, ControllerResponse controllerResponse) throws
ResponseHandlerException
{
- if (response instanceof PortletResponse)
+ if (controllerResponse instanceof PortletResponse)
{
ServerInvocation invocation = controllerContext.getServerInvocation();
- PortletResponse pr = (PortletResponse)response;
+ PortletResponse pr = (PortletResponse)controllerResponse;
PortletInvocationResponse pir = pr.getResult();
//
@@ -118,12 +118,12 @@
else if (pir instanceof InsufficientTransportGuaranteeResponse)
{
boolean authenticated =
invocation.getServerContext().getURLContext().isAuthenticated();
- return new CommandForward(command, URLContext.newInstance(true,
authenticated));
+ return new CommandForward(controllerCommand, URLContext.newInstance(true,
authenticated));
}
else if (pir instanceof InsufficientPrivilegesResponse)
{
boolean authenticated =
invocation.getServerContext().getURLContext().isAuthenticated();
- return new CommandForward(command, URLContext.newInstance(true,
authenticated));
+ return new CommandForward(controllerCommand, URLContext.newInstance(true,
authenticated));
}
else if (pir instanceof SignOutResponse)
{
@@ -139,7 +139,7 @@
if (location == null)
{
// Redirect to the same page
- InvokePortletWindowActionCommand iwac =
(InvokePortletWindowActionCommand)command;
+ InvokePortletWindowActionCommand iwac =
(InvokePortletWindowActionCommand)controllerCommand;
Page page = iwac.getPage();
ViewPageCommand renderCmd = new ViewPageCommand(page.getId());
boolean secure =
invocation.getServerContext().getURLContext().isSecure();
Modified:
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/model/instance/PortletInstanceResponseHandler.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -47,13 +47,13 @@
*/
public class PortletInstanceResponseHandler implements ResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand codmmand, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand codmmand, ControllerResponse controllerResponse) throws
ResponseHandlerException
{
- if (response instanceof UpdatePortletInstanceResponse)
+ if (controllerResponse instanceof UpdatePortletInstanceResponse)
{
try
{
- UpdatePortletInstanceResponse upir =
(UpdatePortletInstanceResponse)response;
+ UpdatePortletInstanceResponse upir =
(UpdatePortletInstanceResponse)controllerResponse;
RenderPortletInstanceCommand render= new
RenderPortletInstanceCommand(upir.getInstanceId(), upir.getNavigationalState());
final PageRendition rendition =
(PageRendition)controllerContext.execute(render);
final ServerInvocation invocation = controllerContext.getServerInvocation();
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-05-26
22:12:54 UTC (rev 7344)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-05-29
08:44:29 UTC (rev 7345)
@@ -51,11 +51,11 @@
public class PortalObjectResponseHandler extends AbstractResponseHandler
{
- public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand ceommand, ControllerResponse response) throws ResponseHandlerException
+ public HandlerResponse processCommandResponse(ControllerContext controllerContext,
ControllerCommand ceommand, ControllerResponse controllerResponse) throws
ResponseHandlerException
{
- if (response instanceof UpdatePageResponse)
+ if (controllerResponse instanceof UpdatePageResponse)
{
- UpdatePageResponse uvr = (UpdatePageResponse)response;
+ UpdatePageResponse uvr = (UpdatePageResponse)controllerResponse;
try
{
@@ -80,9 +80,9 @@
return null;
}
}
- else if (response instanceof UpdateWindowResponse)
+ else if (controllerResponse instanceof UpdateWindowResponse)
{
- UpdateWindowResponse uwmr = (UpdateWindowResponse)response;
+ UpdateWindowResponse uwmr = (UpdateWindowResponse)controllerResponse;
PortalObjectContainer portalObjectContainer =
controllerContext.getController().getPortalObjectContainer();
PortalObject window = portalObjectContainer.getObject(uwmr.getWindowId());
Page page = (Page)window.getParent();