Java Weblog Development with Cursor IDE
March 10, 2026 ยท View on GitHub
This directory contains tools and configurations for Java weblog development in system-tests using Cursor IDE.
๐ Table of Contents
- Description
- Core Workflow
- Prerequisites
- Manual Setup
- Using the Prompt
- Supported Frameworks
- Development Workflow
- Troubleshooting
- Contributing
๐ฏ Description
The java-endpoint-prompt.mdc file is a specialized prompt for Cursor IDE that contains:
- Implementation guidelines for Java endpoints in system-tests weblogs
- Framework-specific patterns for each framework (Spring Boot, Vert.x, Jersey, etc.)
- Critical rules for preserving existing code
- Best practices for development and testing
๐ Core Workflow
The fundamental way to work with this prompt is to create endpoints from test files. Here's how it works:
๐ Test-Driven Endpoint Creation
- Start with a test file (e.g.,
tests/appsec/iast/test_sqli.py) - Feed the test to Cursor with the prompt
- Cursor analyzes the test and extracts the required endpoints
- Cursor generates the implementation following the framework patterns
๐ก Example Usage
@java-endpoint-prompt.mdc
Analyze this test file and create the missing endpoints for Spring Boot:
[paste test file content or reference the test file]
Framework: spring-boot
Test file: tests/appsec/iast/test_sqli.py
Cursor will:
- ๐ Extract endpoint requirements from the test (paths, methods, parameters)
- ๐๏ธ Generate the Java implementation using the correct framework patterns
- โก Follow preservation rules to avoid breaking existing code
- ๐ฏ Create only what's needed based on the test specifications
๐ก Using the Prompt
Useful Cursor Commands
Once you have the prompt loaded, you can use commands like:
# Create endpoints from test file (RECOMMENDED APPROACH)
@java-endpoint-prompt.mdc Analyze this test file and create the missing endpoints for Spring Boot:
[paste test content or reference test file]
# Create a specific endpoint
@java-endpoint-prompt.mdc Create a POST /iast/sqli/test endpoint for Spring Boot
# Analyze existing endpoint
@java-endpoint-prompt.mdc Analyze the /rasp/lfi endpoint in vertx4
# Fix build issues
@java-endpoint-prompt.mdc Help me fix this compilation error in Jersey
Request Structure
For best results, structure your requests like this:
@java-endpoint-prompt.mdc
Framework: [spring-boot/vertx3/vertx4/jersey-grizzly2/etc.]
Test file: [path/to/test_file.py] (RECOMMENDED)
Action: [analyze-test/create/modify/debug]
Detailed description of what you need...
๐ฏ Test-First Approach (Recommended)
The most effective way to use this prompt:
@java-endpoint-prompt.mdc
Framework: spring-boot
Test file: tests/appsec/iast/test_sql_injection.py
Please analyze this test file and create all the missing endpoints that are needed for the test to pass.
๐ ๏ธ Supported Frameworks
The prompt includes specific configurations for:
| Framework | Directory | Characteristics |
|---|---|---|
| Spring Boot | spring-boot/ | Annotations, Controllers, RequestMapping |
| Vert.x 3 | vertx3/ | Route Providers, Consumer |
| Vert.x 4 | vertx4/ | Route Providers, Consumer |
| Jersey | jersey-grizzly2/ | JAX-RS, Resource Classes |
| Play | play/ | Scala Controllers, Actions |
| Ratpack | ratpack/ | Handler Classes, Chain |
| Akka-HTTP | akka-http/ | Scala DSL, Route Objects |
| RESTEasy | resteasy-netty3/ | JAX-RS, Resource Classes |
๐ Development Workflow
1. Test-Driven Endpoint Development
# 1. Analyze test file to understand requirements
@java-endpoint-prompt.mdc Analyze this test file and extract endpoint requirements:
[paste or reference test file]
# 2. Find existing implementations in other languages (optional)
@java-endpoint-prompt.mdc Search for similar endpoints in other languages
# 3. Generate endpoints based on test analysis
@java-endpoint-prompt.mdc Create the missing endpoints for [framework] based on the test analysis
# 4. Build and validate
./utils/build/build.sh --library java --weblog-variant spring-boot
# 5. Run the test
./run.sh tests/path/to/test_file.py
2. Debugging
# For compilation errors
@java-endpoint-prompt.mdc Analyze this build error: [error]
# For test failures
@java-endpoint-prompt.mdc This test fails with 404, what should I check?
๐จ Troubleshooting
Cursor doesn't see the file
Problem: Cursor doesn't recognize the prompt Solution:
- Verify you're in the correct directory
- Use the full path:
@utils/build/docker/java/.cursor/rules/java-endpoint-prompt.mdc - Restart Cursor IDE
Generic responses
Problem: Cursor gives generic responses without following the rules Solution:
- Make sure to reference the file with
@java-endpoint-prompt.mdc - Specify the framework in your request
- Include specific endpoint context
- Use the test-first approach for better results
Build errors
Problem: Generated code doesn't compile Solution:
- Verify that existing imports haven't been removed
- Check that class fields are preserved
- Consult the troubleshooting section in the prompt
Test analysis issues
Problem: Cursor doesn't extract endpoints correctly from tests Solution:
- Make sure to reference both the prompt and the test file clearly
- Specify the target framework
- Provide the complete test file content or path
- Ask for step-by-step analysis if needed
๐ค Contributing
Improving the Prompt
If you find patterns or rules that should be added:
- Edit
java-endpoint-prompt.mdc - Test the changes with various frameworks
- Document the changes in this README
๐ Additional Resources
๐ DOCUMENTATION USED: @java-endpoint-prompt.mdc, @docs/understand/weblogs/, @docs/understand/scenarios/