// Return the HTML code for the repository
  @Override
  public void doGet(
      HttpServletRequest request, HttpServletResponse response, Identity subject, Identity object)
      throws Exception {

    String[] stylesheet_links = {"repository", "model_properties"};
    String stylesheet_ie_fix = "repository_ie_fixes";

    String backend_path = "/backend";
    String ext_path = backend_path + "/ext-2.0.2/";

    response.setStatus(200);
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();

    String languageFiles = "";

    String languageCode = this.getLanguageCode(request);
    String countryCode = this.getCountryCode(request);

    // Add language file with language code only if it exists
    if (new File(this.getBackendRootDirectory() + "/i18n/translation_" + languageCode + ".js")
        .exists()) {
      languageFiles +=
          "<script src=\""
              + backend_path
              + "/i18n/translation_"
              + languageCode
              + ".js\" type=\"text/javascript\" ></script>\n";
    }
    // Add language file for country and language code if it exists
    if (new File(
            this.getBackendRootDirectory()
                + "/i18n/translation_"
                + languageCode
                + "_"
                + countryCode
                + ".js")
        .exists()) {
      languageFiles +=
          "<script src=\""
              + backend_path
              + "/i18n/translation_"
              + languageCode
              + "_"
              + countryCode
              + ".js\" type=\"text/javascript\" ></script>\n";
    }

    out.println(
        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
    out.println("<html>");
    out.println("<head>");
    out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
    // This prevents no caching of the repository site for IE
    out.println("<meta http-equiv=\"Pragma\" content=\"no-cache\">");
    out.println("<meta http-equiv=\"Expires\" content=\"-1\">");

    out.println(
        "<link rel=\"stylesheet\" type=\"text/css\" href=\""
            + ext_path
            + "resources/css/ext-all.css\">");
    out.println(
        "<link rel=\"stylesheet\" type=\"text/css\" href=\""
            + ext_path
            + "resources/css/xtheme-gray.css\">");
    out.println(
        "<script type=\"text/javascript\" src=\""
            + backend_path
            + "/repository2/prototype.js\"></script>");
    out.println(
        "<script type=\"text/javascript\" src=\""
            + ext_path
            + "adapter/ext/ext-base.js\"></script>");
    out.println("<script type=\"text/javascript\" src=\"" + ext_path + "ext-all.js\"></script>");
    // out.println("<script type=\"text/javascript\" src=\"" + ext_path +
    // "ext-all-debug.js\"></script>");
    // for (String include : java_script_includes) {
    // out.println("<script type=\"text/javascript\" src=\"" + backend_path
    // + "/repository2/" + include + ".js\"></script>");
    // }
    out.println(
        "<script type=\"text/javascript\">if(!Repository) var Repository = {}; Repository.currentUser='******';</script>");
    out.println(getRepositoryPluginScripts(request));

    out.println(
        "<script src=\""
            + backend_path
            + "/i18n/translation_en_us.js\" type=\"text/javascript\" ></script>\n");
    out.println(languageFiles);
    for (String stylesheet : stylesheet_links) {
      out.println(
          "<link rel=\"stylesheet\" type=\"text/css\" href=\""
              + backend_path
              + "/css/"
              + stylesheet
              + ".css\">");
    }

    // Added a css-fix for IE
    out.println("<!--[if IE]>");
    out.println("<style type=\"text/css\">");
    out.println("@import url(" + backend_path + "/css/" + stylesheet_ie_fix + ".css);");
    out.println("</style>");
    out.println("<![endif]-->");

    // out.println("<script type=\"text/javascript\">Ext.onReady(function(){new
    // Repository.Core.Repository(\""
    // + subject.getUri() + "\");});</script>");
    out.println("<title>ORYX - Repository 2.0 (BETA)</title>");
    out.println("</head>");
    out.println("<body>");

    String analytics = getServletContext().getInitParameter("ANALYTICS_SNIPPET");
    if (null != analytics) {
      out.println(analytics);
    }

    out.println("</body>");
    out.println("</html>");
  }
Пример #2
0
 /** Test method for {@link org.b3mn.poem.util.HandlerInfo#getExportInfo()}. */
 @Test
 public final void testSaveNewModel() {
   newModelIdentity = Identity.newModel(user.getIdentity(), title, type, summary, svg, data);
   assertNotNull(newModelIdentity);
 }