|
1 | | -Example WebApp Plugin for Fess |
| 1 | +# Fess WebApp Plugin Example |
| 2 | + |
2 | 3 | [](https://github.com/codelibs/fess-webapp-example/actions/workflows/maven.yml) |
3 | | -========================== |
| 4 | +[](https://maven-badges.herokuapp.com/maven-central/org.codelibs.fess/fess-webapp-example) |
| 5 | +[](https://opensource.org/licenses/Apache-2.0) |
| 6 | + |
| 7 | +A demonstration WebApp plugin for [Fess](https://fess.codelibs.org/), showing how to create custom JSP design templates and extend the search engine's web interface functionality. |
4 | 8 |
|
5 | 9 | ## Overview |
6 | 10 |
|
7 | | -This is a sample plugin for Fess webapp. |
| 11 | +This plugin demonstrates how to extend Fess's web application layer by providing custom JSP templates for various UI components. It serves as a practical example for developers who want to create their own custom web interfaces for Fess search applications. |
| 12 | + |
| 13 | +### Key Features |
| 14 | + |
| 15 | +- **Custom JSP Templates**: Provides custom design templates for search pages, navigation, and error handling |
| 16 | +- **System Helper Extension**: Extends Fess's `SystemHelper` class with enhanced error handling and logging |
| 17 | +- **Component Registration**: Demonstrates dependency injection configuration using LastaDi framework |
| 18 | +- **Comprehensive UI Coverage**: Includes templates for search interface, user management, and error pages |
| 19 | + |
| 20 | +## Supported UI Components |
| 21 | + |
| 22 | +The plugin registers custom JSP templates for the following components: |
| 23 | + |
| 24 | +### Search Interface |
| 25 | +- `index.jsp` - Main search page |
| 26 | +- `search.jsp` - Search interface |
| 27 | +- `searchResults.jsp` - Search results display |
| 28 | +- `searchNoResult.jsp` - No results found page |
| 29 | +- `searchOptions.jsp` - Search options |
| 30 | +- `advance.jsp` - Advanced search |
| 31 | +- `help.jsp` - Help page |
8 | 32 |
|
9 | | -## Download |
| 33 | +### Navigation & Layout |
| 34 | +- `header.jsp` - Page header |
| 35 | +- `footer.jsp` - Page footer |
10 | 36 |
|
11 | | -See [Maven Repository](https://repo1.maven.org/maven2/org/codelibs/fess/fess-webapp-example/). |
| 37 | +### Error Handling |
| 38 | +- `error/error.jsp` - General error page |
| 39 | +- `error/notFound.jsp` - 404 Not Found |
| 40 | +- `error/system.jsp` - System error |
| 41 | +- `error/redirect.jsp` - Redirect error |
| 42 | +- `error/badRequest.jsp` - 400 Bad Request |
| 43 | + |
| 44 | +### User Interface |
| 45 | +- `login/index.jsp` - Login page |
| 46 | +- `profile/index.jsp` - User profile page |
| 47 | + |
| 48 | +### Cache Display |
| 49 | +- `cache.hbs` - Cache display template (Handlebars) |
| 50 | + |
| 51 | +## Requirements |
| 52 | + |
| 53 | +- Java 21 or later |
| 54 | +- Maven 3.6 or later |
| 55 | +- Fess 15.0 or later |
12 | 56 |
|
13 | 57 | ## Installation |
14 | 58 |
|
15 | | -See [Plugin](https://fess.codelibs.org/13.9/admin/plugin-guide.html) of Administration guide. |
| 59 | +### From Maven Repository |
| 60 | + |
| 61 | +The plugin is available on Maven Central: |
| 62 | + |
| 63 | +```xml |
| 64 | +<dependency> |
| 65 | + <groupId>org.codelibs.fess</groupId> |
| 66 | + <artifactId>fess-webapp-example</artifactId> |
| 67 | + <version>15.0.0</version> |
| 68 | +</dependency> |
| 69 | +``` |
| 70 | + |
| 71 | +### Manual Installation |
| 72 | + |
| 73 | +1. Download the plugin JAR from [Maven Repository](https://repo1.maven.org/maven2/org/codelibs/fess/fess-webapp-example/) |
| 74 | +2. Follow the [Plugin Installation Guide](https://fess.codelibs.org/admin/plugin-guide.html) in the Fess documentation |
| 75 | + |
| 76 | +### Building from Source |
| 77 | + |
| 78 | +```bash |
| 79 | +git clone https://github.com/codelibs/fess-webapp-example.git |
| 80 | +cd fess-webapp-example |
| 81 | +mvn clean package |
| 82 | +``` |
| 83 | + |
| 84 | +The compiled JAR will be available in the `target/` directory. |
| 85 | + |
| 86 | +## Development |
| 87 | + |
| 88 | +### Project Structure |
| 89 | + |
| 90 | +``` |
| 91 | +src/ |
| 92 | +├── main/ |
| 93 | +│ ├── java/ |
| 94 | +│ │ └── org/codelibs/fess/plugin/webapp/helper/ |
| 95 | +│ │ └── CustomSystemHelper.java |
| 96 | +│ └── resources/ |
| 97 | +│ └── fess+systemHelper.xml |
| 98 | +└── test/ |
| 99 | + ├── java/ |
| 100 | + │ └── org/codelibs/fess/plugin/webapp/helper/ |
| 101 | + │ └── CustomSystemHelperTest.java |
| 102 | + └── resources/ |
| 103 | + └── test_app.xml |
| 104 | +``` |
| 105 | + |
| 106 | +### Core Components |
| 107 | + |
| 108 | +#### CustomSystemHelper |
| 109 | + |
| 110 | +The main plugin class that extends Fess's `SystemHelper`: |
| 111 | + |
| 112 | +- **Location**: `src/main/java/org/codelibs/fess/plugin/webapp/helper/CustomSystemHelper.java` |
| 113 | +- **Function**: Overrides `parseProjectProperties()` with enhanced error handling |
| 114 | +- **System Property**: Sets `fess.webapp.plugin=true` during initialization |
| 115 | + |
| 116 | +#### Configuration |
| 117 | + |
| 118 | +- **DI Configuration**: `src/main/resources/fess+systemHelper.xml` |
| 119 | +- **Component Registration**: Maps UI component names to JSP template files |
| 120 | +- **Test Configuration**: `src/test/resources/test_app.xml` |
| 121 | + |
| 122 | +### Building and Testing |
| 123 | + |
| 124 | +```bash |
| 125 | +# Compile the project |
| 126 | +mvn clean compile |
| 127 | + |
| 128 | +# Run tests |
| 129 | +mvn test |
| 130 | + |
| 131 | +# Create package |
| 132 | +mvn clean package |
| 133 | + |
| 134 | +# Format code |
| 135 | +mvn formatter:format |
| 136 | + |
| 137 | +# Check license headers |
| 138 | +mvn license:check |
| 139 | + |
| 140 | +# Generate documentation |
| 141 | +mvn javadoc:javadoc |
| 142 | +``` |
| 143 | + |
| 144 | +### Creating Custom Templates |
| 145 | + |
| 146 | +1. Extend the `CustomSystemHelper` class or create your own helper |
| 147 | +2. Register your JSP templates in the DI configuration file |
| 148 | +3. Ensure your plugin JAR includes the manifest entry: `Fess-WebAppJar=true` |
| 149 | + |
| 150 | +## Configuration |
| 151 | + |
| 152 | +The plugin uses LastaDi dependency injection framework. Template mappings are configured in `fess+systemHelper.xml`: |
| 153 | + |
| 154 | +```xml |
| 155 | +<component name="systemHelper" class="org.codelibs.fess.plugin.webapp.helper.CustomSystemHelper"> |
| 156 | + <postConstruct name="addDesignJspFileName"> |
| 157 | + <arg>"index"</arg> |
| 158 | + <arg>"index.jsp"</arg> |
| 159 | + </postConstruct> |
| 160 | + <!-- Additional template mappings... --> |
| 161 | +</component> |
| 162 | +``` |
| 163 | + |
| 164 | +## Contributing |
| 165 | + |
| 166 | +1. Fork the repository |
| 167 | +2. Create a feature branch (`git checkout -b feature/your-feature`) |
| 168 | +3. Commit your changes (`git commit -am 'Add some feature'`) |
| 169 | +4. Push to the branch (`git push origin feature/your-feature`) |
| 170 | +5. Create a Pull Request |
| 171 | + |
| 172 | +### Development Guidelines |
| 173 | + |
| 174 | +- Follow the existing code style and conventions |
| 175 | +- Add appropriate test cases for new functionality |
| 176 | +- Ensure all tests pass before submitting |
| 177 | +- Update documentation as needed |
| 178 | + |
| 179 | +## License |
| 180 | + |
| 181 | +This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. |
| 182 | + |
| 183 | +## Support |
| 184 | + |
| 185 | +- **Documentation**: [Fess Documentation](https://fess.codelibs.org/) |
| 186 | +- **Plugin Guide**: [Plugin Installation Guide](https://fess.codelibs.org/admin/plugin-guide.html) |
| 187 | +- **Issues**: [GitHub Issues](https://github.com/codelibs/fess-webapp-example/issues) |
| 188 | +- **Discussions**: [GitHub Discussions](https://github.com/codelibs/fess-webapp-example/discussions) |
| 189 | + |
| 190 | +## Related Projects |
| 191 | + |
| 192 | +- [Fess](https://github.com/codelibs/fess) - The main Fess search server |
| 193 | +- [LastaFlute](https://github.com/lastaflute/lastaflute) - Web framework used by Fess |
| 194 | +- [DBFlute](https://github.com/dbflute/dbflute-core) - Database access framework |
| 195 | + |
| 196 | +--- |
16 | 197 |
|
| 198 | +**CodeLibs Project** - https://www.codelibs.org/ |
0 commit comments