cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1453798 [2/2] - in /cxf/trunk: rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ rt/frontend/jaxrs/src/main/java/org/a...
Date Thu, 07 Mar 2013 12:10:32 GMT
Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/OAuthRequestFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/OAuthRequestFilter.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/OAuthRequestFilter.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/OAuthRequestFilter.java
Thu Mar  7 12:10:31 2013
@@ -18,15 +18,17 @@
  */
 package org.apache.cxf.rs.security.oauth.filters;
 
-import javax.ws.rs.core.Context;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.Provider;
 
 import net.oauth.OAuthProblemException;
 
 import org.apache.cxf.jaxrs.ext.MessageContext;
-import org.apache.cxf.jaxrs.ext.RequestHandler;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.ext.MessageContextImpl;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.oauth.data.OAuthContext;
 import org.apache.cxf.security.SecurityContext;
@@ -35,25 +37,24 @@ import org.apache.cxf.security.SecurityC
  * JAX-RS OAuth filter which can be used to protect end user endpoints
  */
 @Provider
-public class OAuthRequestFilter extends AbstractAuthFilter implements RequestHandler {
-    @Context
-    private MessageContext mc;
-   
-    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
+@PreMatching
+public class OAuthRequestFilter extends AbstractAuthFilter implements ContainerRequestFilter
{
+    
+    public void filter(ContainerRequestContext context) {
         try {
-            
+            Message m = JAXRSUtils.getCurrentMessage();
+            MessageContext mc = new MessageContextImpl(m);
             OAuthInfo info = handleOAuthRequest(mc.getHttpServletRequest());
-            setSecurityContext(m, info);
+            setSecurityContext(mc, m, info);
             
         } catch (OAuthProblemException e) {
-            return Response.status(401).header("WWW-Authenticate", "OAuth").build();
+            context.abortWith(Response.status(401).header("WWW-Authenticate", "OAuth").build());
         } catch (Exception e) {
-            return Response.status(401).header("WWW-Authenticate", "OAuth").build();
+            context.abortWith(Response.status(401).header("WWW-Authenticate", "OAuth").build());
         }
-        return null;
     }
 
-    private void setSecurityContext(Message m, OAuthInfo info) {
+    private void setSecurityContext(MessageContext mc, Message m, OAuthInfo info) {
         
         SecurityContext sc = createSecurityContext(mc.getHttpServletRequest(), info);
         m.setContent(SecurityContext.class, sc);

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2-saml/src/main/java/org/apache/cxf/rs/security/oauth2/auth/saml/Saml2BearerAuthHandler.java
Thu Mar  7 12:10:31 2013
@@ -23,16 +23,17 @@ import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 
 import javax.ws.rs.NotAuthorizedException;
+import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.Response;
 
 import org.w3c.dom.Element;
 
 import org.apache.cxf.common.util.Base64Exception;
 import org.apache.cxf.jaxrs.ext.form.Form;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.provider.FormEncodingProvider;
 import org.apache.cxf.jaxrs.utils.FormUtils;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.oauth2.saml.Base64UrlUtility;
 import org.apache.cxf.rs.security.oauth2.saml.Constants;
@@ -54,8 +55,8 @@ public class Saml2BearerAuthHandler exte
         samlOAuthValidator = validator;
     }
     
-    public Response handleRequest(Message message, ClassResourceInfo resourceClass) {
-        
+    public void filter(ContainerRequestContext context) {
+        Message message = JAXRSUtils.getCurrentMessage();
         Form form = readFormData(message);    
         String assertionType = form.getData().getFirst(Constants.CLIENT_AUTH_ASSERTION_TYPE);
         String decodedAssertionType = assertionType != null ? HttpUtils.urlDecode(assertionType)
: null;
@@ -79,7 +80,6 @@ public class Saml2BearerAuthHandler exte
         } catch (Exception ex) {
             throw new NotAuthorizedException(errorResponse());
         }
-        return null;
     }
     
     private Form readFormData(Message message) {

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/filters/OAuthRequestFilter.java
Thu Mar  7 12:10:31 2013
@@ -25,13 +25,14 @@ import java.util.logging.Logger;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Response;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.ext.Provider;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.security.SimplePrincipal;
-import org.apache.cxf.jaxrs.ext.RequestHandler;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.rs.security.oauth2.common.AccessTokenValidation;
@@ -46,15 +47,17 @@ import org.apache.cxf.security.SecurityC
  * JAX-RS OAuth2 filter which can be used to protect the end-user endpoints
  */
 @Provider
-public class OAuthRequestFilter extends AbstractAccessTokenValidator implements RequestHandler
{
+@PreMatching
+public class OAuthRequestFilter extends AbstractAccessTokenValidator 
+    implements ContainerRequestFilter {
     private static final Logger LOG = LogUtils.getL7dLogger(OAuthRequestFilter.class);
     
     private boolean useUserSubject;
     
-    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
-        
+    public void filter(ContainerRequestContext context) {
+        Message m = JAXRSUtils.getCurrentMessage();
         if (isCorsRequest(m)) {
-            return null;
+            return;
         }
         
         // Get the access token
@@ -94,8 +97,6 @@ public class OAuthRequestFilter extends 
         oauthContext.setTokenKey(accessTokenV.getTokenKey());
         
         m.setContent(OAuthContext.class, oauthContext);
-        
-        return null;
     }
 
     protected boolean checkHttpVerb(HttpServletRequest req, List<String> verbs) {

Modified: cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java
(original)
+++ cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/AbstractServiceProviderFilter.java
Thu Mar  7 12:10:31 2013
@@ -31,6 +31,8 @@ import java.util.logging.Logger;
 
 import javax.annotation.PreDestroy;
 import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Cookie;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.UriBuilder;
@@ -42,7 +44,6 @@ import org.apache.cxf.common.i18n.Bundle
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.security.SimplePrincipal;
 import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxrs.ext.RequestHandler;
 import org.apache.cxf.jaxrs.impl.HttpHeadersImpl;
 import org.apache.cxf.jaxrs.impl.UriInfoImpl;
 import org.apache.cxf.message.Message;
@@ -55,8 +56,9 @@ import org.apache.ws.security.saml.ext.A
 import org.apache.ws.security.saml.ext.OpenSAMLUtil;
 import org.opensaml.saml2.core.AuthnRequest;
 
+@PreMatching
 public abstract class AbstractServiceProviderFilter extends AbstractSSOSpHandler 
-    implements RequestHandler {
+    implements ContainerRequestFilter {
     
     protected static final Logger LOG = 
         LogUtils.getL7dLogger(AbstractServiceProviderFilter.class);

Modified: cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java
(original)
+++ cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlPostBindingFilter.java
Thu Mar  7 12:10:31 2013
@@ -24,6 +24,7 @@ import java.security.cert.X509Certificat
 
 import javax.security.auth.callback.CallbackHandler;
 import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 
@@ -31,7 +32,7 @@ import org.w3c.dom.Element;
 
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.jaxrs.ext.MessageContextImpl;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.saml.DeflateEncoderDecoder;
 import org.apache.ws.security.WSPasswordCallback;
@@ -56,9 +57,10 @@ public class SamlPostBindingFilter exten
         this.useDeflateEncoding = useDeflateEncoding;
     }
     
-    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message m = JAXRSUtils.getCurrentMessage();
         if (checkSecurityContext(m)) {
-            return null;
+            return;
         } else {
             try {
                 SamlRequestInfo info = createSamlRequestInfo(m);
@@ -76,11 +78,11 @@ public class SamlPostBindingFilter exten
                 new MessageContextImpl(m).getHttpServletResponse().addHeader(
                     HttpHeaders.SET_COOKIE, contextCookie);
                 
-                return Response.ok(info)
+                context.abortWith(Response.ok(info)
                                .type("text/html")
                                .header(HttpHeaders.CACHE_CONTROL, "no-cache, no-store")
                                .header("Pragma", "no-cache") 
-                               .build();
+                               .build());
                 
             } catch (Exception ex) {
                 throw new InternalServerErrorException(ex);

Modified: cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java
(original)
+++ cxf/trunk/rt/rs/security/sso/saml/src/main/java/org/apache/cxf/rs/security/saml/sso/SamlRedirectBindingFilter.java
Thu Mar  7 12:10:31 2013
@@ -26,6 +26,7 @@ import java.security.cert.X509Certificat
 
 import javax.security.auth.callback.CallbackHandler;
 import javax.ws.rs.InternalServerErrorException;
+import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
@@ -33,7 +34,7 @@ import javax.ws.rs.core.UriBuilder;
 import org.w3c.dom.Element;
 
 import org.apache.cxf.common.util.Base64Utility;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.rs.security.saml.DeflateEncoderDecoder;
 import org.apache.ws.security.WSPasswordCallback;
@@ -46,9 +47,10 @@ import org.opensaml.saml2.core.AuthnRequ
 
 public class SamlRedirectBindingFilter extends AbstractServiceProviderFilter {
     
-    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message m = JAXRSUtils.getCurrentMessage();
         if (checkSecurityContext(m)) {
-            return null;
+            return;
         } else {
             try {
                 SamlRequestInfo info = createSamlRequestInfo(m);
@@ -68,11 +70,11 @@ public class SamlRedirectBindingFilter e
                                                     info.getWebAppContext(),
                                                     info.getWebAppDomain());
                 
-                return Response.seeOther(ub.build())
+                context.abortWith(Response.seeOther(ub.build())
                                .header(HttpHeaders.CACHE_CONTROL, "no-cache, no-store")
                                .header("Pragma", "no-cache") 
                                .header(HttpHeaders.SET_COOKIE, contextCookie)
-                               .build();
+                               .build());
             } catch (Exception ex) {
                 ex.printStackTrace();
                 throw new InternalServerErrorException(ex);

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java
(original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/AbstractSamlInHandler.java
Thu Mar  7 12:10:31 2013
@@ -29,6 +29,8 @@ import java.util.List;
 import java.util.logging.Logger;
 
 import javax.ws.rs.NotAuthorizedException;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 import javax.ws.rs.core.Response;
 
 import org.w3c.dom.Document;
@@ -37,7 +39,6 @@ import org.w3c.dom.Node;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxrs.ext.RequestHandler;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.rs.security.common.CryptoLoader;
@@ -58,8 +59,8 @@ import org.apache.ws.security.validate.S
 import org.apache.ws.security.validate.Validator;
 import org.apache.xml.security.signature.XMLSignature;
 
-
-public abstract class AbstractSamlInHandler implements RequestHandler {
+@PreMatching
+public abstract class AbstractSamlInHandler implements ContainerRequestFilter {
 
     private static final Logger LOG = 
         LogUtils.getL7dLogger(AbstractSamlInHandler.class);

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlEnvelopedInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlEnvelopedInHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlEnvelopedInHandler.java
(original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlEnvelopedInHandler.java
Thu Mar  7 12:10:31 2013
@@ -22,16 +22,16 @@ package org.apache.cxf.rs.security.saml;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
-import javax.ws.rs.core.Response;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.container.ContainerRequestContext;
 import javax.xml.stream.XMLStreamReader;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-
 import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.staxutils.W3CDOMStreamReader;
 
@@ -46,10 +46,11 @@ public class SamlEnvelopedInHandler exte
     public SamlEnvelopedInHandler() {
     }
     
-    public Response handleRequest(Message message, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message message = JAXRSUtils.getCurrentMessage();
         String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
-        if ("GET".equals(method)) {
-            return null;
+        if (HttpMethod.GET.equals(method)) {
+            return;
         }
         
         Document doc = null;
@@ -95,8 +96,6 @@ public class SamlEnvelopedInHandler exte
                 message.setContent(InputStream.class, null);
             }
         }
-        
-        return null;
     }
     
     private Element getActualBody(Element root) {

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormInHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormInHandler.java
(original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormInHandler.java
Thu Mar  7 12:10:31 2013
@@ -21,13 +21,14 @@ package org.apache.cxf.rs.security.saml;
 
 import java.net.URI;
 
+import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.Response;
 
 import org.apache.cxf.jaxrs.ext.form.Form;
 import org.apache.cxf.jaxrs.impl.UriInfoImpl;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.provider.FormEncodingProvider;
 import org.apache.cxf.jaxrs.utils.FormUtils;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
 public class SamlFormInHandler extends AbstractSamlBase64InHandler {
@@ -40,7 +41,8 @@ public class SamlFormInHandler extends A
     public SamlFormInHandler() {
     }
     
-    public Response handleRequest(Message message, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message message = JAXRSUtils.getCurrentMessage();
         
         Form form = readFormData(message);    
         String assertion = form.getData().getFirst(SAML_ELEMENT);
@@ -55,7 +57,8 @@ public class SamlFormInHandler extends A
             // back to IDP - at the moment assume it's URI
             UriInfoImpl ui = new UriInfoImpl(message); 
             if (!samlRequestURI.startsWith(ui.getBaseUri().toString())) {
-                return Response.status(302).location(URI.create(samlRequestURI)).build();
+                context.abortWith(Response.status(302).location(URI.create(samlRequestURI)).build());
+                return;
             }
         }
         form.getData().remove(SAML_ELEMENT);
@@ -67,7 +70,6 @@ public class SamlFormInHandler extends A
         } catch (Exception ex) {
             throwFault(ex.getMessage(), ex);
         }
-        return null;
     }
     
     private Form readFormData(Message message) {

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java
(original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlHeaderInHandler.java
Thu Mar  7 12:10:31 2013
@@ -21,12 +21,12 @@ package org.apache.cxf.rs.security.saml;
 
 import java.util.List;
 
+import javax.ws.rs.container.ContainerRequestContext;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Response;
 
 import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
 public class SamlHeaderInHandler extends AbstractSamlBase64InHandler {
@@ -36,7 +36,8 @@ public class SamlHeaderInHandler extends
     @Context
     private HttpHeaders headers;
     
-    public Response handleRequest(Message message, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message message = JAXRSUtils.getCurrentMessage();
         
         List<String> values = headers.getRequestHeader(HttpHeaders.AUTHORIZATION);
         if (values == null || values.size() != 1 || !values.get(0).startsWith(SAML_AUTH))
{
@@ -49,7 +50,6 @@ public class SamlHeaderInHandler extends
         }
         
         handleToken(message, parts[1]);         
-        return null;
     }
 
     

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/authorization/ClaimsAuthorizingFilter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/authorization/ClaimsAuthorizingFilter.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/authorization/ClaimsAuthorizingFilter.java
(original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/authorization/ClaimsAuthorizingFilter.java
Thu Mar  7 12:10:31 2013
@@ -21,23 +21,24 @@ package org.apache.cxf.rs.security.saml.
 import java.util.List;
 import java.util.Map;
 
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.core.Response;
 
 import org.apache.cxf.interceptor.security.AccessDeniedException;
-import org.apache.cxf.jaxrs.ext.RequestHandler;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
-public class ClaimsAuthorizingFilter implements RequestHandler {
+public class ClaimsAuthorizingFilter implements ContainerRequestFilter {
 
     private ClaimsAuthorizingInterceptor interceptor = new ClaimsAuthorizingInterceptor();
     
-    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message message = JAXRSUtils.getCurrentMessage();
         try {
-            interceptor.handleMessage(m);
-            return null;
+            interceptor.handleMessage(message);
         } catch (AccessDeniedException ex) {
-            return Response.status(Response.Status.FORBIDDEN).build();
+            context.abortWith(Response.status(Response.Status.FORBIDDEN).build());
         }
     }
 

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncInHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncInHandler.java
(original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlEncInHandler.java
Thu Mar  7 12:10:31 2013
@@ -19,18 +19,20 @@
 
 package org.apache.cxf.rs.security.xml;
 
-import javax.ws.rs.core.Response;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 
-import org.apache.cxf.jaxrs.ext.RequestHandler;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
-public class XmlEncInHandler extends AbstractXmlEncInHandler implements RequestHandler {
+@PreMatching
+public class XmlEncInHandler extends AbstractXmlEncInHandler implements ContainerRequestFilter
{
     
-    public Response handleRequest(Message message, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message message = JAXRSUtils.getCurrentMessage();
         
         decryptContent(message);
-        return null;
     }
     
 }

Modified: cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigInHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigInHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigInHandler.java
(original)
+++ cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSigInHandler.java
Thu Mar  7 12:10:31 2013
@@ -19,18 +19,20 @@
 
 package org.apache.cxf.rs.security.xml;
 
-import javax.ws.rs.core.Response;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.PreMatching;
 
-import org.apache.cxf.jaxrs.ext.RequestHandler;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 
-public class XmlSigInHandler extends AbstractXmlSigInHandler implements RequestHandler {
+@PreMatching
+public class XmlSigInHandler extends AbstractXmlSigInHandler implements ContainerRequestFilter
{
     
-    public Response handleRequest(Message message, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
+        Message message = JAXRSUtils.getCurrentMessage();
         
         checkSignature(message);
         
-        return null;
     }
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FaultyRequestHandler.java
Thu Mar  7 12:10:31 2013
@@ -18,21 +18,20 @@
  */
 package org.apache.cxf.systest.jaxrs;
 
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 
-import org.apache.cxf.jaxrs.ext.RequestHandler;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
-import org.apache.cxf.message.Message;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 
-public class FaultyRequestHandler implements RequestHandler {
+public class FaultyRequestHandler implements ContainerRequestFilter {
 
     @Context
     private UriInfo uriInfo;
     
-    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext context) {
         if (uriInfo.getPath().endsWith("/propogateExceptionVar/1")) {
             MultivaluedMap<String, String> vars = uriInfo.getPathParameters();
             if (vars.size() == 1 
@@ -40,11 +39,11 @@ public class FaultyRequestHandler implem
                 && vars.get("i").size() == 1 
                 && "1".equals(vars.getFirst("i"))) {
                 
-                m.getExchange().put("org.apache.cxf.systest.for-out-fault-interceptor", Boolean.TRUE);
+                JAXRSUtils.getCurrentMessage().getExchange()
+                    .put("org.apache.cxf.systest.for-out-fault-interceptor", Boolean.TRUE);
                 throw new RuntimeException();
             }
         }
-        return null;
     }
 
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FormatResponseHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FormatResponseHandler.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FormatResponseHandler.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/FormatResponseHandler.java
Thu Mar  7 12:10:31 2013
@@ -18,24 +18,27 @@
  */
 package org.apache.cxf.systest.jaxrs;
 
+import java.io.IOException;
+
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
 import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
 import javax.xml.bind.Marshaller;
 
 import org.apache.cxf.jaxrs.ext.MessageContext;
-import org.apache.cxf.jaxrs.ext.ResponseHandler;
-import org.apache.cxf.jaxrs.model.OperationResourceInfo;
-import org.apache.cxf.message.Message;
 
-public class FormatResponseHandler implements ResponseHandler {
+public class FormatResponseHandler implements ContainerResponseFilter {
     @Context
     private MessageContext mc;
     
-    public Response handleResponse(Message m, OperationResourceInfo ori, Response response)
{
+    @Override
+    public void filter(ContainerRequestContext reqC, ContainerResponseContext respC) 
+        throws IOException {
         if (mc.getUriInfo().getQueryParameters().containsKey("_format")) {
             mc.put(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
         }
-        return null;
+        
     }
 
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerResourceCreatedSpringProviderTest.java
Thu Mar  7 12:10:31 2013
@@ -24,7 +24,6 @@ import java.io.FileInputStream;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
-
 import java.net.HttpURLConnection;
 import java.net.Socket;
 import java.net.URL;
@@ -101,7 +100,7 @@ public class JAXRSClientServerResourceCr
     @Test
     public void testPetStoreWadl() throws Exception {
         List<Element> resourceEls = getWadlResourcesInfo("http://localhost:" + PORT
+ "/webapp/resources",
-            "http://localhost:" + PORT + "/webapp/resources/petstore", 1);
+            "http://localhost:" + PORT + "/webapp/resources/", 1);
         checkPetStoreInfo(resourceEls.get(0));
     }
     
@@ -132,6 +131,7 @@ public class JAXRSClientServerResourceCr
     
     private List<Element> getWadlResourcesInfo(String baseURI, String requestURI, int
size) throws Exception {
         WebClient client = WebClient.create(requestURI + "?_wadl&_type=xml");
+        WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(10000000);
         Document doc = DOMUtils.readXml(new InputStreamReader(client.get(InputStream.class),
"UTF-8"));
         Element root = doc.getDocumentElement();
         assertEquals(WadlGenerator.WADL_NS, root.getNamespaceURI());

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamReaderProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamReaderProvider.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamReaderProvider.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamReaderProvider.java
Thu Mar  7 12:10:31 2013
@@ -18,25 +18,26 @@
  */
 package org.apache.cxf.systest.jaxrs;
 
+import java.io.IOException;
 import java.io.InputStream;
 
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.jaxrs.ext.MessageContext;
-import org.apache.cxf.jaxrs.ext.RequestHandler;
-import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.staxutils.StaxUtils;
 
-public class XmlStreamReaderProvider implements RequestHandler {
+public class XmlStreamReaderProvider implements ContainerRequestFilter {
 
     @Context
     private MessageContext context;
     
-    public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
+    public void filter(ContainerRequestContext c) throws IOException {
         String method = context.get(Message.HTTP_REQUEST_METHOD).toString();
         
         if ("PUT".equals(method)) {
@@ -44,11 +45,12 @@ public class XmlStreamReaderProvider imp
             if (!"123".equals(map.getFirst("id"))) {
                 throw new RuntimeException();
             }
+            Message m = JAXRSUtils.getCurrentMessage();
             XMLStreamReader reader = 
                 StaxUtils.createXMLStreamReader(m.getContent(InputStream.class));
-            m.setContent(XMLStreamReader.class, new CustomXmlStreamReader(reader));
+            m.setContent(XMLStreamReader.class, 
+                                                      new CustomXmlStreamReader(reader));
         }
-        return null;
     }
 
 }

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamWriterProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamWriterProvider.java?rev=1453798&r1=1453797&r2=1453798&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamWriterProvider.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/XmlStreamWriterProvider.java
Thu Mar  7 12:10:31 2013
@@ -18,26 +18,30 @@
  */
 package org.apache.cxf.systest.jaxrs;
 
+import java.io.IOException;
 import java.io.OutputStream;
 
-import javax.ws.rs.core.Response;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.cxf.jaxrs.ext.ResponseHandler;
 import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.staxutils.StaxUtils;
 
-public class XmlStreamWriterProvider implements ResponseHandler {
+public class XmlStreamWriterProvider implements ContainerResponseFilter {
 
-    public Response handleResponse(Message m, OperationResourceInfo ori, Response response)
{
+    public void filter(ContainerRequestContext reqC, ContainerResponseContext respC) throws
IOException {
+        Message m = JAXRSUtils.getCurrentMessage();
+        OperationResourceInfo ori = m.getExchange().get(OperationResourceInfo.class);
         String method = ori.getHttpMethod();
         if ("PUT".equals(method)) {
             XMLStreamWriter writer = 
                 StaxUtils.createXMLStreamWriter(m.getContent(OutputStream.class));
             m.setContent(XMLStreamWriter.class, new CustomXmlStreamWriter(writer));
         }
-        return null;
     }
 
 }



Mime
View raw message