setting Access-Control-Allow-Origin using Rackspace Cloud Java API -


i using java api uploading files rackspace cloud. trying figure out how set header "access-control-allow-origin" on files uploading. found link talks setting header using python binding here:

setting access-control-allow-origin (cors) in rackspace cloud files python api

is there similar api java binding well? can't seem find it.

thanks!

i'm not of java guy, per this looks metadata needs set on containers, key of x-container-meta-access-control-allow-origin, , value of space separated list of allowed origins.

thus need use whatever function used set container metadata jclouds api.

it appears done on creation (based on adaptation of this code):

createcontaineroptions options = createcontaineroptions.builder             .withmetadata(immutablemap.of("access-control-allow-origin", "*"));  swift.getapi().createcontainer(constants.container, options); 

looking through docs, found following function in org.jclouds.openstack.swift.commonswiftclient:

boolean setcontainermetadata(string container, map<string,string> containermetadata)

it therefore looks should able you're looking following:

swift.getapi().setcontainermetadata(container, immutablemap.of("access-control-allow-origin", "*")); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -