Package org.mapfish.print.config

Examples of org.mapfish.print.config.Configuration


    @Override
    protected HttpHost determineProxy(final HttpHost target,
                                      final HttpRequest request,
                                      final HttpContext context) throws HttpException {
        Configuration config = MfClientHttpRequestFactoryImpl.getCurrentConfiguration();
        if (config == null) {
            return null;
        }
        final URI uri;
        try {
            uri = new URI(request.getRequestLine().getUri());
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        HttpMethod method = HttpMethod.valueOf(request.getRequestLine().getMethod());

        final List<HttpProxy> proxies = config.getProxies();
        for (HttpProxy proxy : proxies) {
            try {
                if (proxy.matches(MatchInfo.fromUri(uri, method))) {
                    return proxy.getHttpHost();
                }
View Full Code Here


        LayeredConnectionSocketFactory factory = getSSLSocketFactory();
        return factory.connectSocket(connectTimeout, sock, host, remoteAddress, localAddress, context);
    }

    private LayeredConnectionSocketFactory getSSLSocketFactory() {
        final Configuration currentConfiguration = MfClientHttpRequestFactoryImpl.getCurrentConfiguration();
        if (currentConfiguration == null || currentConfiguration.getCertificateStore() == null) {
            return this.defaultFactory;
        }
        SSLContext context = currentConfiguration.getCertificateStore().getSSLContext();
        return new SSLConnectionSocketFactory(context,
                SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
    }
View Full Code Here

        if (fileName != null) {
            return fileName;
        }

        if (mapPrinter != null) {
            final Configuration config = mapPrinter.getConfiguration();
            final String templateName = spec.getString(Constants.JSON_LAYOUT_KEY);

            final Template template = config.getTemplate(templateName);

            if (template.getOutputFilename() != null) {
                return template.getOutputFilename();
            }

            if (config.getOutputFilename() != null) {
                return config.getOutputFilename();
            }
        }
        return "mapfish-print-report";
    }
View Full Code Here

     * Configure the access permissions required to access this print job.
     *
     * @param template the containing print template which should have sufficient information to configure the access.
     */
    public final void configureAccess(final Template template) {
        final Configuration configuration = template.getConfiguration();

        AndAccessAssertion accessAssertion = this.applicationContext.getBean(AndAccessAssertion.class);
        accessAssertion.setPredicates(configuration.getAccessAssertion(), template.getAccessAssertion());
        this.access = accessAssertion;
    }
View Full Code Here

    }

    @Override
    public Credentials getCredentials(final AuthScope authscope) {

        Configuration config = MfClientHttpRequestFactoryImpl.getCurrentConfiguration();
        if (config != null) {
            List<HttpCredential> allCredentials = Lists.newArrayList(config.getCredentials());
            allCredentials.addAll(config.getProxies());

            for (HttpCredential credential : allCredentials) {
                final Credentials credentials = credential.toCredentials(authscope);
                if (credentials != null) {
                    return credentials;
View Full Code Here

                LOGGER.debug("Executing http request: " + this.request.getURI());
                return executeCallbacksAndRequest(this.request);
            }
            if (this.httpMethod == HttpMethod.GET) {
                final String uriString = this.uri.toString();
                final Configuration configuration = ConfigFileResolvingHttpRequestFactory.this.config;
                try {
                    final byte[] bytes = configuration.loadFile(uriString);
                    final ConfigFileResolverHttpResponse response = new ConfigFileResolverHttpResponse(bytes, headers);
                    LOGGER.debug("Resolved request: " + uriString + " using mapfish print config file loaders.");
                    return response;
                } catch (NoSuchElementException e) {
                    // cannot be loaded by configuration so try http
View Full Code Here

                final ForkJoinTask<Values> taskFuture = this.processorGraph.createTask(dataSourceValue).fork();
                futures.add(taskFuture);
            }
            final File reportFile;
            if (this.reportTemplate != null) {
                final Configuration configuration = input.template.getConfiguration();
                final File file = new File(configuration.getDirectory(), this.reportTemplate);
                reportFile = this.jasperReportBuilder.compileJasperReport(configuration, file);
            } else {
                reportFile = null;
            }
            List<Map<String, ?>> rows = new ArrayList<Map<String, ?>>();
View Full Code Here

    }

    @Test
    public void testAttributesFromJson() throws Exception {
        final File configFile = getFile(OverviewMapAttributeTest.class, "overviewmap_attributes/config-json.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(OverviewMapAttributeTest.class, "overviewmap_attributes/requestData-json.json");
       
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory,
                new File("."));
        final MapAttribute.MapAttributeValues mapValue = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);
View Full Code Here

    }

    @Test
    public void testAttributesFromYaml() throws Exception {
        final File configFile = getFile(OverviewMapAttributeTest.class, "overviewmap_attributes/config-yaml.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(OverviewMapAttributeTest.class, "overviewmap_attributes/requestData-yaml.json");
       
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory, new File("."));
        final MapAttribute.MapAttributeValues mapValue = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);
        final OverviewMapAttribute.OverviewMapAttributeValues overviewMapValue =
View Full Code Here

    }

    @Test
    public void testAttributesFromBoth() throws Exception {
        final File configFile = getFile(OverviewMapAttributeTest.class, "overviewmap_attributes/config-yaml.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(OverviewMapAttributeTest.class, "overviewmap_attributes/requestData-json.json");
       
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory, new File("."));
        final MapAttribute.MapAttributeValues mapValue = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);
        final OverviewMapAttribute.OverviewMapAttributeValues overviewMapValue =
View Full Code Here

TOP

Related Classes of org.mapfish.print.config.Configuration

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.