001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU General
007: * Public License Version 2 only ("GPL") or the Common Development and Distribution
008: * License("CDDL") (collectively, the "License"). You may not use this file except in
009: * compliance with the License. You can obtain a copy of the License at
010: * http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
011: * License for the specific language governing permissions and limitations under the
012: * License. When distributing the software, include this License Header Notice in
013: * each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Sun
014: * designates this particular file as subject to the "Classpath" exception as
015: * provided by Sun in the GPL Version 2 section of the License file that
016: * accompanied this code. If applicable, add the following below the License Header,
017: * with the fields enclosed by brackets [] replaced by your own identifying
018: * information: "Portions Copyrighted [year] [name of copyright owner]"
019: *
020: * Contributor(s):
021: *
022: * The Original Software is NetBeans. The Initial Developer of the Original Software
023: * is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
024: * Rights Reserved.
025: *
026: * If you wish your version of this file to be governed by only the CDDL or only the
027: * GPL Version 2, indicate your decision by adding "[Contributor] elects to include
028: * this software in this distribution under the [CDDL or GPL Version 2] license." If
029: * you do not indicate a single choice of license, a recipient has the option to
030: * distribute your version of this file under either the CDDL, the GPL Version 2 or
031: * to extend the choice of license to its licensees as provided above. However, if
032: * you add GPL Version 2 code and therefore, elected the GPL Version 2 license, then
033: * the option applies only if the new code is made subject to such option by the
034: * copyright holder.
035: */
036:
037: package org.netbeans.installer.infra.server.client.servlets;
038:
039: import java.io.IOException;
040: import java.io.PrintWriter;
041: import java.util.List;
042: import javax.ejb.EJB;
043: import javax.servlet.ServletException;
044: import javax.servlet.http.HttpServlet;
045: import javax.servlet.http.HttpServletRequest;
046: import javax.servlet.http.HttpServletResponse;
047: import org.netbeans.installer.infra.server.ejb.Manager;
048: import org.netbeans.installer.infra.server.ejb.ManagerException;
049:
050: /**
051: *
052: * @author Kirill Sorokin
053: * @version
054: */
055: public class Registries extends HttpServlet {
056: @EJB
057: private Manager manager;
058:
059: protected void doGet(HttpServletRequest request,
060: HttpServletResponse response) throws ServletException,
061: IOException {
062: response.setContentType("text/html; encoding=UTF-8");
063:
064: PrintWriter out = response.getWriter();
065:
066: try {
067:
068: List<String> registries = manager.getRegistries();
069:
070: out
071: .println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
072: out.println("<html>");
073: out.println(" <head>");
074: out
075: .println(" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
076: out.println(" <title>Registries</title>");
077: out
078: .println(" <link rel=\"stylesheet\" href=\"admin/css/main.css\" type=\"text/css\"/>");
079: out
080: .println(" <script src=\"js/main.js\" type=\"text/javascript\"></script>");
081: out.println(" </head>");
082: out.println(" <body>");
083:
084: out.println(" <p>");
085: out
086: .println(" Please select the registries that you would like to work with. The either click Install to immediately launch the installer, or Next to select the components and create a bundle.");
087: out.println(" </p>");
088:
089: out.println(" <form name=\"Form\" method=\"get\">");
090: for (String registry : registries) {
091: out
092: .println(" <input type=\"checkbox\" name=\"registry\" value=\""
093: + registry
094: + "\" checked/> "
095: + registry
096: + "<br/>");
097: }
098: out.println(" <br/><br/>");
099: out
100: .println(" <input type=\"button\" value=\"Install Now\" onclick=\"install_now()\"> ");
101: out
102: .println(" <input type=\"button\" value=\"Next >\" onclick=\"create_bundle()\">");
103: out.println(" </form>");
104:
105: out.println(" </body>");
106: out.println("</html>");
107: } catch (ManagerException e) {
108: response
109: .setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
110: e.printStackTrace(response.getWriter());
111: }
112:
113: out.close();
114: }
115: }
|