new methods for adding custom request headers
---------------------------------------------

                 Key: MUSE-189
                 URL: https://issues.apache.org/jira/browse/MUSE-189
             Project: Muse
          Issue Type: Improvement
          Components: Core Engine - Resource and Capability APIs
    Affects Versions: 2.1.0
            Reporter: Vinh Nguyen
         Assigned To: Dan Jemiolo
            Priority: Minor


In Muse2.1.0, a new AbstractResourceClient.invoke(String,Element,Element[]) 
method was created so that custom properties can be put into the request 
header.  Please add the following methods so that these properties can be 
easily added directly to AbstractResourceClient, so that developers don't have 
to extend the class and add the methods ourselves.

    // Stores the custom request header properties.
    protected HashMap<QName,Object> requestHeaderProperties = new 
HashMap<QName,Object>();

    /**
     * Deletes a previously set request header property.
     * @param qname  The property name.
     * @return  The deleted value.
     */
    public Object deleteRequestHeaderProperty(QName qname)
    {
        return requestHeaderProperties.remove(qname);
    }

    /**
     * Adds a request header property.
     * If one already exists with the given name, it will be replaced with the 
new value.
     * @param qname  The property name.
     * @param value  The property value.
     */
    public void insertRequestHeaderProperty(QName qname, Object value)
    {
        requestHeaderProperties.put(qname, value);
    }

    /** */
    public Element invoke(String action, Element soapBody)
    throws SoapFault
    {
        // Serialize header properties.
        int count = requestHeaderProperties.size();
        Element[] soapHeaders = new Element[count];

        QName qname = null;
        Object entry = null;
        Iterator keys = requestHeaderProperties.keySet().iterator();
        for (int x = 0; x < count; x++)
        {
            qname = (QName)keys.next();
            entry = requestHeaderProperties.get(qname);
            soapHeaders[x] = WsrpUtil.convertToElement(entry, entry.getClass(), 
qname);
        }

        // Call sibling method to invoke operation with new header properties.
        return invoke(action, soapBody, soapHeaders);


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to