Author: chris.laprun(a)jboss.com
Date: 2010-08-23 19:00:40 -0400 (Mon, 23 Aug 2010)
New Revision: 3893
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java
Log:
- GNTWSRP-42, GTNWSRP-43: done for GetResource, HandleEvents and
PerformBlockingInteraction, forcing setting of RegistrationContext and UserContext since
the WSRP xsd specifies that they are required, albeit nillable.
- Renamed createResourceRequest and createMarkupRequest to createGetResource and
createGetMarkup for better consistency.
- Removed unused createDefaultResourceRequest method.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -160,48 +160,63 @@
* @param handle
* @return
*/
- public static GetMarkup createDefaultMarkupRequest(String handle)
+ public static GetMarkup createDefaultGetMarkup(String handle)
{
- return createMarkupRequest(createPortletContext(handle),
createDefaultRuntimeContext(), createDefaultMarkupParams());
+ return createGetMarkup(null, createPortletContext(handle),
createDefaultRuntimeContext(), null, createDefaultMarkupParams());
}
/**
- * registrationContext(RegistrationContext)?, portletContext(PortletContext),
runtimeContext(RuntimeContext),
- * userContext(UserContext)?, markupParams(MarkupParams)
+ * {@link RegistrationContext} (nillable), {@link PortletContext}, {@link
RuntimeContext}, {@link UserContext}
+ * (nillable), {@link MarkupParams}
*
+ * @param registrationContext can be null
* @param portletContext
* @param runtimeContext
+ * @param userContext can be null
* @param markupParams
* @return
- * @throws IllegalArgumentException if one of the required parameters is
<code>null</code>
+ * @throws IllegalArgumentException if one of the required, non-nillable parameters is
<code>null</code>
*/
- public static GetMarkup createMarkupRequest(PortletContext portletContext,
RuntimeContext runtimeContext, MarkupParams markupParams)
+ public static GetMarkup createGetMarkup(RegistrationContext registrationContext,
PortletContext portletContext, RuntimeContext runtimeContext, UserContext userContext,
MarkupParams markupParams)
{
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
+
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletContext.getPortletHandle(),
"portlet handle", "PortletContext");
ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext,
"RuntimeContext");
- ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
ParameterValidation.throwIllegalArgExceptionIfNull(markupParams,
"MarkupParams");
GetMarkup getMarkup = new GetMarkup();
+ getMarkup.setRegistrationContext(registrationContext);
getMarkup.setPortletContext(portletContext);
getMarkup.setRuntimeContext(runtimeContext);
+ getMarkup.setUserContext(userContext);
getMarkup.setMarkupParams(markupParams);
return getMarkup;
}
- public static GetResource createDefaultResourceRequest(String handle, String
resourceID)
+ /**
+ * {@link RegistrationContext} (nillable), {@link PortletContext}, {@link
RuntimeContext}, {@link UserContext}
+ * (nillable), {@link ResourceParams}
+ *
+ * @param registrationContext can be null
+ * @param portletContext
+ * @param runtimeContext
+ * @param userContext can be null
+ * @param resourceParams
+ * @return
+ * @throws IllegalArgumentException if one of the required, non-nillable parameters is
<code>null</code>
+ */
+ public static GetResource createGetResource(RegistrationContext registrationContext,
PortletContext portletContext, RuntimeContext runtimeContext, UserContext userContext,
ResourceParams resourceParams)
{
- return createResourceRequest(createPortletContext(handle),
createDefaultRuntimeContext(), createDefaultResourceParams(resourceID));
- }
-
- public static GetResource createResourceRequest(PortletContext portletContext,
RuntimeContext runtimeContext, ResourceParams resourceParams)
- {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
+
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletContext.getPortletHandle(),
"portlet handle", "PortletContext");
ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext,
"RuntimeContext");
- ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
ParameterValidation.throwIllegalArgExceptionIfNull(resourceParams,
"ResourceParams");
GetResource getResource = new GetResource();
+ getResource.setRegistrationContext(registrationContext);
getResource.setPortletContext(portletContext);
getResource.setRuntimeContext(runtimeContext);
+ getResource.setUserContext(userContext);
getResource.setResourceParams(resourceParams);
return getResource;
}
@@ -215,23 +230,26 @@
*/
public static PerformBlockingInteraction
createDefaultPerformBlockingInteraction(String portletHandle)
{
- return createPerformBlockingInteraction(createPortletContext(portletHandle),
createDefaultRuntimeContext(), createDefaultMarkupParams(),
+ return createPerformBlockingInteraction(null, createPortletContext(portletHandle),
createDefaultRuntimeContext(), null, createDefaultMarkupParams(),
createDefaultInteractionParams());
}
/**
- * {@link RegistrationContext}?, {@link PortletContext}, {@link RuntimeContext},
{@link UserContext}?, {@link
- * MarkupParams}, {@link InteractionParams}
+ * {@link RegistrationContext} (nillable), {@link PortletContext}, {@link
RuntimeContext}, {@link UserContext}
+ * (nillable), {@link MarkupParams}, {@link InteractionParams}
*
+ * @param registrationContext can be null
* @param portletContext
* @param runtimeContext
+ * @param userContext can be null
* @param markupParams
* @param interactionParams
* @return
+ * @throws IllegalArgumentException if one of the required, non-nillable parameters is
<code>null</code>
*/
public static PerformBlockingInteraction createPerformBlockingInteraction(
- PortletContext portletContext, RuntimeContext runtimeContext,
- MarkupParams markupParams,
+ RegistrationContext registrationContext, PortletContext portletContext,
RuntimeContext runtimeContext,
+ UserContext userContext, MarkupParams markupParams,
InteractionParams interactionParams)
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
@@ -241,14 +259,47 @@
ParameterValidation.throwIllegalArgExceptionIfNull(interactionParams,
"InteractionParams");
PerformBlockingInteraction performBlockingInteraction = new
PerformBlockingInteraction();
+ performBlockingInteraction.setRegistrationContext(registrationContext);
performBlockingInteraction.setPortletContext(portletContext);
performBlockingInteraction.setRuntimeContext(runtimeContext);
+ performBlockingInteraction.setUserContext(userContext);
performBlockingInteraction.setMarkupParams(markupParams);
performBlockingInteraction.setInteractionParams(interactionParams);
return performBlockingInteraction;
}
/**
+ * {@link RegistrationContext} (nillable), {@link PortletContext}, {@link
RuntimeContext}, {@link UserContext}
+ * (nillable), {@link MarkupParams}, {@link EventParams}
+ *
+ * @param registrationContext can be null
+ * @param portletContext
+ * @param runtimeContext
+ * @param userContext can be null
+ * @param markupParams
+ * @param eventParams
+ * @return
+ */
+ public static HandleEvents createHandleEvents(RegistrationContext registrationContext,
PortletContext portletContext, RuntimeContext runtimeContext,
+ UserContext userContext, MarkupParams
markupParams, EventParams eventParams)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
+
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletContext.getPortletHandle(),
"portlet handle", "PortletContext");
+ ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext,
"RuntimeContext");
+ ParameterValidation.throwIllegalArgExceptionIfNull(markupParams,
"MarkupParams");
+ ParameterValidation.throwIllegalArgExceptionIfNull(eventParams,
"EventParams");
+
+ HandleEvents handleEvents = new HandleEvents();
+ handleEvents.setRegistrationContext(registrationContext);
+ handleEvents.setPortletContext(portletContext);
+ handleEvents.setRuntimeContext(runtimeContext);
+ handleEvents.setUserContext(userContext);
+ handleEvents.setMarkupParams(markupParams);
+ handleEvents.setEventParams(eventParams);
+ return handleEvents;
+ }
+
+ /**
* registrationContext(RegistrationContext)?, portletContext(PortletContext),
userContext(UserContext)?,
* desiredLocales(xsd:string)*
*
@@ -1300,23 +1351,6 @@
return new HandleEventsResponse();
}
- public static HandleEvents createHandleEvents(PortletContext portletContext,
RuntimeContext runtimeContext,
- MarkupParams markupParams, EventParams
eventParams)
- {
- ParameterValidation.throwIllegalArgExceptionIfNull(portletContext,
"PortletContext");
-
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletContext.getPortletHandle(),
"portlet handle", "PortletContext");
- ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext,
"RuntimeContext");
- ParameterValidation.throwIllegalArgExceptionIfNull(markupParams,
"MarkupParams");
- ParameterValidation.throwIllegalArgExceptionIfNull(eventParams,
"EventParams");
-
- HandleEvents handleEvents = new HandleEvents();
- handleEvents.setPortletContext(portletContext);
- handleEvents.setEventParams(eventParams);
- handleEvents.setMarkupParams(markupParams);
- handleEvents.setRuntimeContext(runtimeContext);
- return handleEvents;
- }
-
public static EventParams createEventParams(List<Event> events, StateChange
portletStateChange)
{
if (!ParameterValidation.existsAndIsNotEmpty(events))
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java
===================================================================
---
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/spec/v1/V1ToV2Converter.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -886,12 +886,10 @@
PortletContext portletContext =
toV2PortletContext(getMarkup.getPortletContext());
RuntimeContext runtimeContext =
toV2RuntimeContext(getMarkup.getRuntimeContext());
MarkupParams markupParams = toV2MarkupParams(getMarkup.getMarkupParams());
- GetMarkup result = WSRPTypeFactory.createMarkupRequest(portletContext,
runtimeContext, markupParams);
+ RegistrationContext registrationContext =
toV2RegistrationContext(getMarkup.getRegistrationContext());
+ UserContext userContext = toV2UserContext(getMarkup.getUserContext());
-
result.setRegistrationContext(toV2RegistrationContext(getMarkup.getRegistrationContext()));
- result.setUserContext(toV2UserContext(getMarkup.getUserContext()));
-
- return result;
+ return WSRPTypeFactory.createGetMarkup(registrationContext, portletContext,
runtimeContext, userContext, markupParams);
}
else
{
@@ -941,12 +939,8 @@
PortletContext portletContext =
toV2PortletContext(performBlockingInteraction.getPortletContext());
RuntimeContext runtimeContext =
toV2RuntimeContext(performBlockingInteraction.getRuntimeContext());
- PerformBlockingInteraction result =
WSRPTypeFactory.createPerformBlockingInteraction(portletContext, runtimeContext,
markupParams, interactionParams);
-
-
result.setRegistrationContext(toV2RegistrationContext(performBlockingInteraction.getRegistrationContext()));
-
result.setUserContext(toV2UserContext(performBlockingInteraction.getUserContext()));
-
- return result;
+ return
WSRPTypeFactory.createPerformBlockingInteraction(toV2RegistrationContext(performBlockingInteraction.getRegistrationContext()),
+ portletContext, runtimeContext,
toV2UserContext(performBlockingInteraction.getUserContext()), markupParams,
interactionParams);
}
else
{
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -49,7 +49,6 @@
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.UpdateResponse;
import org.oasis.wsrp.v2.UploadContext;
-import org.oasis.wsrp.v2.UserContext;
import javax.xml.ws.Holder;
import java.io.BufferedInputStream;
@@ -73,7 +72,7 @@
super(consumer);
}
- @Override
+ /*@Override
protected void updateUserContext(PerformBlockingInteraction
performBlockingInteraction, UserContext userContext)
{
performBlockingInteraction.setUserContext(userContext);
@@ -83,7 +82,7 @@
protected void updateRegistrationContext(PerformBlockingInteraction
performBlockingInteraction) throws PortletInvokerException
{
performBlockingInteraction.setRegistrationContext(consumer.getRegistrationContext());
- }
+ }*/
@Override
protected RuntimeContext getRuntimeContextFrom(PerformBlockingInteraction
performBlockingInteraction)
@@ -258,8 +257,8 @@
}
// Create the blocking action request
- return WSRPTypeFactory.createPerformBlockingInteraction(portletContext,
requestPrecursor.getRuntimeContext(),
- requestPrecursor.getMarkupParams(), interactionParams);
+ return
WSRPTypeFactory.createPerformBlockingInteraction(requestPrecursor.getRegistrationContext(),
portletContext,
+ requestPrecursor.getRuntimeContext(), requestPrecursor.getUserContext(),
requestPrecursor.getMarkupParams(), interactionParams);
}
protected PortletInvocationResponse processResponse(BlockingInteractionResponse
response, ActionInvocation invocation, RequestPrecursor<ActionInvocation>
requestPrecursor) throws PortletInvokerException
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -42,7 +42,6 @@
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.UpdateResponse;
-import org.oasis.wsrp.v2.UserContext;
import javax.xml.namespace.QName;
import javax.xml.ws.Holder;
@@ -61,7 +60,7 @@
super(consumer);
}
- @Override
+ /*@Override
protected void updateUserContext(HandleEvents request, UserContext userContext)
{
request.setUserContext(userContext);
@@ -71,7 +70,7 @@
protected void updateRegistrationContext(HandleEvents request) throws
PortletInvokerException
{
request.setRegistrationContext(consumer.getRegistrationContext());
- }
+ }*/
@Override
protected RuntimeContext getRuntimeContextFrom(HandleEvents request)
@@ -129,8 +128,8 @@
Event event = WSRPTypeFactory.createEvent(name, payload);
EventParams eventParams =
WSRPTypeFactory.createEventParams(Collections.singletonList(event),
WSRPUtils.getStateChangeFromAccessMode(accessMode));
- return WSRPTypeFactory.createHandleEvents(portletContext,
requestPrecursor.getRuntimeContext(),
- requestPrecursor.getMarkupParams(), eventParams);
+ return
WSRPTypeFactory.createHandleEvents(requestPrecursor.getRegistrationContext(),
portletContext,
+ requestPrecursor.getRuntimeContext(), requestPrecursor.getUserContext(),
requestPrecursor.getMarkupParams(), eventParams);
}
@Override
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -46,6 +46,7 @@
import org.oasis.wsrp.v2.NavigationalContext;
import org.oasis.wsrp.v2.OperationFailed;
import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.RegistrationContext;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.UserContext;
import org.slf4j.Logger;
@@ -136,7 +137,7 @@
SessionHandler sessionHandler = consumer.getSessionHandler();
// prepare everything for the request
- updateRegistrationContext(request);
+// updateRegistrationContext(request);
RuntimeContext runtimeContext = getRuntimeContextFrom(request);
if (runtimeContext != null)
@@ -147,7 +148,7 @@
InstanceContext instanceContext = invocation.getInstanceContext();
runtimeContext.setPortletInstanceKey(instanceContext == null ? null :
instanceContext.getId());
- updateUserContext(request, consumer.getUserContextFrom(invocation,
runtimeContext));
+// updateUserContext(request, consumer.getUserContextFrom(invocation,
runtimeContext));
consumer.setTemplatesIfNeeded(invocation, runtimeContext);
}
@@ -280,9 +281,9 @@
}
}
- protected abstract void updateUserContext(Request request, UserContext userContext);
+// protected abstract void updateUserContext(Request request, UserContext
userContext);
- protected abstract void updateRegistrationContext(Request request) throws
PortletInvokerException;
+// protected abstract void updateRegistrationContext(Request request) throws
PortletInvokerException;
protected abstract RuntimeContext getRuntimeContextFrom(Request request);
@@ -306,6 +307,8 @@
private PortletContext portletContext;
private RuntimeContext runtimeContext;
private MarkupParams markupParams;
+ private RegistrationContext registrationContext;
+ private UserContext userContext;
private static final String PORTLET_HANDLE = "portlet handle";
private static final String SECURITY_CONTEXT = "security context";
private static final String USER_CONTEXT = "user context";
@@ -323,12 +326,19 @@
log.debug("About to invoke on portlet: " + getPortletHandle());
}
+ // registration context
+ registrationContext = wsrpConsumer.getRegistrationContext();
+
+
// create runtime context
SecurityContext securityContext = invocation.getSecurityContext();
ParameterValidation.throwIllegalArgExceptionIfNull(securityContext,
SECURITY_CONTEXT);
String authType =
WSRPUtils.convertRequestAuthTypeToWSRPAuthType(securityContext.getAuthType());
- setRuntimeContext(WSRPTypeFactory.createRuntimeContext(authType));
+ runtimeContext = WSRPTypeFactory.createRuntimeContext(authType);
+ // user context
+ userContext = wsrpConsumer.getUserContextFrom(invocation, runtimeContext);
+
// set the session id if needed
wsrpConsumer.getSessionHandler().setSessionIdIfNeeded(invocation,
getRuntimeContext(), getPortletHandle());
@@ -364,9 +374,9 @@
windowState = WSRPConstants.NORMAL_WINDOW_STATE;
}
- setMarkupParams(WSRPTypeFactory.createMarkupParams(securityContext.isSecure(),
+ this.markupParams =
WSRPTypeFactory.createMarkupParams(securityContext.isSecure(),
WSRPUtils.convertLocalesToRFC3066LanguageTags(userContext.getLocales()),
- Collections.singletonList(streamInfo.getMediaType().getValue()), mode,
windowState));
+ Collections.singletonList(streamInfo.getMediaType().getValue()), mode,
windowState);
String userAgent =
WSRPConsumerImpl.getHttpRequest(invocation).getHeader(USER_AGENT);
getMarkupParams().setClientData(WSRPTypeFactory.createClientData(userAgent));
@@ -393,24 +403,24 @@
return portletContext;
}
- public RuntimeContext getRuntimeContext()
+ public RegistrationContext getRegistrationContext()
{
- return runtimeContext;
+ return registrationContext;
}
- private void setRuntimeContext(RuntimeContext runtimeContext)
+ public UserContext getUserContext()
{
- this.runtimeContext = runtimeContext;
+ return userContext;
}
- public MarkupParams getMarkupParams()
+ public RuntimeContext getRuntimeContext()
{
- return markupParams;
+ return runtimeContext;
}
- private void setMarkupParams(MarkupParams markupParams)
+ public MarkupParams getMarkupParams()
{
- this.markupParams = markupParams;
+ return markupParams;
}
}
}
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -23,7 +23,6 @@
package org.gatein.wsrp.consumer.handlers;
-import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.RenderInvocation;
import org.gatein.pc.api.invocation.response.FragmentResponse;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
@@ -37,7 +36,6 @@
import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.SessionContext;
-import org.oasis.wsrp.v2.UserContext;
import javax.xml.ws.Holder;
import java.util.List;
@@ -86,10 +84,11 @@
{
log.debug("Consumer about to attempt rendering portlet '" +
portletContext.getPortletHandle() + "'");
}
- return WSRPTypeFactory.createMarkupRequest(portletContext,
requestPrecursor.getRuntimeContext(), requestPrecursor.getMarkupParams());
+ return WSRPTypeFactory.createGetMarkup(requestPrecursor.getRegistrationContext(),
portletContext,
+ requestPrecursor.getRuntimeContext(), requestPrecursor.getUserContext(),
requestPrecursor.getMarkupParams());
}
- protected void updateUserContext(GetMarkup request, UserContext userContext)
+ /*protected void updateUserContext(GetMarkup request, UserContext userContext)
{
request.setUserContext(userContext);
}
@@ -97,7 +96,7 @@
protected void updateRegistrationContext(GetMarkup request) throws
PortletInvokerException
{
request.setRegistrationContext(consumer.getRegistrationContext());
- }
+ }*/
protected RuntimeContext getRuntimeContextFrom(GetMarkup request)
{
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -24,7 +24,6 @@
package org.gatein.wsrp.consumer.handlers;
import org.gatein.common.util.ParameterValidation;
-import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.StateString;
import org.gatein.pc.api.invocation.ResourceInvocation;
import org.gatein.pc.api.spi.InstanceContext;
@@ -43,7 +42,6 @@
import org.oasis.wsrp.v2.ResourceResponse;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.SessionContext;
-import org.oasis.wsrp.v2.UserContext;
import javax.xml.ws.Holder;
import java.util.List;
@@ -73,7 +71,7 @@
return resourceResponse.getResourceContext();
}
- @Override
+ /*@Override
protected void updateUserContext(GetResource request, UserContext userContext)
{
request.setUserContext(userContext);
@@ -83,7 +81,7 @@
protected void updateRegistrationContext(GetResource request) throws
PortletInvokerException
{
request.setRegistrationContext(consumer.getRegistrationContext());
- }
+ }*/
@Override
protected RuntimeContext getRuntimeContextFrom(GetResource request)
@@ -138,7 +136,8 @@
}
}
- return WSRPTypeFactory.createResourceRequest(portletContext,
requestPrecursor.getRuntimeContext(), resourceParams);
+ return WSRPTypeFactory.createGetResource(requestPrecursor.getRegistrationContext(),
portletContext,
+ requestPrecursor.getRuntimeContext(), requestPrecursor.getUserContext(),
resourceParams);
}
@Override
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v1/MarkupEndpoint.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -118,16 +118,13 @@
forceSessionAccess();
PerformBlockingInteraction performBlockingInteraction =
WSRPTypeFactory.createPerformBlockingInteraction(
- V1ToV2Converter.toV2PortletContext(portletContext),
+ V1ToV2Converter.toV2RegistrationContext(registrationContext),
V1ToV2Converter.toV2PortletContext(portletContext),
V1ToV2Converter.toV2RuntimeContext(runtimeContext),
- V1ToV2Converter.toV2MarkupParams(markupParams),
+ V1ToV2Converter.toV2UserContext(userContext),
V1ToV2Converter.toV2MarkupParams(markupParams),
V1ToV2Converter.toV2InteractionParams(interactionParams)
);
-
performBlockingInteraction.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
-
performBlockingInteraction.setUserContext(V1ToV2Converter.toV2UserContext(userContext));
-
- BlockingInteractionResponse interactionResponse = null;
+ BlockingInteractionResponse interactionResponse;
try
{
interactionResponse =
producer.performBlockingInteraction(performBlockingInteraction);
@@ -267,13 +264,13 @@
{
forceSessionAccess();
- GetMarkup getMarkup = WSRPTypeFactory.createMarkupRequest(
+ GetMarkup getMarkup = WSRPTypeFactory.createGetMarkup(
+ V1ToV2Converter.toV2RegistrationContext(registrationContext),
V1ToV2Converter.toV2PortletContext(portletContext),
V1ToV2Converter.toV2RuntimeContext(runtimeContext),
+ V1ToV2Converter.toV2UserContext(userContext),
V1ToV2Converter.toV2MarkupParams(markupParams)
);
-
getMarkup.setRegistrationContext(V1ToV2Converter.toV2RegistrationContext(registrationContext));
- getMarkup.setUserContext(V1ToV2Converter.toV2UserContext(userContext));
MarkupResponse response;
try
Modified:
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/wsrp-producer-war/src/main/java/org/gatein/wsrp/endpoints/v2/MarkupEndpoint.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -107,9 +107,7 @@
{
forceSessionAccess();
- HandleEvents handleEvents = WSRPTypeFactory.createHandleEvents(portletContext,
runtimeContext, markupParams, eventParams);
- handleEvents.setRegistrationContext(registrationContext);
- handleEvents.setUserContext(userContext);
+ HandleEvents handleEvents = WSRPTypeFactory.createHandleEvents(registrationContext,
portletContext, runtimeContext, userContext, markupParams, eventParams);
HandleEventsResponse response = producer.handleEvents(handleEvents);
Modified:
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java
===================================================================
---
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java 2010-08-23
19:56:17 UTC (rev 3892)
+++
components/wsrp/trunk/wsrp-producer-war/src/test/java/org/gatein/wsrp/protocol/v2/NeedPortletHandleTest.java 2010-08-23
23:00:40 UTC (rev 3893)
@@ -202,7 +202,7 @@
*/
protected GetMarkup createMarkupRequest(String handle) throws RemoteException,
InvalidRegistration, OperationFailed
{
- GetMarkup getMarkup = WSRPTypeFactory.createDefaultMarkupRequest(handle);
+ GetMarkup getMarkup = WSRPTypeFactory.createDefaultGetMarkup(handle);
getMarkup.getMarkupParams().getMarkupCharacterSets().add(WSRPConstants.DEFAULT_CHARACTER_SET);
return getMarkup;