KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > portlet > mvc > PortletModeNameViewController


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.web.portlet.mvc;
18
19 import javax.portlet.ActionRequest;
20 import javax.portlet.ActionResponse;
21 import javax.portlet.PortletException;
22 import javax.portlet.RenderRequest;
23 import javax.portlet.RenderResponse;
24
25 import org.springframework.web.portlet.ModelAndView;
26
27 /**
28  * <p>Trivial controller that transforms the PortletMode to a view name.
29  * The advantage here is that the client is not exposed to
30  * the concrete view technology but rather just to the controller URL;
31  * the concrete view will be determined by the ViewResolver.</p>
32  *
33  * <p>Example: PortletMode.VIEW -> "view"</p>
34  *
35  * <p>This controller does not handle action requests.</p>
36  *
37  * @author William G. Thompson, Jr.
38  * @author John A. Lewis
39  * @since 2.0
40  */

41 public class PortletModeNameViewController implements Controller {
42
43     public void handleActionRequest(ActionRequest request, ActionResponse response) throws Exception JavaDoc {
44         throw new PortletException("PortletModeNameViewController does not handle action requests");
45     }
46
47     public ModelAndView handleRenderRequest(RenderRequest request, RenderResponse response) {
48         return new ModelAndView(request.getPortletMode().toString());
49     }
50
51 }
52
Popular Tags