Forum Discussion

Vinay_12452's avatar
Vinay_12452
Icon for Nimbostratus rankNimbostratus
Nov 24, 2011

How to set HTTPProfile for VirtualServer from Java

Hi..I am a beginner.

 

 

I created a VirtualServer using the below code...How can i set the attributes HTTPProfile, FTPProfile, XMLProfile etc to the VirtualServer from java code.

 

 

 

CommonVirtualServerDefinition vsDef = new CommonVirtualServerDefinition(vsName, ipAddress, port, CommonProtocolType.PROTOCOL_TCP);

 

LocalLBVirtualServerVirtualServerResource vsResource = new LocalLBVirtualServerVirtualServerResource(LocalLBVirtualServerType.RESOURCE_TYPE_POOL, poolName);

 

LocalLBVirtualServerVirtualServerProfile vsProfile = new LocalLBVirtualServerVirtualServerProfile(LocalLBProfileContextType.PROFILE_CONTEXT_TYPE_ALL, protocol);

 

virtualServerStub.create({vsdef}, {255.255.255.255}, {vsResource}, {{vsprofile}})

 

 

 

using above code, i could create a VirtualServer. I am getting HTTPProfile, FTPProfile, XMLProfile..etc as 'NONE' in the interface.

 

 

How could i set these attributes from java code.

 

 

Thanks in advance.

 

Vinay.

 

 

 

 

  • Once you create the virtual server, you can add profiles with these methods

     

     

    LocalLB.VirtualServer.add_authentication_profile()

     

    LocalLB.VirtualServer.add_httpclass_profile()

     

    LocalLB.VirtualServer.add_persistence_profile()

     

    LocalLB.VirtualServer.add_profile()

     

     

    You'll need to call the method depending on the type of profile you are assigning. HTTP, FTP, etc will just be with the standard add_profile() method.

     

     

    (There are get and remove versions of these methods as well to query and remove the profiles).

     

     

    The methods are documented here:

     

     

    http://devcentral.f5.com/wiki/iControl.LocalLB__VirtualServer.ashx

     

     

    and I wrote a Tech Tip a while back on the Stream Profile. This article shows how to call the add_profile() method to assign a Stream Profile to a Virtual Server:

     

     

    http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/241/iControl-101--18--Stream-Profile.aspx

     

     

    Hope this helps...

     

     

    -Joe