struts2 improved validators

Recently I’ve worked on how to improve built-in validators in the Apache Struts 2. The basic idea was to allow specify configuration params of the validators as OGNL expressions. Till now you could only statically define these params which was a bit suboptimal. See the example below:

<validator type="stringlength">
    <param name="fieldName">myPurchaseCode</param>
    <param name="minLength">1</param>
    <param name="maxLength">10</param>
    <message>Your purchase code needs to be between 1 to 10 characters long</message>

As you see you can only define minLength / maxLength as a static value which sometimes isn’t enough. Quite often you would like depend on a user input or assigned privileges to the user and so on. Having option to dynamically adjust the minLength and maxLength is a nice future, though 🙂

Someone else noticed the same and registered an issue WW-2923, I’ve extended it a bit and added all the sub-tasks to handle each available validator step-by-step. I had to change not only the code, but also documentation. Maybe it’s obvious but very frequently we (developers) forget about that – and then myth like JavaDocs are useless come to light 😉

Anyway, my first thought was to implement the enhancement based on the current param names and just add logic to parse param’s value as an OGNL expression, see below:

<validator type="stringlength">
    <param name="fieldName">myPurchaseCode</param>
    <param name="minLength">${minLenghtValue}</param>
    <param name="maxLength">${maxLengthValue}</param>
    <message>Your purchase code needs to be between ${minLength} to ${maxLength} characters long</message>

The problem with this approach is that it breaks backward compatibility, also if you want to use just static values as above, there is an additional overhead – OGNL parser will try to evaluate the expression and fallback to the original value – which is costly.

Then I simple added another set of params to allow specify only these params as an OGNL expression, so you can decide when to use the static values or when to use expressions or when to mix all of them. Thus also simplify migration of existing applications as a developer can migrate each validation when he needs that.

<field-validator type="stringlength">
    <param name="minLengthExpression">${minLengthValue}</param>
    <param name="maxLengthExpression">${maxLengthValue}</param>
    <param name="trimExpression">${trimValue}</param>
    <message>Your purchase code needs to be between ${minLength} to ${maxLength} characters long</message>

If you want to know more please read the docs. You can try to play with the latest build if you want to use this future. I’m going to work on another improvement in Apache Struts 2 🙂

copy pattern

Recently I’ve joined a new ongoing project. In theory it should have been easily jump into it, but as usual each project is specific. The team developed a custom framework to generate JSF view base on an entity class. The framework after first look is quite simple, but as always the devils is in the details 😉 So, I’ve spent a bit of time to catch up what is real going on. The next thing I had to implement was an option to export entire view to PDF – there was already an example how to do it and I followed it. Just copied the source and started adjusting it to my needs.

That’s the Copy Pattern. It’s used very often when you join a new project, when you learn a new language, when you do something first time. You need a pattern to base on, to follow.

So, it isn’t a bad idea to use the copy pattern, but you cannot stop on that. After first step, after you grasped the problem you must apply another patterns – real software development patterns. Leaving the code as is after using the copy pattern is bad – we’ve seen it a lot in many places. The copy pattern is just a beginning, is the easiest way to get into the project.

And the beauty of this is that you can change the name of the class, extract methods, extract new classes – just before messing with a code repository, before posting too match changes,that no one will know what is really happening;-)

Don’t be afraid to use the copy pattern, but also don’t stop on it!

And as usual at the end a talk from TED, this time about a car for blind people. And about new control interfaces we can face soon 😉 Enjoy!

Watch Full Movie Online And Download The Boss Baby(2017)

Watch Full Movie The Boss Baby(2017), Free Download Full Movie The Boss Baby (2017) Online , The Boss Baby(2017) English Subtitles , Free Streaming Movie The Boss Baby (2017).

Watch movie online The Boss Baby(2017) Free Online Streaming and Download HD Quality

Quality: HD
Title : The Boss Baby
Release : 2017-03-23.
Language : English.
Runtime : 97 min.
Genre : Animation, Comedy, Family.
Stars : Alec Baldwin, Miles Christopher Bakshi, Steve Buscemi, Jimmy Kimmel, Lisa Kudrow, Tobey Maguire.

A story about how a new baby’s arrival impacts a family, told from the point of view of a delightfully unreliable narrator, a wildly imaginative 7 year old named Tim.

Incoming search term :

