File tree Expand file tree Collapse file tree 3 files changed +62
-1
lines changed
web/src/main/java/no/nav/foreldrepenger/web Expand file tree Collapse file tree 3 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 1+ package no .nav .foreldrepenger .web .app .konfig ;
2+
3+
4+ import java .util .Collections ;
5+ import java .util .HashMap ;
6+ import java .util .HashSet ;
7+ import java .util .Map ;
8+ import java .util .Set ;
9+
10+ import jakarta .ws .rs .ApplicationPath ;
11+ import jakarta .ws .rs .core .Application ;
12+
13+ import org .glassfish .jersey .server .ServerProperties ;
14+
15+ import no .nav .foreldrepenger .web .app .tjenester .RestImplementationClasses ;
16+
17+ /**
18+ * Konfigurer Prometheus og Healthchecks
19+ */
20+ @ ApplicationPath (ServiceApiConfig .SERVICE_URI )
21+ public class ServiceApiConfig extends Application {
22+
23+ public static final String SERVICE_URI = "/service/api" ;
24+
25+ @ Override
26+ public Set <Class <?>> getClasses () {
27+ Set <Class <?>> classes = new HashSet <>();
28+ // Grensesnitt for satellitt-appplikasjoner
29+ classes .addAll (RestImplementationClasses .getServiceClasses ());
30+ // Applikasjonsoppsett
31+ classes .addAll (FellesConfigClasses .getFellesConfigClasses ());
32+
33+ return Collections .unmodifiableSet (classes );
34+ }
35+
36+ @ Override
37+ public Map <String , Object > getProperties () {
38+ Map <String , Object > properties = new HashMap <>();
39+ // Ref Jersey doc
40+ properties .put (ServerProperties .BV_SEND_ERROR_IN_RESPONSE , true );
41+ properties .put (ServerProperties .PROCESSING_RESPONSE_ERRORS_ENABLED , true );
42+ return properties ;
43+ }
44+ }
Original file line number Diff line number Diff line change @@ -124,6 +124,22 @@ public static Collection<Class<?>> getImplementationClasses() {
124124 return Set .copyOf (classes );
125125 }
126126
127+ public static Collection <Class <?>> getServiceClasses () {
128+ Set <Class <?>> classes = new HashSet <>();
129+
130+ // Satellitt-applikasjoner
131+ classes .add (FordelRestTjeneste .class );
132+ classes .add (HendelserRestTjeneste .class ); // Abonnent
133+ classes .add (LosRestTjeneste .class );
134+ classes .add (TilbakeRestTjeneste .class );
135+ classes .add (FpOversiktRestTjeneste .class );
136+
137+ // Formidlingstjenester
138+ classes .add (FormidlingRestTjeneste .class );
139+
140+ return Set .copyOf (classes );
141+ }
142+
127143 public static Set <Class <?>> getForvaltningClasses () {
128144 Set <Class <?>> classes = new HashSet <>();
129145
Original file line number Diff line number Diff line change 3636import no .nav .foreldrepenger .web .app .konfig .ApiConfig ;
3737import no .nav .foreldrepenger .web .app .konfig .EksternApiConfig ;
3838import no .nav .foreldrepenger .web .app .konfig .InternalApiConfig ;
39+ import no .nav .foreldrepenger .web .app .konfig .ServiceApiConfig ;
3940
4041public class JettyServer {
4142
@@ -169,7 +170,7 @@ private static ConstraintSecurityHandler simpleConstraints() {
169170 handler .addConstraintMapping (pathConstraint (Constraint .ALLOWED , InternalApiConfig .INTERNAL_URI + "/*" ));
170171 // Slipp gjennom til autentisering i JaxRs / auth-filter
171172 handler .addConstraintMapping (pathConstraint (Constraint .ALLOWED , ApiConfig .API_URI + "/*" ));
172- // Slipp gjennom til autentisering i JaxRs / auth-filter
173+ handler . addConstraintMapping ( pathConstraint ( Constraint . ALLOWED , ServiceApiConfig . SERVICE_URI + "/*" ));
173174 handler .addConstraintMapping (pathConstraint (Constraint .ALLOWED , EksternApiConfig .EKSTERN_API_URI + "/*" ));
174175 // Alt annet av paths og metoder forbudt - 403
175176 handler .addConstraintMapping (pathConstraint (Constraint .FORBIDDEN , "/*" ));
You can’t perform that action at this time.
0 commit comments