]> source.dussan.org Git - archiva.git/commitdiff
Adding rest events
authorMartin Schreier <martin_s@apache.org>
Sun, 13 Feb 2022 18:22:52 +0000 (19:22 +0100)
committerMartin Schreier <martin_s@apache.org>
Sun, 13 Feb 2022 18:22:52 +0000 (19:22 +0100)
14 files changed:
archiva-modules/archiva-base/archiva-event-api/src/main/java/org/apache/archiva/event/Event.java
archiva-modules/archiva-base/archiva-event-api/src/main/java/org/apache/archiva/event/EventContext.java
archiva-modules/archiva-base/archiva-event-api/src/main/java/org/apache/archiva/event/EventContextBuilder.java
archiva-modules/archiva-base/archiva-event-api/src/main/java/org/apache/archiva/event/context/RepositoryContext.java
archiva-modules/archiva-base/archiva-event-api/src/main/java/org/apache/archiva/event/context/RestContext.java
archiva-modules/archiva-base/archiva-event-api/src/main/java/org/apache/archiva/event/context/UserContext.java
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/event/RepositoryEvent.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestEvent.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestRequestEvent.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestResponseEvent.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/v2/interceptor/AuditInterceptor.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/v2/interceptor/Priorities.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml

index 2439105de0077c5d762344deee62e2c86cee7580..87ba24fefa4797cf5ddfcf24898e72f38fac3d8a 100644 (file)
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
  * Events can be chained, which means a event listener can catch events and rethrow them as its own event.
  *
  */
