org.apache.cxf.endpoint.Client client = ClientProxy.getClient(service);
Map inProps = new HashMap();
inProps.put(WSHandlerConstants.ACTION, "UsernameToken Timestamp");
inProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
inProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
"com.roche.xp2.content.lowlevel.alfresco.util.AlfrescoRepositoryProviderCallback");
inProps.put(WSHandlerConstants.USER, "ticket");
WSS4JOutInterceptor wssIn = new WSS4JOutInterceptor(inProps);
client.getEndpoint().getOutInterceptors().add(
new org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor());
client.getEndpoint().getOutInterceptors().add(wssIn);
Thursday, 22 December 2011
Apache CXF connector to Alfresco
After generating Apache CXF connector to Alfresco using WSDL document, we also have to add security interceptors. Here is a code fragment I have used:
Thursday, 15 December 2011
Spring 3.1 Released
This release provides a significant upgrade to the Spring framework with environment profiles, caching abstraction, JDBC 4.1 and Java 7 fork/join and Hibernate 4.0 support.
More info about changes: http://static.springsource.org/spring/docs/3.1.0.RELEASE/changelog.txt
Download available here: http://www.springsource.com/download/community?project=Spring%20Framework&version=3.1.0.RELEASE
Download available here: http://www.springsource.com/download/community?project=Spring%20Framework&version=3.1.0.RELEASE
Sunday, 4 December 2011
How to log Garbage collection in java?
You have to add the following parameters when running a java program
- -XX:+PringGC - switching on summary of every run of Garbage collection
- -XX:+PringGCDetails - switching on detail summary of every run of Garbage collection
- -Xloggc:filename - filename to which logs will be put
Logging application behavior, whose are deployed on tomcat
You can log many events of application without changing its code. You can switch on Valves in tomcat configuration. Valve (org.apache.catalina.valves.Valve) is acting like filter on HttpRequest. It is executed just before application gets the request. There are some predefined Valves you can use by just uncommenting them in server.xml configuration in tomcat. You can also develop your own Valve and use them after adding in configuration and in shared libs in tomcat.
More information can be read in the article: http://www.tomcatexpert.com/blog/2011/11/11/finer-point-apache-tomcat-valves
More information can be read in the article: http://www.tomcatexpert.com/blog/2011/11/11/finer-point-apache-tomcat-valves
ListPreference with values number type
In my Android application I tried to define preferences list with values of number type.
<ListPreference android:key="poll_list" android:title="@string/preference_poll_list" android:summary="@string/preference_poll_list_summary" android:entries="@array/poll_option" android:entryValues="@array/poll_option_values" android:dialogTitle="@string/preference_poll_list" />I had to define lists in arrays.xml. But I had to define list poll_option_values as a string-array, like here:
<resources> <array name="poll_option"> <item>1 Minute</item> <item>2 Minutes</item> <item>5 Minutes</item> <item>10 Minutes</item> <item>20 Minutes</item> </array> <string-array name="poll_option_values"> <item>60</item> <item>120</item> <item>300</item> <item>600</item> <item>1200</item> </string-array> </resources>I couldn't use array type. Just another Android feature ;)
Saturday, 3 December 2011
Testing asynchronous actions using WebDriver (f.e. AJAX)
Here is a code snippet showing how to test ajax actions using WebDriver.
You can use WebDriverWait.until method defining condition that checks if web page's structure has changed.
In the WebDriverWait constructor you have to define timeout in seconds. If this time passes then method ends with an exception.
WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(new ExpectedCondition() { public Object apply(Object input) { try { WebElement elem = driver.findElement(By.id(changedElem)); boolean condition = Here you can state condition return condition; } catch (StaleElementReferenceException e) { return false; } } });
Subscribe to:
Posts (Atom)