The Boss Baby
The Boss Baby English Subtitles
Watch The Boss Baby
Watch The Boss Baby English Subtitles
Watch Movie The Boss Baby
Watch Movie The Boss Baby English Subtitles
Watch Movie Online The Boss Baby
Watch Movie Online The Boss Baby English Subtitles
Watch Full Movie The Boss Baby
Watch Full Movie The Boss Baby English Subtitles
Watch Full Movie Online The Boss Baby
Watch Full Movie Online The Boss Baby English Subtitles
Streaming The Boss Baby
Streaming The Boss Baby English Subtitles
Streaming Movie The Boss Baby
Streaming Movie The Boss Baby English Subtitles
Streaming Online The Boss Baby
Streaming Online The Boss Baby English Subtitles
Streaming Full Movie The Boss Baby
Streaming Full Movie The Boss Baby English Subtitles
Streaming Full Movie Online The Boss Baby
Streaming Full Movie Online The Boss Baby English Subtitles
Download The Boss Baby
Download The Boss Baby English Subtitles
Download Movie The Boss Baby
Download Movie The Boss Baby English Subtitles
Download Movie Online The Boss Baby
Download Movie Online The Boss Baby English Subtitles
Download Full Movie The Boss Baby
Download Full Movie The Boss Baby English Subtitles
Download Full Movie Online The Boss Baby
Download Full Movie Online The Boss Baby English Subtitles

camels and rollbacks

I had been preparing a new Struts 2 release for last few weeks. It contains only a tiny change regarding security and I had been counting that it shouldn’t take more than a week to release it. How wrong I was 😉

Everything had started smoothly, I’ve created a new Subversion branch, to not interfere with current on-going development of the new Struts 2.2.2. The branch was made from Subversion tag (yeah, branches, tags and trunks are all the same, just copies 😉 ). Next, I’ve applied a patch to solve the security hole and I was truly sure that’s it –  I can start the release process. So I’ve gone ahead, mvn release:prepare command went smoothly, so the next step was mvn release:perform. And after almost waiting 1h I’ve got a strange looking massage: not all licenses were approved !?!

The first thought, I’m using the latest Maven 3.0.1 and that’s the problem, but it wasn’t. I started looking into RAT plugin source code to check what could be wrong. I’ve just discovered that the plugin is checking wrong Apache License header but also looking for the License’s URL so it should be ok. The origin of the problem was quite simple. The Maven Release plugin allows to make release only from a SNAPSHOT version, so I’ve changed the version only in the parent pom of the project. The rest was unmodified. After changing all the version signatures in all the poms the problem was gone 😉

To launch another release process I’ve had to rollback all the changes made during previous launching release command. mvn release:rollback did the job but I’ve had to manually remove the tag from Subversion repository. And of course I’ve removed the wrong one 🙁

Thanks to Wes for a tip how to rollback such a huge mistake, the command looks like this:

TAG_1 is the removed tag, number 10 is the revision -1 when the tag was The Bye Bye Man streaming

So I’ve started again, to make a release and again something went wrong. I noticed the release plugin is making a tag base on wrong path – it was using the original path of the tag from which the branch was made of instead the branch path. And again I’ve had to rollback all changes and remove the tag – this time the correct one 😉

Resolution was easy – change scm tag in all the poms to point to the branch 😛

And again, I’ve started the release process and this time everything went more than smoothly, all the artifacts were uploaded to Apache Nexus, so the last think before calling a vote was to close a staging repository. And again I was wrong, during that, Nexus reported that two jar files don’t have corresponding files with signature. I’ve checked locally and everything was ok. After short conversation with guys from support, I’ve got the solution – upgrade to latest Apache Parent 🙂

Yep, easy, but to do that I’ve had to once again rollback everything, prepare a new Struts Parent that will inherit from the latest Apache Parent, release it and call for a vote 😀

Finally, after almost 2 months I was able to release Struts – the vote is under way, so if you are Struts PMC, please test the release and vote!

Just to relax a bit, take a time and watch that very inspiring talk about camels:

migration and bosses

The whole last week I was migrating my current project from the JBoss AS 6 M2 to the JBoss AS 6 CR1. First of all I had been thinking it should be easy, just switch few things, use other Java packages and so on. Niether I had been expecting some problems nor it will take a week. So I’ve just started my migration “project” – yep, you should always treat it that way, it isn’t just renaming packages or tweaking some configuration files. It’s a huge project that either can take a hour or a week. So be prepared!

To move to the JBoss CR1 I had to also switch to latest versions of our internal libraries, commonly called SML Commons. The main problem was with the CDI Extension package, which base on WELD. During switching the version I discovered some problems during an application deployment. First of all Bean Manager was missing in JNDI context. Googling and looking through existing solution didn’t help. I had to prepare a demo application and try to register an issue with JBoss’ JIRA. The problem was, that my demo application was working just fine with the JBoss CR1. Just Adam was able to break it – the trick was to include in EAR package another module as a Java JAR archive with CDI enabled beans. Then the application blown up!Sandy Wexler film trailer

