NxFilter Tutorial
Tutorial Index

Directory structure and naming rule
The GUI layer of NxFilter is separated from its core part for easy customization.

As of v4.5.4.2 of NxFilter, we use SandWatch as its default GUI pack. It is in /nxfilter/guipack/sandwatch. When you use v4.5.4.2 or newer, you would need to look into SandWatch directory for GUI customization. We still keep the old GUI in /nxfilter/webapps for backward compatibility.

Naming rule for JSP files
The GUI layer of NxFilter is designed for easy customization. It is completely separated from its core part. And it has a naming convention corresponding to its menu structure so that you can find the file you need to modify easily. For example, if you want to modify 'Policy > Free Time' on NxFilter menu the file you need to edit is /nxfilter/webapps/policy,free_time.jsp.

In NxCloud's case, it has an operator specific menu. If a JSP file is for an operator specific menu then it has 'zop' prefix.

    ex) zop,policy,free_time.jsp

Structure of /nxfilter/webapps directory
We put all the JSP pages into /nxfilter/webapps and we don't use any subdirectory for keeping JSP pages. This is for simplicity. Everything you need to modify is in /nxfilter/webapps  directory. It has the following structure.

- error
- example
- img
- include
- lib

In //webapps/error directory, we have the error pages for HTTP error codes. If you want to have an error page for a specific HTTP error code, you can define it in /webapps/WEB-INF/web.xml.

We use HTTP 404 error for special purpose. You shouldn't define any error page for HTTP 404 error.

In /nxfilter/webapps/example directory, we have some example JSP pages for custom login module.

In /nxfilter/webapps/img, we keep the image files for webpages.

In /nxfilter/webapps/include, we have common JSP files to be included into the other JSP files.

/include/lib.jsp is a common library file for all JSP files. It has some utility functions for web development and it executes the initialization code for JSP pages and does authentication checking as well.

In /nxfilter/webapps/lib, we have CSS and javascript files.

We have 'WEB-INF' since we use an embedded Tomcat as NxFilter's built-in webserver.

Separating your customized GUI into another directory

When you customize NxFilter GUI, it is not a good idea to modify the original files directly. It would be better to keep it for future reference and create another directory and copy all the files inside /nxfilter/webapps into the new directory and then modify these copied files. To make things easier, NxFilter supports 'www_dir' option on /nxfilter/conf/cfg.properties file.

When you have your own custom GUI in /nxfilter/myweb directory and you want to use it as the root directory of NxFilter's webserver, you need to add the following line into 'cfg.properties' file.

    www_dir = myweb

Then restart your NxFilter.