Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • omar.villasmil
    replied
    ...

    Adding this lines to the DataSource generates the same SRC for the image in the tile:
    Code:
            <operationBinding 
                operationType="viewFile"
                requiresAuthentication="false"
                dataURL="auth/nonAuthenticatedOperations"
    		/>
    And the tile show
    Code:
    <img src="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...........">
    No image is shown and I cannot identify the viewFile request in the servlet.

    Any other suggestion?

    Thanks

    Leave a comment:


  • Isomorphic
    replied
    Just add an additional <operationBinding> with operationType="viewFile" and requiresAuthentication="false"

    Leave a comment:


  • Operation type viewFile, requiresAuthentication and dataURL

    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,
Working...
X