Cleaning up javadocs and adding missing license headers.

This commit is contained in:
Jeremy Grelle
2007-10-29 16:06:01 +00:00
parent 79916db73b
commit 6d5db0da26
32 changed files with 590 additions and 4 deletions

View File

@@ -7,6 +7,13 @@ import javax.faces.event.PhaseListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* {@link PhaseListener} that logs the execution of the individual phases of the JSF lifecycle. Useful during JSF
* application development in order to detect unreported JSF errors that cause the lifecycle to short-circuit. Turn
* logging level to DEBUG to see its output.
*
* @author Jeremy Grelle
*/
public class RequestLoggingPhaseListener implements PhaseListener {
private Log logger = LogFactory.getLog(RequestLoggingPhaseListener.class);
@@ -16,7 +23,9 @@ public class RequestLoggingPhaseListener implements PhaseListener {
}
public void beforePhase(PhaseEvent event) {
logger.debug("Entering JSF Phase: " + event.getPhaseId());
if (logger.isDebugEnabled()) {
logger.debug("Entering JSF Phase: " + event.getPhaseId());
}
}
public PhaseId getPhaseId() {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.el.ValueExpression;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import java.io.IOException;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.el.ValueExpression;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
public class DojoClientDateValidator extends DojoAdvisor {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
public class DojoClientNumberValidator extends DojoAdvisor {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
public class DojoClientTextValidator extends DojoAdvisor {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import java.io.IOException;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.el.ValueExpression;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import java.io.IOException;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.faces.context.FacesContext;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.faces.context.FacesContext;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.faces.context.FacesContext;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.faces.component.UIComponentBase;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import java.io.IOException;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import java.io.IOException;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import javax.faces.component.UIComponentBase;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.ui;
import java.io.IOException;

View File

@@ -1,5 +1,21 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import javax.faces.application.NavigationHandler;
import javax.faces.component.ActionSource;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
@@ -8,6 +24,14 @@ import javax.faces.event.ActionListener;
import org.springframework.util.StringUtils;
/**
* The default {@link ActionListener} implementation to be used with Web Flow.
* <p>
* This implementation bypasses the JSF {@link NavigationHandler} mechanism to instead let the event be handled directly
* by Web Flow.
*
* @author Jeremy Grelle
*/
public class FlowActionListener implements ActionListener {
public void processAction(ActionEvent actionEvent) throws AbortProcessingException {

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.io.IOException;
@@ -10,6 +25,12 @@ import javax.faces.context.FacesContext;
import org.springframework.webflow.execution.RequestContextHolder;
/**
* Simple delegating {@link ViewHandler} implementation that provides JSF Form's with the correct FlowExecution URL,
* including the current FlowExecutionKey, so that postbacks may be properly intercepted and handled by Web Flow.
*
* @author Jeremy Grelle
*/
public class FlowExecutionViewHandler extends ViewHandler {
ViewHandler delegate;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.util.Iterator;
@@ -16,9 +31,16 @@ import org.springframework.binding.message.Message;
import org.springframework.binding.message.MessageResolver;
import org.springframework.binding.message.Messages;
import org.springframework.binding.message.Severity;
import org.springframework.context.MessageSource;
import org.springframework.util.StringUtils;
import org.springframework.webflow.execution.RequestContextHolder;
/**
* Custom {@link FacesContext} implementation that delegates all standard FacesContext messaging functionality to a
* Spring {@link MessageSource} made accessible as part of the current Web Flow request.
*
* @author Jeremy Grelle
*/
public class FlowFacesContext extends FacesContext {
/**

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import javax.faces.FacesException;
@@ -5,6 +20,14 @@ import javax.faces.context.FacesContext;
import javax.faces.context.FacesContextFactory;
import javax.faces.lifecycle.Lifecycle;
import org.springframework.context.MessageSource;
/**
* {@link FacesContextFactory} implementation that installs the {@link FlowFacesContext}, allowing for integration with
* a Spring {@link MessageSource}.
*
* @author Jeremy Grelle
*/
public class FlowFacesContextFactory extends FacesContextFactory {
FacesContextFactory delegate;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import javax.faces.FacesException;
@@ -6,6 +21,15 @@ import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import javax.faces.lifecycle.Lifecycle;
/**
* Custom {@link Lifecycle} for Spring Web Flow that only executes the APPLY_REQUEST_VALUES through INVOKE_APPLICATION
* phases.
* <p>
* This Lifecycle does not execute the RESTORE_VIEW phase since view creation and restoration are now handled by the
* {@link JsfViewFactory}.
*
* @author Jeremy Grelle
*/
public class FlowLifecycle extends Lifecycle {
private final Lifecycle delegate;
@@ -27,18 +51,30 @@ public class FlowLifecycle extends Lifecycle {
}
}
/**
* Delegates to the wrapped {@link Lifecycle}.
*/
public void render(FacesContext context) throws FacesException {
delegate.render(context);
}
/**
* Delegates to the wrapped {@link Lifecycle}.
*/
public void addPhaseListener(PhaseListener listener) {
delegate.addPhaseListener(listener);
}
/**
* Delegates to the wrapped {@link Lifecycle}.
*/
public PhaseListener[] getPhaseListeners() {
return delegate.getPhaseListeners();
}
/**
* Delegates to the wrapped {@link Lifecycle}.
*/
public void removePhaseListener(PhaseListener listener) {
delegate.removePhaseListener(listener);
}

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.util.Iterator;
@@ -5,6 +20,15 @@ import java.util.Iterator;
import javax.faces.lifecycle.Lifecycle;
import javax.faces.lifecycle.LifecycleFactory;
/**
* This {@link LifecycleFactory} implementation is responsible for installing a custom JSF Lifecycle the executes within
* the context of Spring Web Flow.
* <p>
* The {@link FlowLifecycle} will be configured to delegate to the default {@link Lifecycle} where custom behavior is
* not needed.
*
* @author Jeremy Grelle
*/
public class FlowLifecycleFactory extends LifecycleFactory {
public static final String FLOW_LIFECYCLE_ID = "org.springframework.FlowLifecycle";
@@ -24,7 +48,7 @@ public class FlowLifecycleFactory extends LifecycleFactory {
return delegate.getLifecycle(lifecycleId);
}
public Iterator getLifecycleIds() {
public Iterator<String> getLifecycleIds() {
return delegate.getLifecycleIds();
}

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.util.Iterator;
@@ -6,6 +21,12 @@ import javax.faces.context.FacesContext;
import javax.faces.render.RenderKit;
import javax.faces.render.RenderKitFactory;
/**
* {@link RenderKitFactory} implementation that wraps the current {@link RenderKit} implementation inside the
* {@link FlowRenderKitWrapper}.
*
* @author Jeremy Grelle
*/
public class FlowRenderKitFactory extends RenderKitFactory {
private RenderKitFactory delegate;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.io.OutputStream;
@@ -9,6 +24,12 @@ import javax.faces.render.RenderKit;
import javax.faces.render.Renderer;
import javax.faces.render.ResponseStateManager;
/**
* Delegating {@link RenderKit} implementation that provides a custom {@link ResponseStateManager} for storing JSF view
* state as part of the current FlowExecution.
*
* @author Jeremy Grelle
*/
public class FlowRenderKitWrapper extends RenderKit {
RenderKit delegate;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.io.IOException;
@@ -9,8 +24,15 @@ import javax.faces.context.FacesContext;
import javax.faces.render.ResponseStateManager;
import org.springframework.webflow.execution.FlowExecution;
import org.springframework.webflow.execution.FlowExecutionKey;
import org.springframework.webflow.execution.RequestContextHolder;
/**
* {@link ResponseStateManager} implementation that writes out the current {@link FlowExecutionKey} in place of the JSF
* view state, and manages the JSF view state as part of the FlowExecution instance state.
*
* @author Jeremy Grelle
*/
public class FlowResponseStateManager extends ResponseStateManager {
private static final int VIEW_ID_INDEX = 0;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import javax.faces.FactoryFinder;
@@ -11,6 +26,11 @@ import javax.faces.lifecycle.Lifecycle;
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.RequestContextHolder;
/**
* Common support for the JSF integration with Spring Web Flow.
*
* @author Jeremy Grelle
*/
class JsfFlowUtils {
public static FacesContext getFacesContext(Lifecycle lifecycle) {

View File

@@ -1,12 +1,38 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import javax.faces.component.UIViewRoot;
import org.springframework.util.Assert;
import org.springframework.webflow.engine.EndState;
import org.springframework.webflow.execution.Action;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.View;
import org.springframework.webflow.execution.ViewFactory;
/**
* Specialized {@link Action} implementation for rendering the JSF view in an {@link EndState}.
* <p>
* Before the final view is rendered, the {@link UIViewRoot} will be marked transient in order to bypass the JSF state
* saving process.
*
* @author Jeremy Grelle
*/
public class JsfRenderFinalResponseAction implements Action {
ViewFactory viewFactory;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.io.IOException;
@@ -14,6 +29,11 @@ import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.execution.View;
/**
* JSF-specific {@link View} implementation.
*
* @author Jeremy Grelle
*/
public class JsfView implements View {
public static final String EVENT_KEY = "org.springframework.webflow.FacesEvent";
@@ -58,6 +78,9 @@ public class JsfView implements View {
return this.viewRoot;
}
/**
* This implementation performs the standard duties of the JSF RENDER_RESPONSE phase.
*/
public void render() {
FacesContext facesContext = JsfFlowUtils.getFacesContext(facesLifecycle);
facesContext.setViewRoot(viewRoot);

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import java.util.Iterator;
@@ -16,6 +31,15 @@ import org.springframework.webflow.execution.RequestContext;
import org.springframework.webflow.execution.View;
import org.springframework.webflow.execution.ViewFactory;
/**
* JSF-specific {@link ViewFactory} implementation.
* <p>
* This factory is responsible for performing the duties of the RESTORE_VIEW phase of the JSF lifecycle. If the current
* request is a post-back, then the rest of the standard JSF lifecyle through INVOKE_APPLICATION will be executed as
* well when an existing {@link JsfView} is found and restored.
*
* @author Jeremy Grelle
*/
public class JsfViewFactory implements ViewFactory {
private final Lifecycle facesLifecycle;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2004-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.faces.webflow;
import javax.faces.FactoryFinder;
@@ -10,9 +25,9 @@ import org.springframework.webflow.execution.Action;
import org.springframework.webflow.execution.ViewFactory;
/**
* A ViewFactoryCreator implementation for creating JSF ViewFactories
* @author Jeremy Grelle
* A {@link ViewFactoryCreator} implementation for creating instances of a JSF-specific {@link ViewFactory}.
*
* @author Jeremy Grelle
*/
public class JsfViewFactoryCreator implements ViewFactoryCreator {