[java-opensaml COMMIT] in /trunk/opensaml-profile-api/src: main/java/org/opensaml/profile/action/AbstractProfileActio...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Oct 11 15:21:50 EDT 2013
Author: scantor
Date: Fri Oct 11 15:21:49 2013
New Revision: 3469
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3469&view=rev
Log:
Refactor use of HttpServlet* in profile actions out of context into injected objects.
Modified:
trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java
trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java
trunk/opensaml-profile-api/src/test/java/org/opensaml/profile/RequestContextBuilder.java
Modified: trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java?rev=3469&r1=3468&r2=3469&view=diff
==============================================================================
--- trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java (original)
+++ trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/action/AbstractProfileAction.java Fri Oct 11 15:21:49 2013
@@ -18,6 +18,9 @@
package org.opensaml.profile.action;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.opensaml.profile.ProfileException;
@@ -25,6 +28,7 @@
import org.opensaml.profile.context.ProfileRequestContext;
import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
+import net.shibboleth.utilities.java.support.component.ComponentSupport;
//TODO perf metrics
@@ -39,6 +43,12 @@
extends AbstractIdentifiableInitializableComponent
implements ProfileAction<InboundMessageType, OutboundMessageType> {
+ /** Current HTTP request, if available. */
+ @Nullable private HttpServletRequest httpServletRequest;
+
+ /** Current HTTP response, if available. */
+ @Nullable private HttpServletResponse httpServletResponse;
+
/**
* Constructor.
*
@@ -55,6 +65,47 @@
super.setId(componentId);
}
+
+ /**
+ * Get the current HTTP request if available.
+ *
+ * @return current HTTP request
+ */
+ @Nullable public HttpServletRequest getHttpServletRequest() {
+ return httpServletRequest;
+ }
+
+ /**
+ * Set the current HTTP request.
+ *
+ * @param request current HTTP request
+ */
+ public void setHttpServletRequest(@Nullable final HttpServletRequest request) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ httpServletRequest = request;
+ }
+
+ /**
+ * Get the current HTTP response.
+ *
+ * @return current HTTP response
+ */
+ @Nullable public HttpServletResponse getHttpServletResponse() {
+ return httpServletResponse;
+ }
+
+ /**
+ * Set the current HTTP response.
+ *
+ * @param response current HTTP response
+ */
+ public void setHttpServletResponse(@Nullable final HttpServletResponse response) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ httpServletResponse = response;
+ }
+
/** {@inheritDoc} */
public void execute(
@Nonnull final ProfileRequestContext<InboundMessageType, OutboundMessageType> profileRequestContext)
Modified: trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java?rev=3469&r1=3468&r2=3469&view=diff
==============================================================================
--- trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java (original)
+++ trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/ProfileRequestContext.java Fri Oct 11 15:21:49 2013
@@ -20,8 +20,6 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
@@ -52,12 +50,6 @@
* user.
*/
private boolean passiveProfile;
-
- /** Current HTTP request. */
- private transient HttpServletRequest httpRequest;
-
- /** Current HTTP response. */
- private transient HttpServletResponse httpResponse;
/** Constructor. */
public ProfileRequestContext() {
@@ -106,39 +98,4 @@
passiveProfile = isPassive;
}
- /**
- * Gets the current HTTP request if available.
- *
- * @return current HTTP request
- */
- @Nullable public HttpServletRequest getHttpRequest() {
- return httpRequest;
- }
-
- /**
[... 141 lines stripped ...]
More information about the commits
mailing list