Package org.wymiwyg.wrhapi

Examples of org.wymiwyg.wrhapi.HandlerException


      HashStore hashStore) throws HandlerException {
    try {
      sendItem(item, getDefaultAddress(item.getModel()),
          recipientURIString, acceptedLanguages, rootURL, hashStore);
    } catch (AddressException e) {
      throw new HandlerException("Couldn't get default address", e);
    }
  }
View Full Code Here


    public void handle(Request request, Response response, HandlerChain chain)
            throws HandlerException {
       Resource user = VirtuserHandler.getSubject();
       String[] uriStrings = request.getRequestURI().getParameterValues("uri");
       if ((uriStrings == null) || (uriStrings.length != 1)) {
           throw new HandlerException("must be invoked with exactly one uri param");
       }
       Resource item = model.getResource(uriStrings[0]);
       log.info("marking "+item+" as unread by "+user);
       model.createStatement(item, KNOBOT.isReadBy, user).remove();
       //MultiPartBody body = (MultiPartBody) request.getBody();
View Full Code Here

    EnhancedRequest ehRequest = new EnhancedRequest(request);
    MultiPartBody body;
    try {
      body = (MultiPartBody) request.getBody();
    } catch (ClassCastException ex) {
      throw new HandlerException(ResponseStatus.BAD_REQUEST, "CommentPostHandler invoked with a wrong request-body format");
    }
    String serializedModel = body.getParameter("model");
    if (serializedModel == null) {
      throw new HandlerException(ResponseStatus.BAD_REQUEST,
          "No serialized model found. Is JavaScript enabled?");
    }
    Model importing = ModelFactory.createDefaultModel();
    importing.read(new StringReader(serializedModel), ehRequest
        .getRequestURLWithoutParams().toString(), "RDF/XML");

    Resource[] roots = JenaUtil.getRoots(importing);
    if (roots.length != 1) {
      throw new HandlerException(
          "Imported model must have exactly one root");
    }
    Resource relation = roots[0];
    /*
     * if (!relation.hasProperty(RDF.type, KNOBOT.CommentRelation)) { throw
View Full Code Here

              }
              members.close();
            } else {
              try {
                if (!new URI(recipient.getURI()).getScheme().equals("mailto")) {
                  throw new HandlerException("Target uri "
                      + recipient.getURI()
                      + " is not a mail recipent");
                }
              } catch (URISyntaxException e) {
                throw new HandlerException(
                    "Target uri has invalid syntax", e);
              }
              individualRecipients.add(recipient);
            }
          }
View Full Code Here

    //    Set availableContentFlavours = (Set) request
    //        .getAttribute("org.wymiwyg.rwcf.tools.available-content-flavours");
    if (request.getRequestURI().getPath().equals("/error/404")) {
      log.error("Error 404 page not found, shoudl be at /error/404");
      throw new HandlerException(ResponseStatus.INTERNAL_SERVER_ERROR, "Errorpage does not exist, "+request.getRequestURI());
    }
    throw new NotFoundException();
  }
View Full Code Here

    //get this eraly just to fail faster
    InputStream dataIn;
    try {
      dataIn = resources[0].getInputStream();
    } catch (IOException e) {
      throw new HandlerException(e);
    }
    Locale locale = resources[0].getLocale();
    if (locale != null) {
      // check if locale in accept-language
      AcceptLanguagesIterator acceptedLangIter = ehRequest
View Full Code Here

      transformer.setOutputProperty(OutputKeys.METHOD, "xml");
      transformer.setOutputProperty(OutputKeys.INDENT, "yes");
      transformer.transform(new StreamSource(in), new DOMResult(result));
      in.close();
    } catch (TransformerConfigurationException e) {
      throw new HandlerException(e);
    } catch (TransformerException e) {
      throw new HandlerException("Exception transforming the XML in the request body", e);
    } catch (IOException e) {
      throw new HandlerException(e);
    }
    return result;
  }
View Full Code Here

    request = contextImpl.readModes(request);
    HandlerChainImpl handlerChain = contextImpl.getHandlerChain(request);
    if (handlerChain != null) {
      handlerChain.doNext(request, response);
    } else {
      throw new HandlerException("handlerChain is null");
      // chain.doFilter(servletRequest, servletResponse);
    }

  }
View Full Code Here

      }
      InputStream rawIn;
      try {
          rawIn = (InputStream) request.getBody();
      } catch (ClassCastException ex) {
          throw new HandlerException("request body is of type "+request.getBody().getClass(), ex);
      }
      DelimiterInputStream in = new DelimiterInputStream(rawIn);

      ByteArrayOutputStream delimiterBaos = new ByteArrayOutputStream();
      delimiterBaos.write(45);//dash
      delimiterBaos.write(45);
      delimiterBaos.write(boundary.getBytes("utf-8"));
      byte[] delimiter = delimiterBaos.toByteArray();
      in.readTill(delimiter);
      in.read(); //13
      in.read(); //10
      delimiterBaos = new ByteArrayOutputStream();
      delimiterBaos.write(LINE_BREAK);
      delimiterBaos.write(delimiter);
      readFields(in, delimiterBaos.toByteArray());
      //from rfc 2616: a bare CR
      //or LF MUST NOT be substituted for CRLF within any of the HTTP
      // control
      //structures (such as header fields and multipart boundaries)
      //this means we are strict in expecting CRLF
    } catch (IOException e) {
      throw new HandlerException(e);
    }
  }
View Full Code Here

    public void handle(Request request, Response response, HandlerChain chain)
            throws HandlerException {
        Model resultModel = ModelFactory.createDefaultModel();
        String[] ifpStrings = request.getRequestURI().getParameterValues("ifp");
        if ((ifpStrings == null) || ( ifpStrings.length != 1)) {
            throw new HandlerException("Needs exactly one ifp parameter");
        }
        String[] valuesStrings = request.getRequestURI().getParameterValues("value");
        if ((valuesStrings == null) || ( valuesStrings.length != 1)) {
          throw new HandlerException("Needs exactly one value parameter");
        }
        Property ifp = model.createProperty(ifpStrings[0]);
        Resource value = model.createResource(valuesStrings[0]);
        ResIterator iter = model.listSubjectsWithProperty(ifp, value);
        while (iter.hasNext()) {
View Full Code Here

TOP

Related Classes of org.wymiwyg.wrhapi.HandlerException

Copyright © 2018 www.massapicom. 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.