1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.aggregator;
18
19 import org.apache.jetspeed.PortalReservedParameters;
20 import org.apache.jetspeed.pipeline.PipelineException;
21 import org.apache.jetspeed.pipeline.valve.AbstractValve;
22 import org.apache.jetspeed.pipeline.valve.ValveContext;
23 import org.apache.jetspeed.request.RequestContext;
24
25 /***
26 * FileServerValve
27 *
28 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
29 * @version $Id: $
30 */
31 public class FileServerValve extends AbstractValve
32 {
33 private String portletName;
34 private String portletEntity;
35
36 public FileServerValve(String portletName, String portletEntity)
37 {
38 this.portletName = portletName;
39 this.portletEntity = portletEntity;
40 }
41
42 public void invoke( RequestContext request, ValveContext context )
43 throws PipelineException
44 {
45 try
46 {
47 String entity = request.getRequestParameter(PortalReservedParameters.PORTLET_ENTITY);
48 if (entity == null)
49 {
50 entity = (String)request.getAttribute(PortalReservedParameters.PORTLET_ENTITY);
51 }
52 if (entity == null)
53 {
54 request.setAttribute(PortalReservedParameters.PORTLET_ENTITY, portletEntity);
55 }
56
57 String name = request.getRequestParameter(PortalReservedParameters.PORTLET);
58 if (name == null)
59 {
60 name = (String)request.getAttribute(PortalReservedParameters.PORTLET);
61 }
62 if (name == null)
63 {
64 request.setAttribute(PortalReservedParameters.PORTLET, portletName);
65 }
66 }
67 catch (Exception e)
68 {
69 throw new PipelineException(e);
70 }
71
72 context.invokeNext( request );
73 }
74
75 public String toString()
76 {
77 return "FileServerValve";
78 }
79 }