Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Optional
    • Resolution: Unresolved
    • Affects Version/s: 3.1.0.Beta3
    • Fix Version/s: 3.1.1.Beta1
    • Component/s: Messages
    • Labels:
      None
    • Affects:
      Documentation (Ref Guide, User Guide, etc.)

      Description

      As a user, the current documentation is sufficient for severity+text messages, however on closer inspection of the Message class, I see that detail and targets properties are available, much like FacesMessage.

      I dug around the seam-international source and experimented with a bean having fields/method like the following:

      @Inject
      private Messages messages;

      @Inject
      private transient TemplateMessage message;

      public void doSometing() {
      messages.add(message.level(Level.WARN).text("Text

      {0}, {1}, {2}").textParams('a', 'b', 'c').detail("Detail {0}

      ,

      {1}

      ,

      {2}

      ").detailParams(1, 2, 3).targets("message").build());

      messages.add(message.level(Level.FATAL).text("Fatality!").targets("message").build());
      }

      This works. A few caveats:

      • TemplateMessage field has to be marked transient, otherwise get WELD error during deployment about Serializable bean having non-Serializable field.
      • Make sure to call add(Message) signature (invoke build()) instead of add(MessageBuilder), otherwise only the most recent message is added.
      • doSomething method is not reentrant/thread-safe because of the builder.

      I'd prefer to use Messages instead of the builders, perhaps have a methods like info(String text, String details, String targets, Object... args), however that gets ugly with the varargs, having to cast Object[], etc. Perhaps I should stick with FacesMessages.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                gturner Gerald Turner
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 3 hours
                  3h
                  Remaining:
                  Remaining Estimate - 3 hours
                  3h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified