[JBoss Seam] - Re: Mathematical captcha & Email obfuscator
by Homer J.
Thanks for your review once again Peter but - again - there are some parts I don't understand ;)
So here it goes, you said:
anonymous wrote : JSF components need explicit rather than implicit attributes and to support EL
What do you mean with explicit & implicit attributes? Is it bad that the email tags are derived from the obfuscator tags?
Regarding the EL: if you do something like:
<s:email value="#{user.email}" /> it will work so I'm not sure what you mean.
Regarding nested tag support: while I theoretically agree with you there is not much point in it because now both tags are derived from HtmlOutputText and therefore behave in a similar way. E.g.:
<p>
| <h:outputText styleClass="foo" value="bar" />
| </p>
| <p>
| <h:outputText styleClass="foo">bar</h:outputText>
| </p>
results in
<p>
| <span class="foo">bar</span>
| </p>
| <p>
| bar<span class="foo"></span>
| </p>
So everything in the body is rendered before the tags - which can be done by simply writing it before the tag too.
Last but not least you said that the default behavior of the email tag should be to do no obfuscation. I don't see why because the whole point of this tag is to obfuscate email addresses so this would only result in more writing for the normal user while other people still could manually write unobfuscated addresses down.
Therefore my suggestion would be to add obfuscation="none" so people can use the tag without obfuscation - although I don't see a reason why anyone should do that.
The rest is changed like you suggested!
I'm looking forward to your response.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042253#4042253
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042253
18 years, 11 months
[JBoss Seam] - Re: asynchasynchronous transactions problem
by Stateless Bean
Thanks for reply!
Yes I mean 1.1.6,
I changed Seam to 1.2.1 as you said and here is my news
On my laptop problems gone! Method is invoking well, but when i uploaded my ear to production server problem still exist.
Maybe this is problem with system?
I got Win XP, JBoss 4.0.5 but on serwer is FreeBSD 6.2 with JBoss 4.0.5.
My code is huge and here you got some shortest version.
this is my scheduler class from seampay example
| @Name("engineControler")
| public class EngineControler extends GameSystem {
| public EngineControler() {}
|
| @In(create=true)
| EngineProcessor processor;
|
|
| public String calcMoves() {
| try {
| if (schedulerDates == null)
| schedulerDates = new LinkedList<Date>();
|
| //em.clear();
| long interval = 2 * 1000;
| @SuppressWarnings("unused")
| Timer timer = processor.scheduleMoves(new Date(), interval, null);
|
| }
| catch (RuntimeException e) {
| log.error("Scheduler ->engineControler - calcMoves(): " + e.getMessage());
| }
| return "success";
| }
|
here is my scheduler method with invokes calculateFleetFly();
| @SuppressWarnings("unchecked")
| @Asynchronous
| @Transactional
| public Timer scheduleMoves(@Expiration Date when,
| @IntervalDuration long interval,
| Person p) {
| try {
| long a = System.currentTimeMillis();
| //=================================================
|
| calculateFleetFly();
| //=================================================
| long b = System.currentTimeMillis();
| System.out.println("Scheduler: " + (b - a) + " ms.");
| }
| catch (RuntimeException e) {
| log.error("processor -> scheduleMoves(): " +
| e.getMessage());
| }
| return null;
| }
|
here is my global method that load data from db and invoke another method
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| protected List<Moves> calculateFleetFly() {
| List<Moves> listAllMoves = new LinkedList<Moves>();
| try {
| StringBuffer allMovesBuffer = new StringBuffer("SELECT m.* FROM Moves m " +
| "WHERE m.timecome <= CURRENT_TIMESTAMP " +
| "OR m.timeback <= CURRENT_TIMESTAMP");
| Query allMovesQuery = em.createNativeQuery(allMovesBuffer.toString(), Moves.class);
| listAllMoves = allMovesQuery.getResultList();
|
| for(int i=0; i < listAllMoves.size(); i++) {
| boolean removeFlag = calcFleetColonize(listAllMoves.get(i));
|
| } //for
| em.flush();
| em.clear();
| }
| catch (RuntimeException e) {
| e.printStackTrace();
| }
| return listAllMoves;
| }
|
and here is final method where i get problem,
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| private boolean calcFleetColonize(Moves currentMove) {
| try {
| Long idTarget = currentMove.getIdDefenderPlanet(); //Pobieram ID planety gdzie ma zalozyc kolonie
| Long idPerson = currentMove.getIdAttacker();
| //Wczytuje gracza
| StringBuffer personBuffer = new StringBuffer("SELECT p.* FROM Person p " +
| "WHERE p.id = " + idPerson);
| Query personQuery = em.createNativeQuery(personBuffer.toString(), Person.class);
| List<Person> personList = personQuery.getResultList();
|
| if (personList.size() > 0) {
| //Sprawdzam czy trajektoria jest skolonizowana
| StringBuffer checkBuffer = new StringBuffer("SELECT g.idGalaxy FROM Planet p, Galaxy g " +
| "WHERE p.galaxy_idgalaxy = g.idgalaxy " +
| "AND p.galaxy_idgalaxy = " + idTarget);
| Query checkQuery = em.createNativeQuery(checkBuffer.toString());
| List checkList = checkQuery.getResultList();
|
| //Wyciagam rekord galaktyki
| StringBuffer targetBuffer = new StringBuffer("SELECT g.* FROM Galaxy g WHERE " +
| "g.idgalaxy = " + idTarget);
| Query targetQuery = em.createNativeQuery(targetBuffer.toString(), Galaxy.class);
| List<Galaxy> targetPlanet = targetQuery.getResultList();
|
|
| //Jesli nie ma planety w miejscu lotu to tworze planete
| if(targetPlanet.size() == 1 && checkList.size() == 0) {
|
|
| Planet planet = new Planet("myName",
| 0,
| targetPlanet.get(0).getPlaneta(),
| "",
| 0);
| //Dodaje surowce do planety
| Resources resources = new Resources(0, 0,
| 0, 0, 0);
| planet.setResources(resources);
| //Budynki
| Buildings buildings = new Buildings();
| planet.setBuildings(buildings);
| //Obrone
| Defence defence = new Defence();
| planet.setDefence(defence);
| //Okrety na planecie
| Ships ships = new Ships();
| planet.setShips(ships);
|
| Rockets rockets = new Rockets();
| planet.setRockets(rockets);
| planet.setGalaxy(targetPlanet.get(0));
|
| //Dodaje kolekcje planet
| planet.setPlanetOwner(personList.get(0));
| personList.get(0).getPlanetList().size();
| personList.get(0).getPlanetList().add(planet);
| }
| //HERE I GET NULL
| //
| em.merge(personList.get(0));
| }
| }
| catch(RuntimeException e) {
| e.printStackTrace();
| }
| return false;
| }
|
and I get null on end of the method "em.merge(personList.get(0));"
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042249#4042249
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042249
18 years, 11 months
[JBoss Seam] - Re: Nested conversations and transaction management
by FabBoco
Now I am really confused.
First of all let me update the sample code.
| @Stateful
| @Name("A")
| @Scope(ScopeType.CONVERSATION)
| public class ABean implements Serializable, A
| {
| @In
| private EntityManager em;
|
| @In(create = true)
| @Out(required = false)
| A a; // A entity bean
|
| @End(beforeRedirect=true)
| @Rollback
| public String cancel()
| {
| return "/AList.xhtml";
| }
|
|
| @Begin(nested=true)
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String initCreate()
| {
| ....
|
| a = new A();
|
| return "/A.xhtml";
| }
|
| @End(beforeRedirect=true)
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public String processCreate()
| {
| ....
|
| a = em.merge(a);
|
| return "/ListA.xhtml";
| }
| }
|
I have traced what happens at database level and I discovered that the database transaction is started at the merge statement and committed after that the method is ended. I presumed at the end of the conversation.
SURPRISE - SURPRISE !!!
I removed @End(beforeRedirect=true) from the processCreate() method.
The database transaction is STILL started at the merge statement and STILL committed after that the method is ended.
What is going on ? I thought that using a long-running conversation I was able to manage more http requests before actually write to the database and I thought that the database transaction was committed only at the end of the method annotated with @End.
Probably I am wrong !
Please, can anyone explain to me which is the relationship between conversation and transaction ? Is this stuff documented somewhere ?
Thanks
Regards
Fab.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042245#4042245
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042245
18 years, 11 months