Esempio n. 1
0
 public String projectsData(List projectList) {
   ArrayList<ProjectPublicDataDTO> tmpList = new ArrayList<ProjectPublicDataDTO>();
   for (int i = 0; i < projectList.size(); i++) {
     tmpList.add(new ProjectPublicDataDTO((Project) projectList.get(i), context.getLocale()));
   }
   return UpreaderApplication.getInstance().getJavaScriptWriter().write(tmpList);
 }
Esempio n. 2
0
  protected void includeErrorPage(Context context, Throwable exception) {
    if (this.useErrorCode500) {
      context.sendError(500);
    } else if (StringHelper.isNonEmpty(this.errorPage)
        && context.request().getAttribute("upreader.handled") == null) {
      context.request().setAttribute("upreader.handled", true);
      context.request().setAttribute("upreader.exception", true);
      context.request().setAttribute("upreader.stackTrace", convertStackTraceToString(exception));
      context.request().setAttribute("upreader.reveal", Boolean.valueOf(this.revealStackTrace));

      try {
        context.forward(errorPage);
      } catch (Exception exc) {
        outputDefaultErrorPage(context, exception);
      }
    } else {
      outputDefaultErrorPage(context, exception);
    }
  }
Esempio n. 3
0
 public List<SelectItem> retreiveSubGenres(String genre) {
   return UpreaderConstants.getLocalizedSubGenresResource(genre, context.getLocale());
 }
Esempio n. 4
0
 public String getLocalizedGenreResource(String genre) {
   return UpreaderConstants.getLocalizedGenreResource(genre, context.getLocale());
 }
Esempio n. 5
0
 public String getLocalizedCategoryResource(String category) {
   return UpreaderConstants.getLocalizedCategoryResource(category, context.getLocale());
 }
Esempio n. 6
0
 protected void outputDefaultErrorPage(Context context, Throwable exception) {
   if (this.revealStackTrace) {
     context.print("<html>");
     context.print("<head><title>Internal error</title>");
     context.print("<style>");
     context.print("body { background-color: white; color: black; }");
     context.print("p { font-family: Arial, Helvetica, Sans-serif; font-size: 12px; }");
     context.print(
         "h2 { font-family: Arial, Helvetica, Sans-serif; font-size: 14px; font-weight: bold; }");
     context.print("pre { font-size: 9px; }");
     context.print("</style>");
     context.print("</head>");
     context.print("<body>");
     context.print("<!-- BasicExceptionHandler -->");
     context.print("<h2>Internal error</h2>");
     context.print("<p>An exception was caught by the application infrastructure:</p>");
     context.print("<p><pre>");
     context.print(convertStackTraceToString(exception));
     context.print("");
     context.print("</pre></p>");
     if ((exception instanceof ServletException)) {
       ServletException servletException = (ServletException) exception;
       if (servletException.getRootCause() != null) {
         context.print("<p>Root cause:</p>");
         context.print("<p><pre>");
         context.print(convertStackTraceToString(servletException.getRootCause()));
         context.print("");
         context.print("</pre></p>");
       } else {
         context.print("<p>No root cause provided.</p>");
       }
     }
     context.print("</body>");
     context.print("</html>");
   } else {
     context.print("<html><head>");
     context.print("<title>Server Error</title>");
     context.print("<style>");
     context.print("body { background-color: white; color: black; }");
     context.print(
         "p, div { color: white; font-family: Tahoma, Verdana, Arial, Helvetica, Sans-serif; font-size: 14px; }");
     context.print(".container { border: 8px solid #777777; width: 350px; }");
     context.print(
         ".banner { background: #D06060; color: white; font-weight: bold; padding: 4px }");
     context.print(".text { background: #777777; padding: 4px; }");
     context.print("</style>");
     context.print("</head><body>");
     context.print("<!-- BasicExceptionHandler -->");
     context.print("<div class=\"container\">");
     context.print("<div class=\"banner\">Please bear with us...</div>");
     context.print(
         "<div class=\"text\">We're sorry, our web site is not able to process your request correctly at this time.  Please try again at a later time.  If this situation persists, please get in touch with our customer service or technical support staff.</div>");
     context.print("</div>");
     context.print("<!--");
     context.print(convertStackTraceToString(exception));
     if ((exception instanceof ServletException)) {
       ServletException servletException = (ServletException) exception;
       context.print("Root cause:");
       context.print(convertStackTraceToString(servletException.getRootCause()));
     }
     context.print("-->");
     context.print("</body></html>");
   }
 }