-public class Event extends EventObject implements Cloneable {
+public class Event<C extends EventContext> extends EventObject implements Cloneable {
 
     private static final long serialVersionUID = -7171846575892044990L;
 
@@ -95,6 +95,10 @@ public class Event extends EventObject implements Cloneable {
         throw new IllegalArgumentException( "No matching event context registered for " + contextClazz );
     }
 
+    public C getContext() {
+        throw new UnsupportedOperationException( );
+    }
+
     public Map<String, String> getContextData() {
         return contextMap.entrySet( ).stream( ).flatMap( ctx -> ctx.getValue( ).getData( ).entrySet( ).stream( ) )
             .collect( Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue ) );
@@ -104,8 +108,8 @@ public class Event extends EventObject implements Cloneable {
         this.contextMap.put( clazz, context );
     }
 
-    public <T extends EventContext> void setContext( T context) {
-        this.contextMap.put( context.getClass(), context );
+    public void setContext( C context) {
+        throw new UnsupportedOperationException( );
     }
 
     /**
index 9e113de061ac53f2c54ace1e1ae406a3a041cc6f..d74c82c0418f87eaf830186d4043cd896338d5a6 100644 (file)
@@ -33,10 +33,10 @@ import java.util.Map;
 public interface EventContext
 {
     /**
-     * Returns the prefix used for entry keys in the repository data map.
-     * @return the prefix string for this context
+     * Returns the id which is also used as prefix for keys in the repository data map.
+     * @return the identifier of this context
      */
-    String getPrefix();
+    String getId();
 
     /**
      * Returns the context data as map of strings. Each entry key is prefixed with
index 41f10ceec9bb875bc15e585024d343bc7cce5a0f..0ccfc9564269e44222801baa4f34fad2fddf49f2 100644 (file)
@@ -21,6 +21,9 @@ import org.apache.archiva.event.context.RepositoryContext;
 import org.apache.archiva.event.context.RestContext;
 import org.apache.archiva.event.context.UserContext;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * Static helper class that allows to set certain context data
  *
@@ -34,8 +37,9 @@ public class EventContextBuilder
         evt.setContext( UserContext.class, new UserContext( user, remoteAddress ) );
     }
 
-    public static void setRestcontext(Event evt, String service, String path, String operation, int resultCode, String... parameters ) {
-        evt.setContext( RestContext.class, new RestContext( service, path, operation, resultCode, parameters ) );
+    public static void setRestContext( Event evt,  String path, String service, String operation,
+                                       String requestMethod, int resultCode, Map<String, List<String>> pathParameter) {
+        evt.setContext( RestContext.class, new RestContext( path, service, operation, requestMethod, resultCode, pathParameter ) );
     }
 
     public static void setRepositoryContext(Event evt, String id, String type, String flavour ) {
@@ -56,8 +60,9 @@ public class EventContextBuilder
         return this;
     }
 
-    public EventContextBuilder witRest( String service, String path, String operation, int resultCode, String... parameters) {
-        setRestcontext( this.evt, service, path, operation, resultCode, parameters );
+    public EventContextBuilder witRest( String path, String service, String operation, String requestMethod,
+        int resultCode, Map<String,List<String>> pathParameter) {
+        setRestContext( this.evt, path, service,  operation, requestMethod, resultCode, pathParameter );
         return this;
     }
 
index 4df023d1b14ec228ee0b7e49e8973a8aa256edb0..1fb7f4843506e2806c40a840123000cbc5c8ec56 100644 (file)
@@ -32,15 +32,15 @@ public class RepositoryContext implements EventContext, Serializable
 {
     private static final long serialVersionUID = -4172663291198878307L;
 
-    private static final String PREFIX = "repository";
+    private static final String ID = "repository";
 
-    private final String id;
+    private final String repositoryId;
     private final String type;
     private final String flavour;
 
-    public RepositoryContext( String id, String type, String flavour )
+    public RepositoryContext( String repositoryId, String type, String flavour )
     {
-        this.id = id;
+        this.repositoryId = repositoryId;
         this.type = type;
         this.flavour = flavour;
     }
@@ -49,9 +49,9 @@ public class RepositoryContext implements EventContext, Serializable
      * Returns the repository id
      * @return the repository id
      */
-    public String getId( )
+    public String getRepositoryId( )
     {
-        return id;
+        return repositoryId;
     }
 
     /**
@@ -76,15 +76,15 @@ public class RepositoryContext implements EventContext, Serializable
     public Map<String, String> getData( )
     {
         Map<String, String> values = new HashMap<>( );
-        values.put( PREFIX+".id", id );
-        values.put( PREFIX+".type", type );
-        values.put( PREFIX+".flavour", flavour );
+        values.put( ID +".repositoryId", repositoryId );
+        values.put( ID +".type", type );
+        values.put( ID +".flavour", flavour );
         return values;
     }
 
     @Override
-    public String getPrefix( )
+    public String getId( )
     {
-        return PREFIX;
+        return ID;
     }
 }
index 615759d427c028e7eaaa78a482855b1cd7790c62..c413735a837c939a4e5cfd46b378fe4caef4434e 100644 (file)
@@ -20,7 +20,6 @@ package org.apache.archiva.event.context;
 import org.apache.archiva.event.EventContext;
 
 import java.io.Serializable;
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -34,22 +33,25 @@ public class RestContext implements EventContext, Serializable
 {
     private static final long serialVersionUID = -4109505194250928317L;
 
-    public static final String PREFIX = "rest";
+    public static final String ID = "rest";
 
     private final String service;
     private final String path;
     private final String operation;
-    private final List<String> parameters;
+    private final String requestMethod;
     private final int resultCode;
+    private final Map<String, List<String>> pathParameter;
 
 
-    public RestContext( String service, String path, String operation, int resultCode, String... parameters )
+    public RestContext( String path, String service, String operation, String requestMethod, int resultCode,
+                        Map<String, List<String>> pathParameter)
     {
         this.service = service;
         this.path = path;
         this.operation = operation;
         this.resultCode = resultCode;
-        this.parameters = Arrays.asList( parameters );
+        this.requestMethod = requestMethod;
+        this.pathParameter = pathParameter;
     }
 
     public String getService( )
@@ -67,9 +69,9 @@ public class RestContext implements EventContext, Serializable
         return operation;
     }
 
-    public List<String> getParameters( )
+    public String getRequestMethod( )
     {
-        return parameters;
+        return requestMethod;
     }
 
     public int getResultCode( )
@@ -77,20 +79,33 @@ public class RestContext implements EventContext, Serializable
         return resultCode;
     }
 
+    public Map<String, List<String>> getPathParameter() {
+        return pathParameter;
+    }
+
     @Override
     public Map<String, String> getData( )
     {
         Map<String, String> values = new HashMap<>( );
-        values.put( PREFIX+".service", service );
-        values.put( PREFIX+".path", path );
-        values.put( PREFIX+".operation", operation );
-        values.put( PREFIX+".parameter", String.join( ",", parameters ) );
+        values.put( ID +".service", service );
+        values.put( ID +".path", path );
+        values.put( ID +".operation", operation );
+        values.put( ID +".requestMethod", requestMethod );
+        values.put( ID + ".pathParameter", getParamString( ) );
         return values;
     }
 
     @Override
-    public String getPrefix( )
+    public String getId( )
     {
-        return PREFIX;
+        return ID;
+    }
+
+    private String getParamString() {
+        StringBuilder sb = new StringBuilder( );
+        for(Map.Entry<String, List<String>> entry : pathParameter.entrySet()) {
+            sb.append( entry.getKey( ) ).append( String.join( ",", entry.getValue( ) ) );
+        }
+        return sb.toString( );
     }
 }
index 8a83c73c8b39d8ab44e660560781f3ea6d25da9c..9d3eeacdc2a707664a662c5ae9f003bf10f3dea0 100644 (file)
@@ -32,7 +32,7 @@ public class UserContext implements EventContext, Serializable
 {
     private static final long serialVersionUID = -3499164111736559781L;
 
-    private static final String PREFIX = "user";
+    private static final String ID = "user";
 
     private final String userId;
     private final String remoteAddress;
@@ -58,14 +58,14 @@ public class UserContext implements EventContext, Serializable
     public Map<String, String> getData( )
     {
         Map<String, String> values = new HashMap<>( );
-        values.put( PREFIX+".user_id", userId );
-        values.put( PREFIX+".remote_address", remoteAddress );
+        values.put( ID +".user_id", userId );
+        values.put( ID +".remote_address", remoteAddress );
         return values;
     }
 
     @Override
-    public String getPrefix( )
+    public String getId( )
     {
-        return PREFIX;
+        return ID;
     }
 }
index a4b667b3caff23ed5f1b6167a26db791b5d19e30..0bd5a057010c2bdbda7426619e1526cfd73f56be 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.archiva.repository.event;
 import org.apache.archiva.event.Event;
 import org.apache.archiva.event.EventContextBuilder;
 import org.apache.archiva.event.EventType;
+import org.apache.archiva.event.context.RepositoryContext;
 import org.apache.archiva.repository.ManagedRepository;
 import org.apache.archiva.repository.RemoteRepository;
 import org.apache.archiva.repository.Repository;
@@ -31,7 +32,7 @@ import org.apache.archiva.repository.RepositoryGroup;
  * A repository event is specific to a repository and holds a reference to the repository that
  * is related to this event.
  */
-public class RepositoryEvent extends Event
+public class RepositoryEvent extends Event<RepositoryContext>
 {
 
     private static final long serialVersionUID = 4676673476606414834L;
@@ -55,6 +56,17 @@ public class RepositoryEvent extends Event
         return repository;
     }
 
+    @Override
+    public RepositoryContext getContext() {
+        return getContext( RepositoryContext.class );
+    }
+
+    @Override
+    public void setContext( RepositoryContext context )
+    {
+        setContext( RepositoryContext.class, context );
+    }
+
     @Override
     public EventType<? extends RepositoryEvent> getType() {
         return (EventType<? extends RepositoryEvent>) super.getType();
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestEvent.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestEvent.java
new file mode 100644 (file)
index 0000000..7c23548
--- /dev/null
@@ -0,0 +1,45 @@
+package org.apache.archiva.rest.api.v2.event;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.apache.archiva.event.Event;
+import org.apache.archiva.event.EventContextBuilder;
+import org.apache.archiva.event.EventType;
+import org.apache.archiva.event.context.RestContext;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public class RestEvent extends Event<RestContext>
+{
+
+    public static EventType<RestEvent> ANY = new EventType<>( Event.ANY, "REST");
+
+
+    public RestEvent( EventType<? extends Event> type, Object originator)
+    {
+        super( type, originator );
+        EventContextBuilder builder = EventContextBuilder.withEvent( this );
+    }
+
+    @Override
+    public RestContext getContext() {
+        return getContext( RestContext.class );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestRequestEvent.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestRequestEvent.java
new file mode 100644 (file)
index 0000000..004ade6
--- /dev/null
@@ -0,0 +1,53 @@
+package org.apache.archiva.rest.api.v2.event;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.apache.archiva.event.Event;
+import org.apache.archiva.event.EventContextBuilder;
+import org.apache.archiva.event.EventType;
+import org.apache.archiva.event.context.RestContext;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public class RestRequestEvent extends RestEvent
+{
+
+    public static EventType<RestRequestEvent> BEFORE = new EventType<>( RestEvent.ANY, "REST.REQUEST.BEFORE" );
+
+
+    public RestRequestEvent( EventType<? extends Event> type, Object originator,
+                             String path, String service, String operation, String requestMethod,
+                             Map<String,List<String>> pathParameter )
+    {
+        super( type, originator );
+        EventContextBuilder builder = EventContextBuilder.withEvent( this );
+        builder.witRest( path, service, operation, requestMethod, -1, pathParameter );
+        builder.apply( );
+    }
+
+    @Override
+    public RestContext getContext( )
+    {
+        return getContext( RestContext.class );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestResponseEvent.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/event/RestResponseEvent.java
new file mode 100644 (file)
index 0000000..0923221
--- /dev/null
@@ -0,0 +1,51 @@
+package org.apache.archiva.rest.api.v2.event;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import org.apache.archiva.event.Event;
+import org.apache.archiva.event.EventContextBuilder;
+import org.apache.archiva.event.EventType;
+import org.apache.archiva.event.context.RestContext;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public class RestResponseEvent extends RestEvent
+{
+    public static EventType<RestResponseEvent> AFTER = new EventType<>( RestEvent.ANY, "REST.RESPONSE.AFTER" );
+
+    public RestResponseEvent( EventType<? extends Event> type, Object originator,
+                              String path, String service, String operation, String requestMethod, int resultCode,
+                              Map<String, List<String>> pathParameter )
+    {
+        super( type, originator );
+        EventContextBuilder builder = EventContextBuilder.withEvent( this );
+        builder.witRest( path, service, operation, requestMethod, resultCode, pathParameter );
+        builder.apply( );
+    }
+
+    @Override
+    public RestContext getContext( )
+    {
+        return getContext( RestContext.class );
+    }
+}
index 519fb1e5b3ef6903d77b05e4ad959e375c43e0dc..c7391c6dbe07eb21e1cbfba00f11b267c4795723 100644 (file)
 
     <dependency>
        <groupId>jakarta.inject</groupId>
-<artifactId>jakarta.inject-api</artifactId>
+      <artifactId>jakarta.inject-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>jakarta.annotation</groupId>
+      <artifactId>jakarta.annotation-api</artifactId>
     </dependency>
     <dependency>
       <groupId>jakarta.xml.bind</groupId>
 
 
     <!-- Needed for JDK >= 9 -->
-    <dependency>
-      <groupId>jakarta.annotation</groupId>
-      <artifactId>jakarta.annotation-api</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.glassfish.jaxb</groupId>
       <artifactId>jaxb-runtime</artifactId>
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/v2/interceptor/AuditInterceptor.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/v2/interceptor/AuditInterceptor.java
new file mode 100644 (file)
index 0000000..d18ae8c
--- /dev/null
@@ -0,0 +1,86 @@
+package org.apache.archiva.rest.v2.interceptor;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.archiva.admin.model.AuditInformation;
+import org.apache.archiva.event.AbstractEventManager;
+import org.apache.archiva.event.Event;
+import org.apache.archiva.event.EventContextBuilder;
+import org.apache.archiva.event.EventHandler;
+import org.apache.archiva.event.EventSource;
+import org.apache.archiva.event.EventType;
+import org.apache.archiva.event.context.RestContext;
+import org.apache.archiva.redback.rest.services.RedbackAuthenticationThreadLocal;
+import org.apache.archiva.redback.rest.services.RedbackRequestInformation;
+import org.apache.archiva.redback.users.User;
+import org.apache.archiva.rest.api.v2.event.RestRequestEvent;
+import org.apache.archiva.rest.api.v2.event.RestResponseEvent;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+import javax.ws.rs.container.ResourceInfo;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.ext.Provider;
+import java.io.IOException;
+import javax.annotation.Priority;
+
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+@Provider
+@Service( "restInterceptor#audit" )
+@Priority( Priorities.AUDIT )
+public class AuditInterceptor extends AbstractEventManager implements ContainerRequestFilter, ContainerResponseFilter, EventSource
+{
+    @Context
+    ResourceInfo resourceInfo;
+
+    protected void addAuditInformation( Event<RestContext> evt )
+    {
+        RedbackRequestInformation redbackRequestInformation = RedbackAuthenticationThreadLocal.get();
+        String user = redbackRequestInformation == null ? "" : redbackRequestInformation.getUser().getUsername();
+        String remoteAddr = redbackRequestInformation == null ? "" : redbackRequestInformation.getRemoteAddr();
+        EventContextBuilder.withEvent( evt ).withUser( user, remoteAddr ).apply();
+    }
+
+    @Override
+    public void filter( ContainerRequestContext requestContext, ContainerResponseContext responseContext ) throws IOException
+    {
+        RestResponseEvent evt = new RestResponseEvent( RestResponseEvent.AFTER,
+            this, requestContext.getUriInfo( ).getPath( ), resourceInfo.getResourceClass( ).getName( ), resourceInfo.getResourceMethod( ).getName( )
+            , requestContext.getMethod( ), responseContext.getStatus( ), requestContext.getUriInfo( ).getPathParameters( ) );
+        addAuditInformation( evt );
+        fireEvent( evt, this );
+    }
+
+    @Override
+    public void filter( ContainerRequestContext requestContext ) throws IOException
+    {
+        RestRequestEvent evt = new RestRequestEvent( RestRequestEvent.BEFORE, this,
+            requestContext.getUriInfo().getPath(), resourceInfo.getResourceClass().getName(),  resourceInfo.getResourceMethod().getName()
+            , requestContext.getMethod(), requestContext.getUriInfo().getPathParameters() );
+        addAuditInformation( evt );
+        fireEvent( evt, this );
+    }
+
+}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/v2/interceptor/Priorities.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/v2/interceptor/Priorities.java
new file mode 100644 (file)
index 0000000..91b9319
--- /dev/null
@@ -0,0 +1,26 @@
+package org.apache.archiva.rest.v2.interceptor;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+public class Priorities
+{
+    public static final int AUDIT = 5000;
+}
index 044998678cb5b1192f54c6f742e0d5934941d24a..95d30193d36aeea357a9ac1e9958da7c50cf743a 100644 (file)
@@ -74,6 +74,7 @@
       <ref bean="requestValidationInterceptor#rest" />
       <ref bean="archivaRestServiceExceptionMapper"/>
       <ref bean="threadLocalUserCleaner#rest" />
+      <ref bean="restInterceptor#audit" />
     </jaxrs:providers>
 
     <jaxrs:serviceBeans>