IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
  • 1.  How can I access the HttpSession ? ? (For user role control)

    Posted 03/06/02 10:30 AM

    Hi,
    I want to add check which user is working now.
    To do this I am planning to check the users name first and add this name into the HttpSession so that I can access it from anywhere.
    But since pageContext in JspTag is private, I can not access the session.
    Can anybody tell me another way to implement this ?

    Many thanks…

    X-Application Version: 3.1.2
    Tamino Version : 3.1.1
    Platform : Win2k,
    WebContainer : Tomcat 3.3
    JDK Version : 1.3.1


    #Tamino
    #API-Management
    #webMethods


  • 2.  RE: How can I access the HttpSession ? ? (For user role control)

    Posted 03/06/02 11:40 AM

    It depends on where you place your code:

    1)
    if you place it on the Jsp page itself
    (using <% … %> ), you have access to
    Jsp’s pageContext variable and you can
    use pageContext.getSession()

    2)
    if you place it in your own Jsp tag (which
    is not derived from X-Application’s
    JspTag class), you will implement the
    setPageContext method (or derive it from
    SupportBodyTag)

    3)
    if you place it in your own Jsp tag (which
    is derived from X-Application’s JspTag),
    you have to overwrite JspTag.setPageContext()
    in your tag. Basically, your method
    “YourTag.setPageContext()” should store
    the pageContext in a field of your class and
    call the overridden method:
    yourPageContextField = pageContext;
    super.setPageContext(pageContext);
    Now, you can use “yourPagecontextField”
    to access the pageContext.
    IMPORTANT: this solution is kind of a hack!
    JspTag has a private pageContext field on
    purpose:
    we want to run Unit tests on tags derived
    from JspTag - but the pageContext is not
    available in unit tests (since instances of
    PageContext are created by Tomcat)
    By isolating all access to the pageContext
    in the JspTag class, we can fake the
    information taken from pageContext and
    run unit-test our tage without running Tomcat.
    Overwriting setPageContext would violate
    this policy …

    Michael

    Software AG Germany, Darmstadt

    X-Application Version: 3.1.2, 3.1.1
    Tamino Version : 3.1.1
    Platform : NT, Win2k, Solaris, …
    WebContainer : Tomcat 3.3
    JDK Version : 1.3.1
    X-Application Version: 3.1.2, 3.1.1
    Tamino Version : 3.1.1
    Platform : NT, Win2k, Solaris, …
    WebContainer : Tomcat 3.3
    JDK Version : 1.3.1


    #webMethods
    #API-Management
    #Tamino


  • 3.  RE: How can I access the HttpSession ? ? (For user role control)

    Posted 03/08/02 09:26 AM

    Hello,
    I prefer using the 3rd method in which I use a Tag derived from JspTag because I also need to access the Xapplication data.
    But I didn’t understand what you mean by “Unit Tests”.
    Will overriding the setPageContext method cause any problems in my application?
    Is it possible that you might make this method private in further versions? (which will make my Tag useless since I can not access the PageContext)
    Thanks


    #API-Management
    #webMethods
    #Tamino


  • 4.  RE: How can I access the HttpSession ? ? (For user role control)

    Posted 03/08/02 12:46 PM

    Unit testing means “testing in isolation”: we
    want to test our tags without running Tomcat.
    Unit testing is a kind of buzz word and JUnit
    is the most widespread tool for Java:
    http://junit.org/index.htm

    Overriding setPageContext doesn’t break
    anything as long as you don’t want to run Unit
    test for your tag.

    The setPageContext method will never be
    private (since the Tag interface requires a
    public method).


    Michael

    Software AG Germany, Darmstadt


    #API-Management
    #Tamino
    #webMethods


  • 5.  RE: How can I access the HttpSession ? ? (For user role control)

    Posted 08/12/02 04:53 PM

    Hi
    I’m using a session variable created like this:

    <jsp:useBean id=“logon” scope=“session” class=“logonbean.Logon” />

    But after have viewed a page with X-Application’s JspTags it seams my session variables are lost!

    Can anyone tell me why?:confused:

    Regards

    Geiri


    #API-Management
    #webMethods
    #Tamino


  • 6.  RE: How can I access the HttpSession ? ? (For user role control)

    Posted 08/13/02 02:40 PM

    Hello,

    normally X-Application does not modify the standard Session Object provided by Tomcat. X-Application uses this object to add its ServletSessionContext object. But it does not remove other objects stored within this session object.

    To analyze your problem it would be helpful to have the jsp pages where you invoke the Bean and where you use the X-Application tags.

    Please, describe also the order how the pages are invoked.

    Thank you,
    bye Christian.


    #API-Management
    #Tamino
    #webMethods