/** * Sets the Cross-Origin Resource Sharing (CORS) properties. * * @param cors * A {@link CorsProperties} object which represents the CORS properties. */ public void setCors(CorsProperties cors) { this.serviceProperties.setCors(cors); }
/** * Sets the Cross-Origin Resource Sharing (CORS) properties. * * @param cors * A {@link CorsProperties} object which represents the CORS properties. */ public void setCors(CorsProperties cors) { this.serviceProperties.setCors(cors); }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.elementStack.push(localName); if (Constants.AnalyticsConstants.CORS_RULE_ELEMENT.equals(localName)) { this.rule = new CorsRule(); } else if (Constants.AnalyticsConstants.LOGGING_ELEMENT.equals(localName)) { this.props.setLogging(new LoggingProperties()); } else if (Constants.AnalyticsConstants.HOUR_METRICS_ELEMENT.equals(localName)) { this.props.setHourMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.MINUTE_METRICS_ELEMENT.equals(localName)) { this.props.setMinuteMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.CORS_ELEMENT.equals(localName)) { this.props.setCors(new CorsProperties()); } }
corsRule.setMaxAgeInSeconds(maxAgeInSeconds); cors.getCorsRules().add(corsRule); blobServiceProperties.setCors(cors);
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.elementStack.push(localName); if (Constants.AnalyticsConstants.CORS_RULE_ELEMENT.equals(localName)) { this.rule = new CorsRule(); } else if (Constants.AnalyticsConstants.LOGGING_ELEMENT.equals(localName)) { this.props.setLogging(new LoggingProperties()); } else if (Constants.AnalyticsConstants.HOUR_METRICS_ELEMENT.equals(localName)) { this.props.setHourMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.MINUTE_METRICS_ELEMENT.equals(localName)) { this.props.setMinuteMetrics(new MetricsProperties()); } else if (Constants.AnalyticsConstants.CORS_ELEMENT.equals(localName)) { this.props.setCors(new CorsProperties()); } else if (Constants.AnalyticsConstants.DELETE_RETENTION_POLICY_ELEMENT.equals(localName)) { this.props.setDeleteRetentionPolicy(new DeleteRetentionPolicy()); } else if (Constants.AnalyticsConstants.STATIC_WEBSITE_ELEMENT.equals(localName)) { this.props.setStaticWebsiteProperties(new StaticWebsiteProperties()); } }
/** * Parses the {@link ServiceProperties} from the given XML stream. * * @param stream * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public static ServiceProperties readServicePropertiesFromStream(final InputStream stream) throws SAXException, IOException, ParserConfigurationException { SAXParser saxParser = Utility.getSAXParser(); ServicePropertiesHandler handler = new ServicePropertiesHandler(); handler.props.setLogging(null); handler.props.setHourMetrics(null); handler.props.setMinuteMetrics(null); handler.props.setCors(null); saxParser.parse(stream, handler); return handler.props; }
/** * Initializes a new instances of the ServiceProperties class. */ public ServiceProperties() { this.setLogging(new LoggingProperties()); this.setHourMetrics(new MetricsProperties()); this.setMinuteMetrics(new MetricsProperties()); this.setCors(new CorsProperties()); }
/** * Parses the {@link ServiceProperties} from the given XML stream. * * @param stream * @throws IOException * @throws SAXException * @throws ParserConfigurationException */ public static ServiceProperties readServicePropertiesFromStream(final InputStream stream) throws SAXException, IOException, ParserConfigurationException { SAXParser saxParser = Utility.getSAXParser(); ServicePropertiesHandler handler = new ServicePropertiesHandler(); handler.props.setLogging(null); handler.props.setHourMetrics(null); handler.props.setMinuteMetrics(null); handler.props.setCors(null); handler.props.setDeleteRetentionPolicy(null); handler.props.setStaticWebsiteProperties(null); saxParser.parse(stream, handler); return handler.props; }
/** * Initializes a new instances of the ServiceProperties class. */ public ServiceProperties() { this.setLogging(new LoggingProperties()); this.setHourMetrics(new MetricsProperties()); this.setMinuteMetrics(new MetricsProperties()); this.setCors(new CorsProperties()); // DeleteRetentionPolicy and StaticWebsiteProperties are not included by default because they are not accepted by services other than blob. }