Hello Mark,

just wanted to ensure that the actual class responsible for writing the WFS response pops up in the logs consistently. However, that's not really a requirement so, I could as well log only the bits happening in my class with my private logger and let my parent class log in its own name.

I do not need to access jspnp (that's done in my parent class only) bit I must set it accordingly. Since it's final i cannot set it after calling the super constructor.

Why must ´I´ set it? Because the existing parent class cannot do that in that case. The flag gets true if the format is "text/javascript" (and false if the format is "application/json"). My formats, however, are "text/javascript; format=compact" and "application/json; format=compact" so, the parent class will never set it to true, since "text/javascript; format=compact" is not equal to "text/javascript".

In my constructor, I do remove the params after the ; (in private static helper method parseMimeType) and compute the state of the jsonp flag on my own.

That's my constructor: (still passing the LOGGER)

public CompactJSONGetFeatureResponse(GeoServer gs, String format) {
    super(gs, format, JSONType.isJsonpMimeType(parseMimeType(format)),
            org.geotools.util.logging.Logging.getLogger(
                CompactJSONGetFeatureResponse.class));
}

private static String parseMimeType(String format) {
    int pos = format.indexOf(';');
    return pos != -1 ? format.substring(0, pos).trim() : format;
}


On Wed, Sep 14, 2022 at 12:41 PM Mark Prins wrote> On 14-09-2022 10:57, Carsten Klein wrote:
     this.LOGGER = logger != null ? logger
        : org.geotools.util.logging.Logging.getLogger(this.getClass());
}

Also, I've changed the LOGGER variable from private to protected, in order to use it from the subclass.

Don't do this, just create a private LOGGER in your subclass; it will make life easier than when passing one around.

also I'm not sure I understand the reason for injecting the jsonp boolean as it is a protected variable you can just access it in the subclass to do what you need?..


_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel


_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to