Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Operation type viewFile, requiresAuthentication and dataURL

$
0
0
1. SmartClient Version: v9.1p_2014-10-15/Pro Deployment (built 2014-10-15)
2. Chrome

Hi,

I have a datasource 'product' that have an imageFile field and requires authentication for everything but fetch

Code:

<DataSource
        ID="product"
        tableName="product"
        serverType="sql"
        xmlns:fmt="WEB-INF/"
    requiresAuthentication="true"
    dataURL="auth/authenticatedOperations"
        >
...
...
...
                <field name="img" type="imageFile" required="false" iconField="true" maxFileSize="51200">
                        <title><fmt:message key="picture"/></title>
        </field>
...
...
...
        <operationBindings>
        <operationBinding
            operationType="fetch"
            requiresAuthentication="false"
            dataURL="auth/nonAuthenticatedOperations"
                />
            <operationBinding operationType="update" requiresRole="admin"/>
            <operationBinding operationType="remove" requiresRole="admin"/>
            <operationBinding operationType="add" requiresRole="admin"/>
        </operationBindings>

The records are shown in a TileGrid. Each record data is shown OK in the Tile but the image, having the special "second call" to the web server in the SRC attribute, like:

Code:

http://127.0.0.1/[module]/images/auth/nonAuthenticatedOperations/babyBottle.png?isc_rpc=1&isc_v=v9.1p_2014-10-15&isc_tnum=3&_tran...........
The servlet 'nonAuthenticatedOperations' is like below, I cannot trap the "viewFile" operation in it but I can identify the fetch operation.

What the response in the servlet must have in order for the tile to show the image?
From where is coming the "images" in the string?,
Where can I modify that?

Code:

    public void doPost(HttpServletRequest request, HttpServletResponse response)
    {
        RPCManager rpc;

        try
        {
            rpc = new RPCManager(request, response);
           
            for (Iterator i = rpc.getRequests().iterator(); i.hasNext();)
            {
                Object req = i.next();
                if (req instanceof RPCRequest)
                {
                    throw new Exception("Only DSRequests expected");
                } else
                {
                    DSRequest dsRequest = (DSRequest) req;

                        DSResponse resp = dsRequest.execute();
                        rpc.send(dsRequest, resp);
                }
            }
        } catch (Exception e)
        {
            LoggerHelper.logError("", "doPost", logger, e.getMessage(),
                    e.getStackTrace());
            return;
        }

    }


The servlet is declared like

Code:


        <servlet>
                <servlet-name>NonAuthenticatedOperations</servlet-name>
                <servlet-class>path.to.server.class.NonAuthenticatedOperations</servlet-class>
        </servlet>
        <servlet-mapping>
                <servlet-name>NonAuthenticatedOperations</servlet-name>
                <url-pattern>/auth/nonAuthenticatedOperations</url-pattern>
        </servlet-mapping>

Thanks in advance,

Viewing all articles
Browse latest Browse all 4756

Trending Articles