diff options
Diffstat (limited to 'sandbox/thilina/geronimo_ACE/src/main/java/org/apache')
-rw-r--r-- | sandbox/thilina/geronimo_ACE/src/main/java/org/apache/tuscany/geronimoace/GeronimoACE.java | 157 |
1 files changed, 78 insertions, 79 deletions
diff --git a/sandbox/thilina/geronimo_ACE/src/main/java/org/apache/tuscany/geronimoace/GeronimoACE.java b/sandbox/thilina/geronimo_ACE/src/main/java/org/apache/tuscany/geronimoace/GeronimoACE.java index f55776fc0a..3eb5b82ed3 100644 --- a/sandbox/thilina/geronimo_ACE/src/main/java/org/apache/tuscany/geronimoace/GeronimoACE.java +++ b/sandbox/thilina/geronimo_ACE/src/main/java/org/apache/tuscany/geronimoace/GeronimoACE.java @@ -1,79 +1,78 @@ -/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.geronimoace;
-
-import javax.portlet.*;
-import java.io.IOException;
-
-public class GeronimoACE extends GenericPortlet {
- private String viewUrl = "/pages/Home.jsp";
-
-
- public void init(PortletConfig config) throws PortletException {
- super.init(config);
- // viewUrl = config.getInitParameter("view_url");
- }
-
- public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException {
- String task = request.getParameter("task");
- String domain = request.getParameter("domainName");
- if (task != null) {
- if (task.equals("list")) {
- viewUrl = "/pages/ListDomains.jsp";
- }
- }
- if (domain != null) {
- request.setAttribute("domain", domain);
- viewUrl = "/pages/ManageDomain.jsp";
- }
- response.setPortletMode(PortletMode.VIEW);
- }
-
- public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
- // Set the response to read HTML
- response.setContentType("text/html;charset=UTF-8");
-
- PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(viewUrl);
- dispatcher.include(request, response);
-
-
- }
-
-
-}
+/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.geronimoace; + +import javax.portlet.*; +import java.io.IOException; + +public class GeronimoACE extends GenericPortlet { + private String viewUrl = "/pages/Home.jsp"; // viewUrl is set to the home page by default + boolean isHome = true; // used for navigating back to the home page. + + + public void init(PortletConfig config) throws PortletException { + super.init(config); + } + + public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { + isHome = true; + String task = request.getParameter("task"); // getting request parameters task and domain name + String domain = request.getParameter("domainName"); + if (task != null) { + if (task.equals("composites")) { // if the request is for Composites,forwarding to Composites.html + viewUrl = "/pages/Composite.html"; + } + if (task.equals("workspace")) { // if the request is for Contributions,forwarding to workspace.html + viewUrl = "/pages/Workspace.html"; + } + if (task.equals("cloud")) { // if the request is for Clouds,forwarding to Cloud.html + viewUrl = "/pages/Cloud.html"; + } + if (task.equals("files")) { // iif the request is for Files,forwarding to Files.html + viewUrl = "/pages/Files.html"; + } + } + + response.setPortletMode(PortletMode.VIEW); // by changing portlet mode, doview methos is called again. + + + } + + public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { + // Set the response to read HTML + response.setContentType("text/html;charset=UTF-8"); + + if (isHome) { + // dispatching to the appropriate page + PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(viewUrl); + dispatcher.include(request, response); + isHome = false; + } else { + // dispatching to the home page. + PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/pages/Home.jsp"); + dispatcher.include(request, response); + isHome = true; + } + } + +} + + + |