Examples of HandlerException


Examples of org.wymiwyg.wrhapi.HandlerException

   *      org.wymiwyg.rwcf.Response, org.wymiwyg.rwcf.HandlerChain)
   */
  public void handle(Request request, Response response, HandlerChain chain)
      throws HandlerException {
    if (isAdminExisting()) {
      throw new HandlerException(
          "Initial configuration already done (admin-users exists)");
    }
    if (request.getMethod().equals(Method.POST)) {
      hanlePost(request, response);
    } else {
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

        out.println("</pre></td></tr>");
      }
      out.println("</table>");
      out.close();
    } catch (IOException ex) {
      throw new HandlerException(ex);
    }
   
  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

      final PrintWriter out = new PrintWriter(pipedOut);
      JenaUtil.removeSomeDuplicateAnonymous(model);
      out.close();
     
    } catch (IOException e) {
      throw new HandlerException(e);
    }
   
  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

        out.println("</td></tr>");
      }
      out.println("</table>");
      out.close();
    } catch (IOException ex) {
      throw new HandlerException(ex);
    }
   
  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

            Transformer transformer =TransformerFactory.newInstance().newTransformer(styleSorce);
            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
            transformer.transform(new DOMSource(dom), new StreamResult(outStream));
            return new ByteArrayInputStream(outStream.toByteArray());
        } catch (Exception e) {
            throw new HandlerException("Exception presenting Exception: "+ex, e);
        }
    }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

      try {
        shortName = body.getParameterValues("shortName")[0];
      } catch (Exception ex) {
      }
      if (shortName == null) {
        throw new HandlerException("Must specify a shortName parameter");
      }
      String password = body.getParameterValues("password")[0];
      String create = null;
      try {
        create = body.getParameterValues("create")[0];
      } catch (Exception ex) {
      }
      ResIterator users = model.listSubjectsWithProperty(
          AUTHORIZATION.shortName, shortName);
      if (users.hasNext()) {
        user = users.nextResource();
      }
      /*
       * RDF.type, AUTHORIZATION.User); while (users.hasNext()) { Resource
       * current = users.nextResource(); if
       * (shortName.equals(current.getProperty(
       * AUTHORIZATION.shortName).getString())) { user = current; } }
       */
      users.close();

      if ((user == null) && ("true".equals(create))) {
        user = model.createResource();
        user.addProperty(RDF.type, AUTHORIZATION.User);
        user.addProperty(AUTHORIZATION.shortName, shortName);
      }
      boolean delete = false;
      try {
        delete = "delete".equals(body.getParameterValues("delete")[0]);
      } catch (Exception ex) {
      }

      if (delete) {
        user.removeProperties();
        new org.wymiwyg.rwcf.util.EnhancedResponse(response)
            .sendRedirect("/admin/user_manager");
        return;
      }
      user.removeAll(AUTHORIZATION.password);
      user.removeAll(AUTHORIZATION.pass_sha1sum);
      user.addProperty(AUTHORIZATION.pass_sha1sum, Util.sha1(password));
      String[] permissionStrings = body.getParameterValues("permission");
      user.removeAll(AUTHORIZATION.permission);
      if (permissionStrings != null) {
        for (int i = 0; i < permissionStrings.length; i++) {
          user.addProperty(AUTHORIZATION.permission, model
              .createResource(permissionStrings[i]));
        }
      }
    } else {
      String shortName = null;
      try {
        shortName = request.getRequestURI().getParameterValues(
            "shortName")[0];
      } catch (Exception ex) {
      }
      if (shortName == null) {
        throw new HandlerException("Must specify a shortName parameter");
      }
      /*
       * String password = request.getRequestURI()
       * .getParameterValues("password")[0];
       */
      String create = null;
      try {
        create = request.getRequestURI().getParameterValues("create")[0];
      } catch (Exception ex) {
      }
      ResIterator users = model.listSubjectsWithProperty(
          AUTHORIZATION.shortName, shortName);
      user = users.nextResource();
      /*
       * RDF.type, AUTHORIZATION.User); while (users.hasNext()) { Resource
       * current = users.nextResource(); if
       * (shortName.equals(current.getProperty(
       * AUTHORIZATION.shortName).getString())) { user = current; } }
       */
      users.close();
    }
    response.setHeader(HeaderName.CONTENT_TYPE, "application/xhtml+xml");
    PipedWriter pipedOut = new PipedWriter();
    PipedReader pipedIn;
    try {
      pipedIn = new PipedReader(pipedOut);
      response.setBody(pipedIn);
      PrintWriter out = new PrintWriter(pipedOut);
      printHeader(out);
      printTemplate(out, user);
      printFooter(out);
      out.close();
    } catch (IOException ex) {
      throw new HandlerException(ex);
    }

    //response.sendRedirect(go);
  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

      /*
       * try { Thread.sleep(1); } catch (InterruptedException e) { throw
       * new HandlerException(e); }
       */
    } catch (IOException e) {
      throw new HandlerException(e);
    } catch (SerializeException e) {
      throw new HandlerException(e);
    } catch (LanguageUnavailableException e) {
      throw new LanguageUnavailableHandlerException(e);
    } finally {
      try {
        out.close();
      } catch (IOException e) {
        throw new HandlerException(e);
      }
    }
    super.setBody(out.toByteArray());
   
  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

    body = (MultiPartBody) request.getBody();

    byte[] content = body.getFileContent("insertion");
    if (content == null) {
      log.error("No file specified, availabe Params are");
      throw new HandlerException("No file specified");
    }
    String base = body.getParameter("base");
    if (base == null) {
      base = "";
    }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

    if ("delete".equals(action)) {
      getLanguageResource(abbreviation).removeProperties();
    }
    if ("new".equals(action)) {
      if (getLanguageResource(abbreviation) != null) {
        throw new HandlerException("Language with that abbreviation already exists");
      }
      Resource languageRes = model.createResource();
      setPropertiesOn(languageRes, body);
    }
    if ("change".equals(action)) {
      Resource languageRes = getLanguageResource(abbreviation);
      if (languageRes == null) {
        throw new HandlerException("Language with that abbreviation does not exist");
      }
      languageRes.removeProperties();
      setPropertiesOn(languageRes, body);
    }
 
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

        }
        if (body instanceof byte[]) {
          in = new ByteArrayInputStream((byte[]) body);
        }
        if (in == null) {
          throw new HandlerException("Invalid body for template setting: "+body.getClass());
        } else {
          response.setBody(processor.process(in, template));
        }
      } catch (IOException e) {
        throw new HandlerException(e);
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.