%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.container.url.impl.PortalURLValveImpl |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * 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 and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | ||
18 | package org.apache.jetspeed.container.url.impl; |
|
19 | ||
20 | import org.apache.jetspeed.container.state.NavigationalStateComponent; |
|
21 | import org.apache.jetspeed.pipeline.PipelineException; |
|
22 | import org.apache.jetspeed.pipeline.valve.AbstractValve; |
|
23 | import org.apache.jetspeed.pipeline.valve.ValveContext; |
|
24 | import org.apache.jetspeed.request.RequestContext; |
|
25 | import org.apache.jetspeed.desktop.JetspeedDesktop; |
|
26 | ||
27 | /** |
|
28 | * Creates the PortalURL for the current Request |
|
29 | * |
|
30 | * @author <a href="mailto:ate@apache.org">Ate Douma</a> |
|
31 | * @version $Id: PortalURLValveImpl.java 588430 2007-10-26 00:08:07Z smilek $ |
|
32 | */ |
|
33 | public class PortalURLValveImpl extends AbstractValve |
|
34 | { |
|
35 | private NavigationalStateComponent navComponent; |
|
36 | ||
37 | public PortalURLValveImpl(NavigationalStateComponent navComponent) |
|
38 | 0 | { |
39 | 0 | this.navComponent = navComponent; |
40 | 0 | } |
41 | ||
42 | public void invoke(RequestContext request, ValveContext context) |
|
43 | throws PipelineException |
|
44 | { |
|
45 | try |
|
46 | { |
|
47 | 0 | if ( request.getPortalURL() == null ) |
48 | { |
|
49 | 0 | String encoding = request.getRequestParameter(JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER); |
50 | 0 | if (encoding != null && encoding.equals(JetspeedDesktop.DESKTOP_ENCODER_REQUEST_PARAMETER_VALUE)) |
51 | { |
|
52 | 0 | request.setPortalURL(navComponent.createDesktopURL(request.getRequest(), request.getCharacterEncoding())); |
53 | 0 | request.setAttribute( JetspeedDesktop.DESKTOP_ENABLED_REQUEST_ATTRIBUTE, Boolean.TRUE ); |
54 | } |
|
55 | else |
|
56 | { |
|
57 | 0 | request.setPortalURL(navComponent.createURL(request.getRequest(), request.getCharacterEncoding())); |
58 | } |
|
59 | ||
60 | } |
|
61 | } |
|
62 | 0 | catch (Exception e) |
63 | { |
|
64 | 0 | throw new PipelineException(e); |
65 | 0 | } |
66 | // Pass control to the next Valve in the Pipeline |
|
67 | 0 | context.invokeNext( request ); |
68 | 0 | } |
69 | ||
70 | public String toString() |
|
71 | { |
|
72 | 0 | return "PortalURLValveImpl"; |
73 | } |
|
74 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |