Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zone.cogni.lib.httpheaders:httpheaders

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zone.cogni.lib.httpheaders:httpheaders

Library for various usages.

  • 0.2.0
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

cognizone-lib

Http header

Easy way to add http headers based on configuration.

Gradle part

  implementation("zone.cogni.lib:httpheaders:0.0.3")

Java part

Just add this in your @Configuration or @SpringBootApplication class

@EnableHttpHeaders

YAML configuration example

cognizone:
  http:
    headers:
      - type: plain
        key: X-Frame-Options
        value: sameorigin
      - type: plain
        key: X-My-Server
        value: El serveros

Note 1: type can be omitted. If not set default plain will be used.

Note 2: At the moment, type can only be equal to plain. This will just return the value as specified in the configuration. In the future types like spelExpression and such can be added.


Method timer

Library that can report how much time each method execution takes by just adding an annotation.

Note, due to default spring class-proxy limitations for Beans, annotations will only be picked up when called from outside the Bean. A workaround for this is being created.

Gradle part

  implementation("zone.cogni.lib:methodtimer:0.0.3")

Java part

Method timer needs to have aspectJ proxying enabled: Just add @EnableAspectJAutoProxy in your @Configuration or @SpringBootApplication class.

YAML example

To enable the timers just add this (by default timers are disabled). In java

cognizone:
  methodtimer:
    enabled: true

Usage

Just add @TimedMethod annotation to the method to be timed (needs to be a method inside a Bean that is called from the outside).

  • By default the timing name will be simple classname + method name. You can overwrite this by setting the value() of the @TimedMethod annotation.
  • The timer name can be altered by adding a @TimerName on parameters of the method. This will do a toString() on that method parameter and the result is appended to the default timer name.
  • The first time a @TimedMethod annotation is hit in a thread, a new timer is started. Once that method finishes, the timers of all annotated methods will be reported.
    • To avoid having a method starting a new timer if there is none already running for the current thread, you can set canBeParent to false on @TimedMethod.
  • At the moment only logging with SLF4J is supported. So reporting is only done via log info and logger zone.cogni.lib.methodtimer.impl.Slf4jTimerReport.

FAQs

Package last updated on 11 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc