Package org.apache.tika.config

Examples of org.apache.tika.config.TikaConfig


        }
    }
   
    private String getExtension(TikaInputStream is, Metadata metadata) {
        String cType = metadata.get(Metadata.CONTENT_TYPE);
        TikaConfig config = getConfig();
        if (cType == null) {
            Detector detector = config.getDetector();
            try {
                MediaType mediaType = detector.detect(is, metadata);
                MimeTypes types = config.getMimeRepository();
                MimeType mime = types.forName(mediaType.toString());
                metadata.set(Metadata.CONTENT_TYPE, mediaType.getSubtype());
                return mime.getExtension();
            } catch (IOException e) {
                //swallow
View Full Code Here


        }
        return ".bin";
    }
   
    private TikaConfig getConfig() {
        TikaConfig config = context.get(TikaConfig.class);
        if (config == null) {
            config = TikaConfig.getDefaultConfig();
        }
        return config;
    }
View Full Code Here

    private static final File f = new File("/a/b/c/x.pdf");

    @Before
    public void setUp() throws Exception{
        TikaConfig config = TikaConfig.getDefaultConfig();
        repo = config.getMimeRepository();
        tika = new Tika(config);
        u = new URL("http://mydomain.com/x.pdf?x=y");
    }
View Full Code Here

        } else {
          logger.info("Unsupported request URI log level: " + logLevel);
        }
      }
      // The Tika Configuration to use throughout
      TikaConfig tika = TikaConfig.getDefaultConfig();

      JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();

      List<ResourceProvider> rCoreProviders = new ArrayList<ResourceProvider>();
      rCoreProviders.add(new SingletonResourceProvider(new MetadataResource(tika)));
View Full Code Here

    if (customConfFile != null) {
      try {
        // see if a Tika config file can be found in the job file
        URL customTikaConfig = conf.getResource(customConfFile);
        if (customTikaConfig != null)
          tikaConfig = new TikaConfig(customTikaConfig);
      } catch (Exception e1) {
        String message = "Problem loading custom Tika configuration from "
            + customConfFile;
        LOG.error(message, e1);
      }
    } else {
      try {
        tikaConfig = new TikaConfig(this.getClass().getClassLoader());
      } catch (Exception e2) {
        String message = "Problem loading default Tika configuration";
        LOG.error(message, e2);
      }
    }
View Full Code Here

         final InputStream is = configManager.getInputStream(params.getValueParam(TIKA_CONFIG_PATH).getValue());
         conf = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<TikaConfig>()
         {
            public TikaConfig run() throws Exception
            {
               return new TikaConfig(is);
            }
         });
      }
      else
      {
View Full Code Here

TOP

Related Classes of org.apache.tika.config.TikaConfig

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.