1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 * 9 * http://www.apache.org/licenses/LICENSE-2.010 * 11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17packageorg.apache.jetspeed.aggregator;
1819import org.apache.jetspeed.PortalReservedParameters;
20import org.apache.jetspeed.pipeline.PipelineException;
21import org.apache.jetspeed.pipeline.valve.AbstractValve;
22import org.apache.jetspeed.pipeline.valve.ValveContext;
23import org.apache.jetspeed.request.RequestContext;
2425/***26 * FileServerValve27 *28 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>29 * @version $Id: $30 */31publicclassFileServerValveextendsAbstractValve32 {
33private String portletName;
34private String portletEntity;
3536publicFileServerValve(String portletName, String portletEntity)
37 {
38this.portletName = portletName;
39this.portletEntity = portletEntity;
40 }
4142publicvoid invoke( RequestContext request, ValveContext context )
43 throws PipelineException
44 {
45try46 {
47 String entity = request.getRequestParameter(PortalReservedParameters.PORTLET_ENTITY);
48if (entity == null)
49 {
50 entity = (String)request.getAttribute(PortalReservedParameters.PORTLET_ENTITY);
51 }
52if (entity == null)
53 {
54 request.setAttribute(PortalReservedParameters.PORTLET_ENTITY, portletEntity);
55 }
5657 String name = request.getRequestParameter(PortalReservedParameters.PORTLET);
58if (name == null)
59 {
60 name = (String)request.getAttribute(PortalReservedParameters.PORTLET);
61 }
62if (name == null)
63 {
64 request.setAttribute(PortalReservedParameters.PORTLET, portletName);
65 }
66 }
67catch (Exception e)
68 {
69thrownew PipelineException(e);
70 }
71// Pass control to the next Valve in the Pipeline72 context.invokeNext( request );
73 }
7475public String toString()
76 {
77return"FileServerValve";
78 }
79 }