Ajax Workshop and Java Server Faces - new levels of Java technology.
Brief report.
A small opus telling about the events of April 24, 2008. After reading the opus, you will learn how Java SE version 6 and web services made friends, read a couple of lines about JSF, a little bit about JAX, and just my thoughts out loud.
On April 24, I was lucky to get to the seminar on JSF in general and JSF + AJAX in particular.
I will say right away: for technical reasons, I was not able to fully listen to the lectures.
PrologueMikhail Vasilyev, one of the oldest teachers of the IT Academy in the literal and figurative sense, spoke at the opening ceremony. Mikhail talked about JavaSE 6, web services and their perspectives in parallel. He started his acquaintance with Java and thanks to Michael a year ago, having attended the course he taught. My lecture notebooks are still kept. In 5 full working days, I learned a lot of new things, I liked it so much that I decided to devote myself to serving the religion of Java.
It makes no sense to blame the audience for bias, but many were pleased to hear that Java is becoming faster, higher and stronger with each release.
')
Action 1For me personally, it was a discovery that the API for creating web services and their clients is included in the standard JDK SE. On the one hand, this is good, on the other - you cannot go far without a server, and at least one poor Apache Tomcat will have to be installed.
Mikhail talked a lot about autogeneration of artifacts for web services (bins, SEI, etc.), I already know that, in general, RAD copes with these tasks, I won’t say that I was interested in this part of the report. According to Michael, JAX-RPC is dead, long live the new king - JAX-WS. In the exam, “CX-310-220 - Developer of Javia Web Services,” ask about JAX-WS.
Talked a lot about SOAP. I immediately recall the words of one programmer, a friend of my friend, who said that in XML there are more tags than information.
If we talk about the generated WSDL'in, then the words of the nameless XML detractor are close to the truth. Now the bike is from me: once I had to sniff a SOAP message sent to a web service (forging a friendly relationship between php and the Javi Web service). I confirm that the proportion of tags was almost equal to the useful transmitted information. These words immediately recall another popular programmer’s thought - “when we obtain universality, we must sacrifice something”. Yes, we sacrifice performance and load on the channel. Michael mentioned the format of the company Alcatel, which experts transmit binary data instead of SOAP messages. On the one hand, the savings are obvious, on the other - the problems that will arise when trying to work with web sevises (or whatever they call them) of the Alcatel are obvious.
The audience had to come to the conclusion that in order to make friends with the irreducible it is best to use web services. Once again I heard the terrible word for myself EJB. I heard, I know, but did not try. Mentioned was the sluggishness, heavy weight, and high complexity of the EJB components, and were happy for the web services, which are deprived of all the listed disadvantages. It is worth noting that web services are also deprived of all the advantages of EJB: transactional, object state monitoring; others I do not remember. If web services could at least have state control, a programmer’s life would once again bloom with bright colors of optimism and faith in a bright future. About the transaction and I do not say. Michael talked about the new JAXB version, which now supports all W3C schemas. Previously, this was not. And if earlier it was possible to get a Java object from XML, now the inverse operation is supported. There was no such raspberry in JAXB 1.0. Marshallization and unmarshalling to the fullest for lovers of XML.
They recalled the technology REST - Representational state transfer, which allows you to transfer xml directly through HTTP without SOAP support.
Annotations for web services in SE 6 surprised me a little: if earlier we wrote something like this:
myService.getServiceLocator (new URL (" lol.ru/MyService ")) ,
now something similar is written in the form of comment annotations in the code above the instance of the service interface received. What is cool here, I did not understand. In my opinion it used to be no less convenient. I completely forgot about base_64 in JAX-RPC. We scolded him a little. Since XML only accepts character data, binary data: images, xxx.exe, myDiplom.rar are transmitted in encoded form using base_64.
In JAX-WS, binary data is transmitted as binary data. Hurray, life has become easier and more fun.
Mikhail spoke about the Metro project, it seemed to me that he himself didn’t really understand what it was and why it was needed. The intermission rose and thoughts were concentrated in bunches and sent to the buffet.
IntermissionDuring the break, a certain man, who, from a distance, looked like an elderly teacher of co-op, attacked Michael with his tricky questions. They discussed the topic “Big-Large Enterprise, and Web Services.” Then the conversation flowed smoothly in the direction of the possibilities of my favorite language Java. None of those present could confidently answer the question: “Is it possible on the fly to add methods and fields to the class?”. Some nodded their heads and said no. I discussed the controversial situation with colleagues in the office, it turned out that it is possible. Then the discussion participants began to sing the praises of Ruby on Rails and I decided to go for a smoke.
Second actAs I mentioned at the very beginning of my report, I was not able to listen to the JSF lecture to the end.
Victor Kudryashkin, an employee of the St. Petersburg branch of Sun talked about JSF.
During the story, I was embarrassed by the following fact: in JSF there are special pieces - validators. They are used to verify data, for example, you need to check the email address entered by the user. To do this, create a
public void method
validateEmail (String userEmail) , which
throws ValidatorException.The bottom line is that if the user made a mistake while typing and the mail is not valid, the method throws an exception with a custom message. The exception is intercepted above and the user is sent the message "bla-bla-bla, enter the correct mail."
The logic, built on exceptions, reminds me of clowning. Putting juggling with wet sausages at the same time: you never know which end to grab, and they slip out of their hands.
I asked a logical question: "Why?".
Victor said that such an approach exists and exists (yes, I don’t argue, some go on winter tires in the summer, but that doesn’t mean that everyone should do that), and is even used (for example, in the Vietnamese forum,
mvnforum he is called). As it turned out later, Victor himself decided not to get involved with exceptions, and asked the
return type for the method.
As far as I know, the popular log4j chips chip worse. In log4j, in the message output format, you can specify the method from which the record is generated. In order to find out from which log4j method he writes a log, he throws an exception, intercepts it and parses the stack path. There is no other way to detect the current method. If I'm wrong, please correct me.All the same, it’s not for nothing that class methods can return a value, it’s not for nothing that people thought out if then else.
And then I apologized, said goodbye and ran to my favorite job.