Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

Is there a relative path for static resources in PASOE?

« Go Back

Information

 
Article Number000093262
EnvironmentProduct: OpenEdge
Version: 11.6.x - 11.7.x
OS: All supported platforms
Other:
Question/Problem Description
is there a relative path for static resources that can be used invoking the webhandler in PASOE?
Can the transport be added to the URL for static resources?
Can the WEB transport be added to the URL for static resources? for example: http://<PASOE>:8810/<webAppName>/WEB/static/index.html
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
There’s no direct access to the resources within WEB-INF from any client. When a transport is used, for any transport (SOAP, REST or WEB), resources within the WEB-INF are accessed internally by the agent and applets on the server. 

The static resources should be placed under the “document root” and not inside the WEB-INF, since it is a protected directory. They must be placed in the “document root” or in a subdirectory in a top level of WEB-INF of the Web Application. (See article What is the URL for static content in PASOE?

The way the directory structure is defined for static resources is : <PASOEInstance>/webApps/<WebAppName>/static. This directory can be accessed directly from any client. But there's no need to add the transport for these requests. 


 
Workaround
The WEB transport has access to the <PASOEInstance>/work directory (Working directory for the PAS OE instance) through a webHandler and could be used to access static resources, but it will require some coding to load and send back the static resource using the WEB Transport. This directory can’t be accessed directly. 

For example: Place all static resources by application under  <PASOEInstance>/work  directory :

$CATALINA_BASE/work/static
$CATALINA_BASE/work/<webappname>/static/index.html

Then follow these steps:

1. Add in a webHandler a Resource URI similar to /<webAppName>/static/

2. It would need to manage, load and add it as response for each resource type In the webHandler code, something as follows:

(Let’s try with an HTML file)
 
METHOD OVERRIDE PROTECTED INTEGER HandleGet( INPUT poRequest AS OpenEdge.Web.IWebRequest ):

DEFINE VARIABLE oResponse AS OpenEdge.Net.HTTP.IHttpResponse NO-UNDO.
DEFINE VARIABLE oWriter AS OpenEdge.Web.WebResponseWriter NO-UNDO.
DEFINE VARIABLE oBody AS OpenEdge.Core.String NO-UNDO.

DEFINE VARIABLE cURI AS CHARACTER NO-UNDO.
DEFINE VARIABLE text-memptr AS MEMPTR NO-UNDO.

ASSIGN 
oResponse = NEW OpenEdge.Web.WebResponse()
oResponse:StatusCode = INTEGER(StatusCodeEnum:OK)
.
cUri = poRequest:GetContextValue("PATH_INFO").

COPY-LOB FROM FILE cUri TO text-memptr.
ASSIGN 
oBody = NEW OpenEdge.Core.String(
GET-STRING(text-memptr,1)
).

ASSIGN 
oResponse:Entity = oBody
oResponse:ContentType = 'text/html':u // For HTML, change this value based on the document type
oResponse:ContentLength = oBody:Size
.

ASSIGN 
oWriter = NEW WebResponseWriter(oResponse).

oWriter:Open().

oWriter:Close().

RETURN 0.

END METHOD.



3. The complete URL for this resource would be something like this:

http://<domain>:8810/<webAppName>/web/<webAppName>/static/index.html

4. The static resources would need to be published manually under <PASOEInstance>/work/static directory. 

This way the WEB transport will be able to process the static request and the relative path could be used. 
 
Notes
Attachment 
Last Modified Date12/11/2018 9:22 PM