After few hours we got answer to the problem –  add additional beans.xml file to WAR archive!

So I thought the rest should be easy, but wasn’t 😛

The next problem was with the application’s tests. All the tests that were base on Arquillian started yielding – wrong dependency in Maven pom, I had to remove few of them, cut out some unused profile and everything went smoothly.

So, the next problem was with Selenium and it looked strange as the whole JVM blown up with irritating “red zone” message. And till now I don’t know what it was, maybe just wrong configuration or missing dependency. And during solving that problem I discovered a really interesting CDI behaviour. When you defining a bean with @Produces annotation you have access to the InjectionPoint object. It provides many different information about where your bean will be injected.

But there is a slight diference how InjectionPoint.getBean() is working. If your @Produces annotated bean will be used / injected in already CDI managed bean, getBean() will return that bean. But in other way it will return null 😛

Finally, I gave up 🙁 After passing all that problems, another one hit me directly in the face and I haven’t had enough energy to solved it. I shelved all my changes with IntelliJ IDEA and returned to normal coding work, ufff…. 🙂

And just to change my attitude, today’s morning I got monthly newsletter from TED and I want to share with you that brilliant talk about why bosses and meetings are boilerplate at work, enjoy!

making a cloud

Recently I’ve been changing a cluster configuration. Maybe it isn’t a real cluster, it looks more like a cloud or load balancer. The ingredients are as follow:berryjam.ru

The problem I had was that I just want to enable clustering for given VirtualHost section and not for the whole Web server. Current configuration was quite simple, as you can find out on mod_cluster’s web page. On the JBoss AS side you must uncomment one line or so and provide list with mod_cluster enabled web servers.. But as I said, such configuration enable clustering for the entire web server. I didn’t want that, as I want to create another Virtual Host to serve static content.

So, the first step was to read the documentation, but it didn’t answer my questions. I was trying many different configurations and what I achieved was a separation of Virtual Hosts – I could define the different clusters for different Virtual Hosts, but still wasn’t able to serve static content 😛

The answer was simple, just disable creation of balancer for all Virtual hosts with this directive:

The second thing was to enable use of aliases (and disabling advertising as it isn’t supported by Amazon EC2)

Also on JBoss AS I had to define the Alias:

The rest was easy, just I have had to enable use of Virtual Hosts on given IP address, specify the web server name and define the Virtual Hosts. After restart everything seemed to work perfectly. I had static pages under one domain name and an application under second. The only problem was that I wasn’t able to login to the application. Why? Simply, my session wasn’t a Sticky Session. And not because JBoss server didn’t support it. Much simpler. My session ID wasn’t passed to the JBoss server and back to the Apache HTTPD 😀

To solve that I just had to add ProxyPass and ProxyPassReverse directive:

And that was the end, everything was working smoothly. But the customer decide not to use the same server for load balancing and serving static pages. So all my work was useless, except experience I’ve got 😉

Anyway it’s a very elastic configuration, as you can add another JBoss servers and attach them to the cloud in a minute.

The whole configuration just for future reference:

Watch Full Movie Get Out (2017) Free Download Online Streaming

Watch Full Movie Get Out (2017) English Subtitles, Free Download Full Movie Get Out (2017) HD Quality, Free Online Streaming Full Movie Get Out (2017)).

Poster Movie Get Out 2017
Get Out (2017) HD
Director : Jordan Peele.
Writer : Jordan Peele.
Producer : Edward H. Hamm Jr. , Sean McKittrick, Jordan Peele, Jason Blum.
Release : February 24, 2017
Country : United States of America.
Production Company : Blumhouse Productions, QC Entertainment, Monkeypaw Productions.
Language : English.
Runtime : 103 min.
Genre : Thriller.
Watch Full Movie Get Out (2017) Free Download Online Streaming

‘Get Out’ is a movie genre Thriller, was released in February 24, 2017. Jordan Peele was directed this movie and starring by Daniel Kaluuya. This movie tell story about A young black man visits his white girlfriend’s cursed family estate. He finds out that many of its residents, who are black, have gone missing in the past.

Do not miss to Watch movie Get Out (2017) Online for free with your family. only 2 step you can Watch or download this movie with high quality video. Come and join us! because very much movie can you watch free streaming.

Incoming search term :

