# set application instance property on HttpProvider

**URL:** <https://community.wowza.com/t/set-application-instance-property-on-httpprovider/40631>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [November 20, 2013, 12:31pm UTC](https://community.wowza.com/t/set-application-instance-property-on-httpprovider/40631 "2013-11-20T12:31:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yehudi\_cheng](https://avatars.discourse-cdn.com/v4/letter/y/9dc877/32.png) [@yehudi\_cheng](https://community.wowza.com/u/yehudi_cheng)\
**Post date:** [November 20, 2013, 12:31pm UTC](https://community.wowza.com/t/set-application-instance-property-on-httpprovider/40631/1 "2013-11-20T12:31:33Z")

</div>

I tried to receive parameters from HttpProvider and pass to the next incoming stream, so I put the following code on _onHTTPRequest_ method

```auto
IApplicationInstance appInstance = vhost.getApplication("live").getAppInstance("_definst_");
		
WMSProperties props = appInstance.getProperties();
synchronized (props)
{
	Map<String, Map<String, String>> storeInfo = (Map<String, Map<String, String>>) props.getProperty("streamStoreInfo");
	if (storeInfo == null)
		storeInfo = new HashMap<String, Map<String, String>>();
			
	Map<String, String> items = new HashMap<String, String>();
	items.put("path", path);
	storeInfo.put(streamName, items );
			
	props.put("streamStoreInfo", storeInfo);
}

```

The HttpProvider would be called before stream upload to WMS.

And also I created a customer module to get the property on _onAppStart_ method

```auto
WMSProperties props = appInstance.getProperties();
synchronized (props)
{
	Map<String, Map<String, String>> storeInfo = (Map<String, Map<String, String>>) props.getProperty("streamStoreInfo");
	getLogger().info("[onAppStart]: "+storeInfo);
}

```

But the desired property does NOT exist when _onAppStart_ is calling, How should I pass the parameter to application instance or stream that will come later?

Yehudi

---

<div class="post-metadata">

**Author:** ![Roger\_Littin1](https://avatars.discourse-cdn.com/v4/letter/r/c89c15/32.png) [@Roger\_Littin1](https://community.wowza.com/u/Roger_Littin1)\
**Post date:** [November 20, 2013, 4:49pm UTC](https://community.wowza.com/t/set-application-instance-property-on-httpprovider/40631/2 "2013-11-20T16:49:52Z")

</div>

Hi,

When you call IApplicationInstance appInstance = vhost.getApplication(“live”).getAppInstance(“_definst_”); on an appInstance that is not loaded, it will trigger the appInstance to load up so will call onAppStart. When onAppStart is called, your http provider has not created the map or put it into the props so the appInstance cannot see it.

The easiest way around it would be to store the map at the VHost level in vhost properties or a custom class and then when onAppStart is called, get the map from there.

This method would also work across appInstance restarts. When an appInstance stops & starts, it is a new class instance so any settings in the old one are lost.

Roger.

---

<div class="post-metadata">

**Author:** ![yehudi\_cheng](https://avatars.discourse-cdn.com/v4/letter/y/9dc877/32.png) [@yehudi\_cheng](https://community.wowza.com/u/yehudi_cheng)\
**Post date:** [November 20, 2013, 8:04pm UTC](https://community.wowza.com/t/set-application-instance-property-on-httpprovider/40631/3 "2013-11-20T20:04:00Z")

</div>

Thank your useful reply. It lets me know what’s correct timing that onAppStart is called. 🙂

And for my case, I should NOT try to get the appInstance’s property on onAppStart, I should do it on some methods like onStreamCreate, then I can put the parameter as appInstance’s property.

Thanks again.

Yehudi
