Examples of ResourceContent


Examples of ch.entwine.weblounge.common.content.ResourceContent

    System.setProperty("java.awt.headless", "true");
    System.setProperty("weblounge.jai", Boolean.TRUE.toString());
  }

  public void setUp() {
    ResourceContent resourceContent = EasyMock.createNiceMock(ResourceContent.class);
    EasyMock.expect(resourceContent.getMimetype()).andReturn("image/png");
    EasyMock.replay(resourceContent);
    resource = EasyMock.createNiceMock(Resource.class);
    EasyMock.expect(resource.getContent((Language) EasyMock.anyObject())).andStubReturn(resourceContent);
    EasyMock.replay(resource);
  }
View Full Code Here

Examples of ch.entwine.weblounge.common.content.ResourceContent

    String eTag = ResourceUtils.getETagValue(scaledResourceFile);
    response.tag(eTag);

    // Add filename header
    String filename = null;
    ResourceContent resourceContent = resource.getContent(language);
    if (resourceContent != null)
      filename = resourceContent.getFilename();
    if (StringUtils.isBlank(filename))
      filename = scaledResourceFile.getName();
    response.header("Content-Disposition", "inline; filename=" + filename);

    // Content length
View Full Code Here

Examples of ch.entwine.weblounge.common.content.ResourceContent

      if (!SecurityUtils.userHasRole(user, SystemRole.EDITOR))
        throw new WebApplicationException(Status.UNAUTHORIZED);

      // Try to create the resource content
      InputStream is = null;
      ResourceContent content = null;
      ResourceContentReader<?> reader = null;
      ResourceSerializer<?, ?> serializer = serializerService.getSerializerByType(resource.getURI().getType());
      try {
        reader = serializer.getContentReader();
        is = new FileInputStream(uploadedFile);
View Full Code Here

Examples of ch.entwine.weblounge.common.content.ResourceContent

    if (resource == null || resource.contents().isEmpty()) {
      throw new WebApplicationException(Status.NOT_FOUND);
    }

    // Get the resource content
    ResourceContent content = resource.getContent(language);
    if (content == null) {
      throw new WebApplicationException(Status.NOT_FOUND);
    }

    ResourceURI uri = resource.getURI();
View Full Code Here

Examples of ch.entwine.weblounge.common.content.ResourceContent

      } catch (ContentRepositoryException e) {
        logger.warn("Error adding new resource {}: {}", resourceURI, e.getMessage());
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
      }

      ResourceContent content = null;
      ResourceContentReader<?> reader = null;
      try {
        reader = serializer.getContentReader();
        is = new FileInputStream(uploadedFile);
        content = reader.createFromContent(is, user, language, uploadedFile.length(), fileName, mimeType);
View Full Code Here

Examples of ch.entwine.weblounge.common.content.ResourceContent

    if (!ResourceUtils.hasChanged(request, resource, language)) {
      return Response.notModified().build();
    }

    // Load the content
    ResourceContent resourceContent = resource.getContent(language);
    if (resourceContent == null) {
      throw new WebApplicationException(Status.NOT_FOUND);
    }

    // If the content is hosted externally, send a redirect and be done with it
    if (resourceContent.getExternalLocation() != null) {
      try {
        return Response.temporaryRedirect(resourceContent.getExternalLocation().toURI()).build();
      } catch (URISyntaxException e) {
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
      }
    }
View Full Code Here

Examples of com.avaje.ebeaninternal.server.lib.resource.ResourceContent

  private boolean readOrmXml(String ormXmlName, ArrayList<Dnode> ormXmlList) {

    try {
      Dnode ormXml = null;
      ResourceContent content = resSource.getContent(ormXmlName);
      if (content != null) {
        // servlet resource or file system...
        ormXml = readOrmXml(content.getInputStream());

      } else {
        // try the classpath...
        ormXml = readOrmXmlFromClasspath(ormXmlName);
      }
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

        File modulesDir = injectedServerEnvironment.getValue().getModulesDir();
        File moduleDir = new File(modulesDir, symbolicName.replace(".", File.separator) + File.separator + version);
        if (moduleDir.exists())
            throw new IllegalStateException("Module dir already exists: " + moduleDir);

        ResourceContent content = resource.adapt(ResourceContent.class);
        IllegalStateAssertion.assertNotNull(content, "Cannot obtain content from: " + resource);

        // copy resource content
        moduleDir.mkdirs();
        File resFile = new File(moduleDir, symbolicName + "-" + version + ".jar");
        IOUtils.copyStream(content.getContent(), new FileOutputStream(resFile));

        ModuleIdentifier modid = ModuleIdentifier.create(symbolicName, version.toString());

        // generate module.xml
        File xmlFile = new File(moduleDir, "module.xml");
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

    private ResourceHandle installBundleResource(Resource resource) throws ProvisionException {

        // Install the Bundle
        ResourceIdentity resid = resource.getIdentity();
        ResourceContent content = getFirstRelevantResourceContent(resource);
        IllegalStateAssertion.assertNotNull(content.getContent(), "Cannot obtain content from: " + resource);

        Bundle bundle;
        try {
            String location = "resource#" + resid;
            bundle = context.installBundle(location, content.getContent());
        } catch (BundleException ex) {
            throw new ProvisionException(ex);
        }

        // Start the bundle. This relies on provision ordering.
View Full Code Here

Examples of org.jboss.gravia.resource.ResourceContent

    private ResourceHandle installBundleResource(Resource resource) throws ProvisionException {

        // Install the Bundle
        ResourceIdentity resid = resource.getIdentity();
        ResourceContent content = getFirstRelevantResourceContent(resource);
        IllegalStateAssertion.assertNotNull(content.getContent(), "Cannot obtain content from: " + resource);

        Bundle bundle;
        try {
            String location = "resource#" + resid;
            bundle = context.installBundle(location, content.getContent());
        } catch (BundleException ex) {
            throw new ProvisionException(ex);
        }

        // Start the bundle. This relies on provision ordering.
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.