Package org.wymiwyg.wrhapi

Examples of org.wymiwyg.wrhapi.HandlerException


        "available");
    String go;
    try {
      go = request.getRequestURI().getParameterValues("go")[0];
    } catch (ArrayIndexOutOfBoundsException e) {
      throw new HandlerException("no go parameter specified");
    } catch (NullPointerException e) {
      throw new HandlerException("no go parameter specified");
    }
    EnhancedRequest ehRequest = new EnhancedRequest(request);
    Model resultModel = ModelFactory.createDefaultModel();
    // URL test = getClass().getResource("selection.rdf");
    // resultModel.read(getClass().getResourceAsStream("selection.rdf"),
View Full Code Here


      // String imageContentURN = "urn:hash::md5:" + MD5.dumpBytes(hash);
      URI imageContentURN;
      try {
        imageContentURN = hashStore.storeContent(fileContent);
      } catch (Exception e) {
        throw new HandlerException(e);
      }
      Model model = resource.getModel();
      Resource contentResource = model.createResource(imageContentURN
          .toString());
      RemoveHandler.removeVariant(resource, contentResource.toString(),
          mimeType.toString());
      resource.addProperty(RDF.type, DOCUMENT.Document);
      Resource documentVariant = model
          .createResource(DOCUMENT.DocumentVariant);
      resource.addProperty(DOCUMENT.variant, documentVariant);
      documentVariant.addProperty(DOCUMENT.contentType, mimeType.toString());
      documentVariant.addProperty(DOCUMENT.content, contentResource);
      documentVariant.addProperty(DOCUMENT.contentLength, model
          .createTypedLiteral(fileContent.length));
      Literal createdLit = model.createTypedLiteral(new W3CDateFormat()
          .format(new Date()), XSDDatatype.XSDdateTime);

      documentVariant.addProperty(DCTerms.created, createdLit);
      if ((language != null) && (!language.equals("independent"))) {
        documentVariant.addProperty(DC.language, language);
      }
      Set variantsSet = new HashSet();
      variantsSet.add(documentVariant);
      FormatConverter[] formatConverters = getFormatConverters(resource
          .getModel(), hashStore);
      for (int i = 0; i < formatConverters.length; i++) {
        Collection sourceFormats = Arrays.asList(formatConverters[i].getSourceFormats());
        if (sourceFormats.contains(mimeType)) {
          Resource newVariant = model.createResource();
          MimeType[] targetTypes = formatConverters[i].getTargetFormats();
          for (int j = 0; j < targetTypes.length; j++) {
            MimeType targetType = targetTypes[j];
            try {
              formatConverters[i].transform(resource, mimeType, targetType, documentVariant, newVariant);
            } catch (IOException e) {
              throw new HandlerException(e);
            }
            variantsSet.add(newVariant);
            resource.addProperty(DOCUMENT.variant, newVariant);
          }
        }
      }
      AudioContentProcessor.readProperties(mimeType, fileContent,
          documentVariant);
      try {
        createWebDavResource(resource);
      } catch (URISyntaxException e) {
        throw new HandlerException(e);
      }
    }
  }
View Full Code Here

    try {
      for (int ch = in.read(); ch != -1; ch = in.read()) {
        bOut.write(ch);
      }
    } catch (IOException e) {
      throw new HandlerException("Writing to byte array", e);
    }
    String language;
    String[] languageHeaders = request
        .getHeaderValues(HeaderName.CONTENT_LANGUAGE);
    if (languageHeaders.length > 0) {
      language = languageHeaders[0];
    } else {
      language = null;
    }
    MimeType mimeType;
    try {
      try {
        mimeType = new MimeType(request
            .getHeaderValues(HeaderName.CONTENT_TYPE)[0]);
      } catch (ArrayIndexOutOfBoundsException e) {
        mimeType = new MimeType("unknown/unknown");
      }
    } catch (MimeTypeParseException e) {
      throw new HandlerException("No valid mime-type", e);
    }
    createDocument(resource, bOut.toByteArray(), language, mimeType,
        hashStore);
    System.out.println("----");
    response.setResponseStatus(ResponseStatus.NO_CONTENT);
View Full Code Here

    PipedWriter pipedWriter = new PipedWriter();
    PipedReader pipedReader;
    try {
      pipedReader = new PipedReader(pipedWriter);
    } catch (IOException ex) {
      throw new HandlerException(ex);
    }
    setBody(pipedReader);
    return new PrintWriter(pipedWriter);
  }
View Full Code Here

                out.println("Please wait...");
                out.println("</body>");
                out.println("</html>");
                out.close();
            } catch (IOException ex) {
                throw new HandlerException(ex);
            }

        }

    }
View Full Code Here

   *      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

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

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

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

            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

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.