IBM Support

JR56882: HttpServletRequest is not available to REST framework for custom command implementations

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When a Struts action is mapped to a controller command, the WC
    store runtime will make the HttpServletRequest available through
     the command context and its HttpControllerRequestObject. This
    allows custom command implementations and data beans to access
    the HTTP headers and cookies of the request.
    
    The same function however, is not available in the WC REST
    framework when a REST resource method is mapped directly to a
    command or data bean, or when a REST resource method is mapped
    to an BOD service which is in turn mapped to a command.
    

Local fix

  • Use a servlet filter or request handler to intercept the
    HttpServletRequest and store it in a ThreadLocal for later
    access in the custom command implementation or data bean.
    

Problem summary

  • USERS AFFECTED:
    Developers customizing WebSphere Commerce Version Version 7 Fix
    Pack 9 or Feature Pack 8.
    
    PROBLEM ABSTRACT:
    HttpServletRequest is not available to REST framework for custom
     command implementations
    
    BUSINESS IMPACT:
    Custom command implementations and data beans cannot access the
    HttpServletRequest easily.
    
    RECOMMENDATION:
    

Problem conclusion

  • Provided the following configurable options in the
    WCDE_installdir\workspace\WC\xml\config\com.ibm.commerce.foundat
    ion\wc-component.xml file.
    (Options are set to false by default):
    
    <_config:configgrouping name="REST">
        <_config:property name="UseHttpControllerRequestObject"
            value="true"/>
        <_config:property name="PropagateHttpServletRequest"
            value="true"/>
    
    1. Setting 'UseHttpControllerRequestObject' option to true
    causes the WC REST framework to construct a view command context
     with reference to an HttpControllerRequestObject when mapping a
     REST resource method to a command or data bean, similar to the
    WC store runtime. But even if this flag is not set, with this
    fix, REST command mapping will now construct a command context
    where its GET Request/Response methods will return the
    HttpServletRequest/Response. Therefore, this flag is mainly for
    customers with existing custom command implementations and data
    beans that were already written to use
    HttpControllerRequestObject.
    
    2. Setting 'PropagateHttpServletRequest' option to true causes
    the WC REST framework to capture the HttpServletRequest/Response
     and propagate it to the WC SOI framework using the transaction
    cache so that the WC SOI framework can also construct command
    context with either direct references to the
    HttpServletRequest/Response or through
    HttpControllerRequestObject. This flag should be enabled for
    custom command implementations that are mapped to a REST
    resource method through REST BOD mapping.
    
    For more information about how to enable the fix, see
    https://ibm.biz/BdZYWK
    

Temporary fix

Comments

APAR Information

  • APAR number

    JR56882

  • Reported component name

    WC BUS EDITION

  • Reported component ID

    5724I3800

  • Reported release

    700

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2016-10-25

  • Closed date

    2016-12-15

  • Last modified date

    2018-03-06

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WC BUS EDITION

  • Fixed component ID

    5724I3800

Applicable component levels

  • R700 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSYSYL","label":"WebSphere Commerce Enterprise"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.0","Line of Business":{"code":"LOB31","label":"WCE Watson Marketing and Commerce"}}]

Document Information

Modified date:
12 December 2021