For the complete documentation index, see llms.txt. This page is also available as Markdown.

Utils

Build Java proxies that forward and modify FactFinder requests and responses.

Motivation

You might want more control over the dataflow for various reasons:

  • own proxy

  • analyzing and metrics

  • security

  • request/response modification

For that purpose we build this library to support you when you roll your own proxy or want to route the traffic through your current Java based solution.

We have split this function into two libraries:

java-proxy-utils

Check it out on GitHub

With this library you can easily hook into a Servlet based java proxy and prepare a request for the FactFinder instance.

The FactFinder Web Components work with a special CORS handler for security and authentication. Therefore you need to route the HTTP OPTIONS request from the shop to FactFinder.

The proxy-utils allows you with just a few lines of code to handle that usecase.

private ProxyUtils          utils;
private FACTFinderSettings  settings;

@Override
public void init() throws ServletException {
    settings = new FACTFinderSettings();
    settings.setAccount("admin");
    settings.setPassword("myPassowrd");
    // URL to your FactFinder instance for example:
    settings.setUrl("http://my-factfinder-isntacne.de/FACT-Finder-7.2");
    utils = new ProxyUtils(settings);
    super.init();
}

public void doOptions(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    utils.redirectOPTIONS(req, resp);
}

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    utils.redirectGET(req, resp);
};

Initialize the FACTFinderSettings with your FactFinder account and password and the URL of your FactFinder setup. All the necessary authentication information will be injected into the request.

If you know what you are doing, you can also build a request from scratch.

We added a few Helper methods for convenient use cases, for example the extraction of the original request headers:

Or a detection of the requested Service from the original request. (You maybe need the Service for parsing into the right Object Model)

You can also work with the data response and modify it. Therefore you can use the Java FactFinder Domain Model

Java FactFinder Domain Model

Check it out on GitHub

This little library allows you to parse a response from FactFinder and provides you with a Object Model you can work with. For example filter some results or add records.

When you are done, you just need to parse the Object Model back to a JSON format and send it with the original response.

We use Gson for the parsing with minimal pre settings. When you need to, you can initialize the Gson parser with your custom settings.

You dont need to use the parser we provide. If you want you can use any other JSON parsing library.

All JSON Schema files are located within the project.

Last updated

Was this helpful?