Copy com.adcaustin.webclient. WebClientPlugin-1.8.x.jar to eclipse\dropins or plugins folder (Depends of the eclipse version)..
To confirm that WebClient Plugin builder is installed correctly.
Configure the default JRE
a. Create a default jre for your workspace
Window → Preferences → Java → Installed JREs → Click on Add.. → Standard VM → Browse your java installation directory → click finish → Select the new jre you created and click apply and close
Note: Ensure the selected JRE Home is a full JDK and is of a version that will satisfy Apache Tomcat
Configure Apache Tomcat in Eclipse
a. Create a Tomcat installed runtime.
Window → Preferences → Server → Installed Runtimes/Runtime Environments → Click on Add... → Select Apache Tomcat vX under Apache → Click Next > → Browse to your Apache Tomcat installation directory.
Note : Select the version of Tomcat that best suits the version of Java you have.
b. Start Tomcat server.
Create a New Java Project
Introduction
A Java project contains the generated Plex Java source code, resource files and generated web templates.
Instructions
a. File → New → Other... → Expand Java folder → Select Java Project → Click Next >
b. Enter your project name in the project name field → Select Use default JRE → click Finish. (Be sure what version of java you want to use)
Note: if you’re using java 9 or higher Eclipse will try to create a module-info, but you need to select Don’t create when the next message pop up
And in other version the message don’t pop up but before creating the java project there’s a new option that you need to unchecked
There are 2 ways to create the source Folders:
Choose the one you’re more comfortable with.
Introduction
PlexBuild is an Eclipse project that contains an Apache Ant script to move Plex Java source code into Eclipse for compilation. Ant allows Eclipse to create and run Ant buildfiles from the Eclipse workbench. On the classpath tab of the Ant Runtime preference page, additional classes defining tasks and types can be added to the Ant classpath.
Instructions
c. Create a new resource folder named PlexResource.
Right-click on your java project → Select New → Select Source Folder → Enter PlexResource as the folder name → Click Finish.
Setup PlexBuild Run Configuration
Modify Ant classpath globally
Window → Preferences → Expand Ant → Select Runtime → Open the Properties tab → Click Add Property...
Create an ANT classpath for launch configuration.
Run → External Tools → External Tools Configuration... → Select Ant Build → Press the new button.
Name the new configuration PlexBuild. Set the Buildfile to ${workspace_loc:/PlexBuild/BuildConfig/build.xml} and Base Directory to ${workspace_loc:/PlexBuild/BuildConfig}
Click Apply to save.
Open the Refresh tab → Check on Refresh resources upon completion.
Click Apply to save.
Open the Build tab → Uncheck Build before launch.
Click Apply to save.
Open Targets tab → Check move Plex60Source and moveresources[default] as targets to execute.
Click Apply to save.
Configure build.properties File in PlexBuild project
Expand PlexBuild project → Expand BuildConfig folder → Right-click on build.properties file and select open with Text Editor.
Find the line plex.import.project_name=XXX. Edit the line so that plex.import.project_name=<your java project name>
Find the line plex.gen.root=XXX. Edit the line so that plex.gen.root=<your gen
directory>
Note that forward slashes will be used instead of backward slashes.
Save the file.
Generate your Plex functions. Do not build.
The idea of this option is to use the same folders of the gen folder from your plex model. Instructions
Right-click on your java project → Select Properties → Select Java build Path→ Select Source tab→ Click Link source...
b. After creating the Src now you will need to create the res folder the same way you create the src folder. Now in the Linked folder location you will put the path to the of your Gen Source folder location. (Remember to put a descriptive name like “PlexRes”) Then click finish.
Note: The next time you generate a function, you need to make a refresh in your workspace by right-clicking in the project explorer. (Validate that you don’t have any project selected)
Import WebClient project
File → Import... → Expand General folder → Select Existing Projects into Workspace → Click Next >
If you have the project in an existing folder in your file system, use Select root directory. If you have the project in a zip file format (Most common), use Select archive file . Browse to your directory and click Finish.
Configure Java Project
Right-click on your java project → Select Properties → Select Java Build Path → Open Libraries tab → Click Add Library... Note: If you’re using Java 9 or higher you need to add all your needed libraries or jar files in your classpath
Select WebClient Component → Click Next > → Check WebClient → Click Finish
Import obclient.properties to your java project souce folder \src folder.
File → Import → Expand General folder → Select File System → Click Next > → Browse to ObJava directory under CA Plex folder and select obclient.properties → Click Finish.
If you have tab functions, you also need to add pvAll.jar in your java project build path.
Right-click on your java project → Select Properties → Select Java Build Path → Open Libraries tab → Click Add External JARs... → Browse to CA Plex browse to C:\Documents and Settings\All Users\Documents\CA\Plex\ver\classver\PatternLibs\ACTIVE\Beans for Plex ver
Click Finish.
Configure obclient.properties
Note: CM WebClient date and time format works based on browser locale instead of obclient.properties date and time format.
Environment.Default.Driver=sun.jdbc.odbc.JdbcOdbcDriver Environment.Default.DataSource=jdbc:odbc:WebClient
Environment.Default.User=username Environment.Default.Password=password
Generate WebClient Templates
Create a New Dynamic Web Project
Introduction
A Dynamic Web Project contains JSP (Java Server Pages) files, HTML files, servlets, and Plex runtime JAR files. The web project is then deployed on Apache Tomcat to be viewed on a browser. To avoid any unexpected issue, we recommend that a new server is created in the workspace before creating a new web project.
Instructions
File → New → Other... → Expand Web folder → Select Dynamic Web Project → click Next >
Enter your web project name in the project name field → Select target runtime server → Dynamic web module version should be set to 2.4 → Click Finish.
Expand your web project/WebContent/WEB-INF folder to make sure that there is web.xml file created.
Note: According on what eclipse version you have, the structure of the web project wiil be different, on this new structure the web.xml is located in src/main/webapp/ WEB-INF
Configure Build Path for the New Web Project
a. Right-click on your web project → Select Properties → Select Java Build Path
→ Open Libraries tab → Click Add Library…
b. Select WebClient Component → Click Next > → Check WebClient → Click Finish.
c. Select Deployment Assembly on Properties window → Click Add… → SelectProject → Click Next > → Select your java project → Click Finish.
If you have any additional jar files that are required for deployment, you need to addthem in Deployment Assembly.
Create a New Servlet in Web Project
Introduction
WebClientServlet is a method of deploying the CM WebClient architecture. It consists of a servlet, called WebClientServlet, which launches your WebClient Plex application within a servlet container, and a configuration file, called WebClient.properties, which contains settings for the servlet.
In this mode, a single Plex function is the top-level component of your web application, known as the entry point. Consequentially, WebClientServlet is not suitable when you wish to launch a Plex function as a Business Process in Websydian Express. If you are using Websydian Express, see chapters Deploying CM WebClient with Websydian Express for Java.
Instructions
For WebClient multi session servlet implementation, select WebClientMultiSessionServlet.
Create a New Listener in WebClient Servlet
Instructions
Add Plex Images to the Web Project
Create an images folder under WebProject/WebContent folder. (Remember that in some eclipse version the structure of the project is different, the images folder will be located in src/main/webapp )
Copy/Import all images files in the images folder.
Note: Keep in mind that CM WebClient is case-sensitive. Make sure that your Plex panel properties and your image filename is a match.
Add web project to tomcat server
1.Right-click on your tomcat server in the server tab → Select Add and remove.
Configure the webclient properties
Before running the tomcat server you need to configure the webclient properties.
You need to put the Webclient.properties in the src folder of your Dynamic Web Project. (In some version will look like src/main/java but it won’t affect and will still working) Then you need to change the properties parameters as follows:
Essential Configuration options:
You will need to have at least these properties defined in your file for everything to work correctly.
**webclient.entry : <packagename>.<Plex function implementation name>.**The entry point to the Web Application; i.e., the initial function to be
called when a new session is created. Specify the full name of the class including package names.For example:webclient.entry=WXPCOURSE60.WXuF
Define.WSACTION :/<DynamicWebProject>/<ServletName>. URL reference for servlet.For example:Define.WSACTION=/myWebProject/WebClientServlet
resurl.plex.imageresourcesURL reference for where the image resources as referenced by Plex are kept. This URL should contain a folder named images.For example:resurl.plex.imageresources=/myWebProjectt
log4j.logger.com.adcaustin.WebClient :
The granularity of the log messages. Legal values are: DEBUG, INFO,
WARN, ERROR, FATAL. DEBUG should only be used when
debugging and in test environments. In a production environment use
WARN or ERROR.
For example:
log4j.logger.com.adcaustin.WebClient=INFO, WebClientServlet
log4j.appender. WebClientServlet.filespecifies the path and the name of the log file.For example:log4j.appender.WebClientServlet.file=C:/WebClient.log
Other configuration options
There others properties that you have here, but these are optional, so just add them if you really need them.
licensingserver.tcpportThe TCP port on which licensing server listens. Only uncomment this
property if you have WebClient licensing server installed. The default
port is 65000.For example:licensingserver.tcpport=65000
licensingserver.licensefileIf there is no valid license file, this property must be commented. CM
WebClient will automatically activate 10-user developer license. If
there is a license file, then specifies the complete file system path to the license file(license.lic)For example:licensingserver.licensefile=C\\:/Program Files\\WebClient/license.lic
webclient.entry.timeoutThe entry point that is called if a session has timed out on the server and the user attempts to resume the session.For example:webclient.entry.timeout=WXPCOURSE60.sesstimeout
**webclient.entry.url.<path>*The entry point that is associated with a specific url. The url is determined by taking the components after the word "url", and changing dots to forward slashes (/). For example:webclient.entry.url.pub.item=com.foo.bar causes the relative url /pub/item to launch the function com.foo.bar.Wildcards are allowed and are specified with an asterisk(). For example:webclient.entry.url.api.=com.foo.api. causes the relative url /api/myfunc to launch the function com.foo.api.myfunc.In both cases, the url specified is relative to the url-pattern in the servlet-mapping of the servlet in the web.xml file. The url-pattern must end with "/" in order for this to work. For example, if the url-pattern is /webclient/, then the url mappings above will be relative to /webclient(e.g., /webclient/pub/item and /webclient/api/myfunc)
servlet.errorpage.urlspecifies a relative URL to an error page within the context of the WAR file
where the servlet is deployed. On errors the servlet will then call this error page which then is responsible of generating a response to the
user. The error page have to be placed within the scope of theWAR-file where / (slash) indicates the root of the WAR-file.For example:servlet.errorpage.url=/myWebProject/error.jsp
Define.WCTHEMESet WebClient theme to either claro or tundra. This property is optional. If it is not set, the default value is set to tundra.For example:Define.WCTHEME=claro
servlet.statistics.levelSet this option to cause the servlet to gather some runtime statistics on
called functions. This feature only works when calling AS/400 functions. The valid levels are as follows: 1 = Collect data on called functions
grouped by function type and function name. The number of times each
function is called as well as its inclusive run time. After each
request, a report is logged to the servlet log at the INFO log level.For example:servlet.statistics.level=1
Run WebClient in Eclipse
To find your context root, right-click on your web project → select Properties → Select Web Project Settings. (Normally is the same name that you used to create the Dynamic Web project )
To find your servlet name, expand your web project → expand WebContent folder → expand WEB-INF folder → open your web.xml with Text Editor