download film Get Out
watch Get Out 2017 movie now
Get Out 2017 For Free Online
watch Get Out 2017 film now
movie Get Out
watch full Get Out 2017 movie
Watch Get Out 2017 Online Viooz
Watch Get Out 2017 Online Free putlocker
watch full movie Get Out 2017 online
Get Out 2017 HD English Full Episodes Download
watch full Get Out film
Watch Get Out 2017 Online Putlocker
Get Out 2017 HD Full Episodes Online
Get Out 2017 Full Episodes Watch Online
Get Out 2017 English Full Episodes Free Download
download Get Out 2017 movie
streaming Get Out 2017 film
movie Get Out download
watch Get Out movie online now
Get Out 2017 English Full Episodes Download
Get Out 2017 English Episodes Free Watch Online
Get Out 2017 Online Free Megashare
Watch Get Out 2017 Online Free
film Get Out online
streaming Get Out movie
watch movie Get Out 2017 now
Get Out 2017 English Episodes
live streaming film Get Out 2017 online
film Get Out 2017 download
Get Out 2017 Full Episodes Online
Watch Get Out 2017 Online Megashare
streaming Get Out
Watch Get Out 2017 Online Free Putlocker
Watch Get Out 2017 Online Free Viooz
Get Out 2017 Watch Online
Get Out 2017 Episodes Online
Get Out 2017 Full Episode
Get Out 2017 For Free online
Watch Get Out 2017 Online Free megashare
Get Out 2017 English Episode
Get Out 2017 Episodes Watch Online
Get Out 2017 English Full Episodes Watch Online
Get Out 2017 English Full Episodes Online Free Download

avoid reflection

The Java Reflection API is a very nice future of the Java language. With the API you can do the Magic with Java classes, create an object or call a method on fly base just only on a name. The real Magic!Установка откосов – монтаж пластиковых откосов

So then, we all should use it all the time, to write a better code, yes? NO!

Avoid using it, try to write a code without the Reflection. The worst you can do is if you introduce some generic mechanism with it – a custom validation framework or a flow engine where class and method names are stored as a String (in a text file or a XML file).

You can ask: why?

The answer is simple: your IDE doesn’t support it! When you refactor your class or method, eg. just rename it, IDE will find all the references and change them appropriately for you. But IDE won’t know about your custom solution, is just a text, nothing more!

When you are using the Reflection, your IDE is blind!

Right now I’m working on our custom validation framework, to move definitions of validation from a XML file directly to a Java code. The case is, to not to change the validators, just used them as is. And not to use the Reflection as well 😉

I’ve done some draft implementation base on anonymous classes and the word “final” (thanks Rafal for the tip!). And introduce the ValidationAware interface to be able at the same time use the old way and my new solution! Next week on Monday I will ask other team mates for opinion!

are you affraid

The last two weeks I’ve been simplifying an application flow engine base on Apache Struts 1 – I know it’s a bit old technology but I don’t care, I have a job to do 😉

Anyway I discovered lot of strange use cases where some custom mechanism was build instead to use what was already provided with the framework. It was like inventing a wheel once again! Frankly, I was truly surprised how someone could do this that way. And I start thinking what was the reason to do that…

The only thought came to the mind that someone was afraid to use what was already provided to him with Apache Struts 1 – he didn’t know the framework well, he was too lazy to check sources, and so on. I was real devastated! If someone doing application in such way, no framework will help him or do the job for him!

Recently I’ve been solving issues in Apache Struts 2 and one of them was to add wildcard support to a file upload mechanism. Provided patch had solved that problem with some home made RegExp engine. I just added a test case to proof it was working properly and committed all the changes to a source code repository. After that a more experienced Committer pointed me out that I should use existing PatterMatcher class instead, what I did and the code looks much better right now. You can see an example here Apache Struts 2 useful beans.

storm is comming

Yap, it’s true!Балки

It will demolish all available PHP development environments! You are probably thinking –  “what’s he talking about?! PHP for Java developer??”. Yeah…. I wasn’t Java developer from beginning, I started my professional career as a PHP developer – the first earned money I got was for a web application I wrote in PHP! That was an amazing time, no unit tests, no bullshit about craft and so on. What was the most important – customer satisfaction!

Never mind, after 7 years I had to go back to PHP. It’s impressive, yeah? 7 years without problems and any issue. Marvelous!

Previously I used ordinary text editor to write the application, but nowadays I thought there should be something better – we have the craft, so with the craft you must have THE tools.

The first place I checked was The JetBrains side and they didn’t disappointed me – what I found was The JetBrains PHP Storm! Still in Beta but who cares 😉

The first thing I noticed after installation was that I was able to open the application without any “Import”, “Converting” and so on. Just open it and develop (with pleasure)! What can I say, just astonishing!

Today I discovered another brilliant feature “Compare with deployed version”! What’s that? Is the same functionality when you are comparing your local changes with version in source code repository.

And the result is:

And the most important feature it has is that I can use exactly the same keyboard shortcuts I’ve been using for InetlliJ IDEA! With pleasure 😀

Go to Top