001 // Copyright 2008, 2009 The Apache Software Foundation
002 //
003 // Licensed under the Apache License, Version 2.0 (the "License");
004 // you may not use this file except in compliance with the License.
005 // You may obtain a copy of the License at
006 //
007 // http://www.apache.org/licenses/LICENSE-2.0
008 //
009 // Unless required by applicable law or agreed to in writing, software
010 // distributed under the License is distributed on an "AS IS" BASIS,
011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 // See the License for the specific language governing permissions and
013 // limitations under the License.
014
015 package org.apache.tapestry5.services;
016
017 import org.apache.tapestry5.EventContext;
018 import org.apache.tapestry5.internal.TapestryInternalUtils;
019 import org.apache.tapestry5.ioc.internal.util.Defense;
020
021 /**
022 * Used with {@link org.apache.tapestry5.services.PageRenderRequestHandler} and {@link
023 * org.apache.tapestry5.services.PageRenderRequestFilter} to define the logical page name and activation context for the
024 * request.
025 */
026 public class PageRenderRequestParameters
027 {
028 private final String logicalPageName;
029
030 private final EventContext activationContext;
031
032 public PageRenderRequestParameters(String logicalPageName, EventContext activationContext)
033 {
034 Defense.notNull(logicalPageName, "logicalPageName");
035 Defense.notNull(activationContext, "activationContext");
036
037 this.logicalPageName = logicalPageName;
038 this.activationContext = activationContext;
039 }
040
041 public String getLogicalPageName()
042 {
043 return logicalPageName;
044 }
045
046 public EventContext getActivationContext()
047 {
048 return activationContext;
049 }
050
051 @Override
052 public boolean equals(Object obj)
053 {
054 if (this == obj) return true;
055
056 if (obj == null || getClass() != obj.getClass()) return false;
057
058 PageRenderRequestParameters other = (PageRenderRequestParameters) obj;
059
060 return logicalPageName.equals(other.logicalPageName) &&
061 TapestryInternalUtils.isEqual(activationContext, other.activationContext);
062 }
063
064
065 @Override
066 public String toString()
067 {
068 return String.format("PageRenderRequestParameters[%s]", logicalPageName);
069 }
070 }