Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: How to specify pathname for image in XHTML file  (Read 4909 times)
Candy M.
Posts: 133

« on: January 08, 2018, 04:23:07 pm »

We are using a custom sign on to the GBC, using this code on Github:

So we are having some success.
We have place the external file in it's own group defined in as.xcf:
  1. <GROUP Id="mttestwebapp">$(res.path.mttestpath.test_webapp)</GROUP>
  1. <GROUP Id="mttestwebsvc">$(res.path.mttestpath.test_wsapp)</GROUP>

So the external configuration file for the app resides in /users/mtdev/test_webapp and the
external configuration file for the webservice resides in /users/mtdev/test_wsapp.

The XHTML files for the forms reside in /users/mtdev/mt.res.

So the in the application code for the web service (HTTPHelper.4gl), I tweaked the path for the form:
  1. FUNCTION SendWelcomePage(req, login_url)
  2.  DEFINE  req         com.HttpServiceRequest
  3.  DEFINE  login_url   STRING
  4.  DEFINE  htmlContent STRING
  5.  DEFINE  htmlDom     xml.DomDocument
  6.  DEFINE  node        xml.DomNode
  7.  DEFINE  list        xml.DomNodeList
  9.  LET htmlDom = xml.DomDocument.Create()
  10.  #Load the HTML as xml document
  11.  CALL htmlDom.load ("mt.res/MTSSOLogin.xhtml")
  12.  #CALL htmlDom.load ("../res/SSOLogin.xhtml")

It finds the form and displays it in my browser.   
But it does not find the image I have in the HTML code:
  1. <img src="mt.res/web_mtstart.png" ></img>

I have tried changing that to all sorts of paths.   This is what it shows in the Chrome developer's console:

GET 404 (Not Found)

Here's the app configuration file:
  1. <APPLICATION Parent="defaultgwc"
  2.    xmlns:xsi=""
  3.    xsi:noNamespaceSchemaLocation=""
  4. >
  5.        <EXECUTION>
  6.                <PATH>$(res.path.mttestpath.bin)</PATH>
  7.                <DVM>/bin/bash</DVM>
  8.                <MODULE></MODULE>
  9.                <DELEGATE service="mttestwebsvc/MTSSOService"/>
  10.        </EXECUTION>
  11.  <AUTO_LOGOUT>
  12.    <TIMEOUT>6000</TIMEOUT>
  13.    <PROMPT Timeout="9000" Type="DELEGATE">mttestwebsvc/MTSSOService</PROMPT>
  14.  </AUTO_LOGOUT>

Here is the web service configuration file:
  1. <APPLICATION Parent="ws.default"
  2.    xmlns:xsi=""
  3.    xsi:noNamespaceSchemaLocation=""
  4. >
  10.    <PATH>$(res.path.mttestpath.bin)</PATH>
  11.    <DVM>/bin/bash</DVM>
  12.    <MODULE></MODULE>
  13.  </EXECUTION>

How do I go about figuring out where to place that image?   

Thank you for any insight.

Gas 3.10.08 and Genero 3.10.09.   Using fastcgidispatch through Apache on centos 7

Candy M.
Posts: 133

« Reply #1 on: January 09, 2018, 12:42:18 am »

So I looked at this some more today and got it working.   I moved my image to


And in my XHTML file, the path for the image is:

  1. <img src="../../../pic/web_mtstart.png" ></img>

So, this isn't very clear to me.   I'm really puzzled why it would not work unless I had ../../../
Unless it was relative to where the XHTML docs were (/users/mtdev/mt.res)
What is the path in as.xcf that specifies where web documents are?
I want to separate our code from the GAS directory.   Do I need to add a path where I want my web docs to reside?

Thank you for any help.

Frank G.
Four Js
Posts: 41

« Reply #2 on: January 09, 2018, 10:03:30 am »


 Actually, when you are behind a GAS, for performance issue it is recommended to let the web server serve the images. So a good solution is to have them in the GAS pic directory for instance. The GAS is by default configured to serve the images in that directory. As you did. But as your HTML form is served via a web service accessible on a URL of the form http://host:port/GAS/group/app/myservice, the images in that form are relative to the URL to fetch the HTML form. So to have the images correctly served by the GAS, you must add the ../../../pic in the HTML form to finally have the browser fetching the images in http://host:port/gas/group/app/myservice/../../../pic/image.jpg, or in short : http://host:port/gas/pic/image.jpg .

If you want the images to be located else where, you have to configure the web server to access them properly and then of course have the correct path in the HTML form returned by the web service, or otherwise you have to write a web service to server your images. But not necessary as this is something the GAS does well.

Candy M.
Posts: 133

« Reply #3 on: January 09, 2018, 02:33:49 pm »

Thank you Frank.   That is clearer.   So 4js recommends putting logo images, etc in the GAS pic directory?

Pages: [1]
  Reply  |  Print  
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines