Thursday, August 28, 2014

iOS - short note, how to change view of tabs in UiTabBarController

for (UINavigationController * nav in self.tabBarController.viewControllers) {


        [nav.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:


                                                [UIColor grayColor],


                                                NSForegroundColorAttributeName,


                                                [UIFont systemFontOfSize:12], NSFontAttributeName,


                                                nil]


                                      forState:UIControlStateNormal];


        [nav.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:


                                                [UIColor colorWithRed:0.0 green:122/255.0 blue:1.0 alpha:1], NSForegroundColorAttributeName,


                                                [UIFont systemFontOfSize:14], NSFontAttributeName,


                                                nil]


                                      forState:UIControlStateSelected];



    }

Monday, August 4, 2014

How to force change jboss class loader method 2

In my previous post there is the first method where you can force jboss to isolate class loader of your web app from server class loader. Here what happen is before adding jars in server classpath, jboss will search jars in your web app classpath. If matching jars or duplicating jars found jboss will give priority to the jars found in your web app’s classpath.


So to achieve this the first method is create an entry in jboss-web.xml which is the jboss specific deployment descriptor. The second method is creating a separate xml file “jboss-classloading.xml” in your app’s “WEB-INF” folder and add the class loading instructions in that file. An example is given below.


<classloading xmlns=”urn:jboss:classloading:1.0”
            name=”MyAPP.war”
            domain=”MyAPP_domain”
            parent-domain=”this is optional”
            parent-first=”false”
            export-all=”NON_EMPTY”
            import-all=”true”>
</classloading>


***** parent daomain is optional.

JBOSS EAP 5.1.2 & Sun Metro JAX-WS

Jboss does have their own web service implementation which is JBossWS-CXF, based out of Apache CXF. But if you are into JAX-WS metro stack you can simply use it with jboss.


1. Overide the class loader to load SUN Metro stack instead jboss supplied jax-ws version.


create “jboss-web.xml” file in “WEB-INF” folder with following content.


<?xml version=”1.0” encoding=”UTF-8”?>
<jboss-web>
    <context-root>/MyApp</context-root>
    <class-loading java2ClassLoadingCompliance=”false”>
        <loader-repository>
            org.myapp:loader=MyApp.war
            <loader-repository-config>
                java2ParentDelegation=false
            </loader-repository-config>
        </loader-repository>
    </class-loading>
</jboss-web>



2. Add WSServletContextListener listner to web.xml file


<listener>
       <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
  </listener>



3. Add servlet and servlet mapping for WSServlet


<servlet>
    <servlet-name>WSServlet</servlet-name>
    <servlet-class>
            com.sun.xml.ws.transport.http.servlet.WSServlet
        </servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>WSServlet</servlet-name>
    <url-pattern>/*</url-pattern>
   <!—  <url-pattern>/services/*</url-pattern> —>
  </servlet-mapping>



You may now get your web service not only work but dynamic WSDL creation also working.