Examples of HandlerException


Examples of org.wymiwyg.wrhapi.HandlerException

                } catch (UnsupportedEncodingException e) {
                    throw new RuntimeException(e);
                }

            } catch (MimeTypeParseException e) {
                throw new HandlerException(e);
            }

        } else {
            super.setHeader(headerName, value);
        }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

    try {
      Resource document = createDocument(model, hashStore, baseUrl,
          typedContent.data, fileName, typedContent.type);
      JenaUtil.replace(importing, current, document);
    } catch (IOException e) {
      throw new HandlerException(e);
    }

  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

    PipedWriter pipedOut = new PipedWriter();
    PipedReader pipedReader;
    try {
      pipedReader = new PipedReader(pipedOut);
    } catch (IOException e) {
      throw new HandlerException(e);
    }
    response.setHeader(HeaderName.CONTENT_TYPE, "application/xhtml+xml");
    response.setBody(pipedReader);
    PrintWriter out = new PrintWriter(pipedOut);
    out.println("<!DOCTYPE html PUBLIC \"-//WYMIWYG//DTD extended XHTML//EN\" \"http://wymiwyg.org/dtd/exhtml.dtd\">");
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

        out.println(max+" are enough for now, call again to continue. (use get paramet \"max\" to change value");
      else
        out.println("processed all (=" + statements.size() + ") statements");
      out.close();
    } catch (IOException e) {
      throw new HandlerException(e);
    }
  }
View Full Code Here

Examples of org.wymiwyg.wrhapi.HandlerException

    String[] typeStrings = request.getHeaderValues(HeaderName.CONTENT_TYPE);
    if (typeStrings.length > 0) {
      try {
        type = new MimeType(typeStrings[0]);
      } catch (MimeTypeParseException e) {
        throw new HandlerException("Invalid MimeType: "
            + typeStrings[0]);
      }
    } else {
      type = DEFAULT_MIME_TYPE;
    }
View Full Code Here

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

Examples of org.wymiwyg.wrhapi.HandlerException

      // 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

Examples of org.wymiwyg.wrhapi.HandlerException

    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

Examples of org.wymiwyg.wrhapi.HandlerException

    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

Examples of org.wymiwyg.wrhapi.HandlerException

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

        }

    }
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.