incubator-wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ngalla...@apache.org
Subject svn commit: r787553 [11/34] - in /incubator/wink/contrib/ibm-jaxrs/tests: ./ fvt/ fvt/demo/ fvt/demo/jaxrs/ fvt/demo/jaxrs/cache/ fvt/demo/jaxrs/cache/server/ fvt/demo/jaxrs/cache/test/ fvt/demo/jaxrs/datasource/ fvt/demo/jaxrs/datasource/server/ fvt/d...
Date Tue, 23 Jun 2009 05:38:19 GMT
Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextBeanResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextBeanResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextBeanResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextBeanResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import jaxrs.tests.context.securitycontext.server.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/bean")
+public class SecurityContextBeanResource {
+
+    private SecurityContext s = null;
+
+    @GET
+    public SecurityContextInfo requestSecurityInfo() {
+        return SecurityContextUtils.securityContextToJSON(s);
+    }
+
+    @Context
+    public void setSecurityInfo(SecurityContext secContext) {
+        this.s = secContext;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextConstructorResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextConstructorResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextConstructorResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextConstructorResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import jaxrs.tests.context.securitycontext.server.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/constructor")
+public class SecurityContextConstructorResource {
+
+    final private SecurityContext secContext;
+
+    public SecurityContextConstructorResource(@Context SecurityContext secContext) {
+        this.secContext = secContext;
+    }
+
+    @GET
+    public SecurityContextInfo requestSecurityInfo() {
+        return SecurityContextUtils.securityContextToJSON(secContext);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextFieldResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextFieldResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextFieldResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextFieldResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import jaxrs.tests.context.securitycontext.server.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/field")
+public class SecurityContextFieldResource {
+
+    @Context
+    private SecurityContext s = null;
+
+    @GET
+    public SecurityContextInfo requestSecurityInfo() {
+        return SecurityContextUtils.securityContextToJSON(s);
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextNotBeanMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextNotBeanMethodResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextNotBeanMethodResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextNotBeanMethodResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.SecurityContext;
+
+@Path("/context/securitycontext/notbeanmethod")
+public class SecurityContextNotBeanMethodResource {
+
+    private SecurityContext s = null;
+
+    @GET
+    public Response requestSecurityInfo() {
+        if (s == null) {
+            return Response.ok("false").build();
+        }
+        return Response.ok(SecurityContextUtils.securityContextToJSON(s))
+                .build();
+    }
+
+    @Context
+    public void injectSecurityContext(SecurityContext secContext) {
+        /*
+         * this method does not start with "set" as its name so it is not
+         * expected to be injected.
+         */
+        this.s = secContext;
+    }
+
+    public void setSecurityContext(SecurityContext secContext) {
+        /*
+         * this method does not have a @Context annotation so it is not expected
+         * to be injected.
+         */
+        this.s = secContext;
+    }
+
+    @Context
+    public void setSecurityContext(SecurityContext secContext, SecurityContext secContext2) {
+        /*
+         * this method is not a Java bean method (it has 2 parameters) so it
+         * will not be used for injection
+         */
+        this.s = secContext;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextParamResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextParamResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextParamResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.SecurityContext;
+
+import jaxrs.tests.context.securitycontext.server.xml.SecurityContextInfo;
+
+@Path("/context/securitycontext/param")
+public class SecurityContextParamResource {
+
+    public SecurityContextParamResource() {
+        /* do nothing */
+    }
+
+    @GET
+    public SecurityContextInfo fetchSecurityInfo(@Context SecurityContext secContext) {
+        return SecurityContextUtils.securityContextToJSON(secContext);
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextUtils.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextUtils.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/SecurityContextUtils.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server;
+
+import javax.ws.rs.core.SecurityContext;
+
+import jaxrs.tests.context.securitycontext.server.xml.SecurityContextInfo;
+
+final public class SecurityContextUtils {
+
+    public static SecurityContextInfo securityContextToJSON(SecurityContext secContext) {
+        if (secContext == null) {
+            return null;
+        }
+        SecurityContextInfo secInfo = new SecurityContextInfo();
+        secInfo.setAuthScheme(secContext.getAuthenticationScheme());
+        secInfo.setUserPrincipal(secContext.getUserPrincipal() == null ? "null"
+                : secContext.getUserPrincipal().getName());
+        secInfo.setSecure(secContext.isSecure());
+        secInfo.setUserInRoleAdmin(secContext.isUserInRole("admin"));
+        secInfo.setUserInRoleNull(secContext.isUserInRole(null));
+        secInfo.setUserInRoleUser(secContext.isUserInRole("user"));
+        return secInfo;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/ObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/ObjectFactory.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/ObjectFactory.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/ObjectFactory.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server.xml;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+/**
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+    public SecurityContextInfo createSecurityContextInfo() {
+        return new SecurityContextInfo();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/SecurityContextInfo.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/SecurityContextInfo.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/SecurityContextInfo.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/server/xml/SecurityContextInfo.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.server.xml;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class SecurityContextInfo {
+
+    private String authScheme;
+    private String userPrincipal;
+    private boolean isSecure;
+    private boolean isUserInRoleAdmin;
+    private boolean isUserInRoleNull;
+    private boolean isUserInRoleUser;
+
+    public String getAuthScheme() {
+        return authScheme;
+    }
+
+    public void setAuthScheme(String authScheme) {
+        this.authScheme = authScheme;
+    }
+
+    public String getUserPrincipal() {
+        return userPrincipal;
+    }
+
+    public void setUserPrincipal(String userPrincipal) {
+        this.userPrincipal = userPrincipal;
+    }
+
+    public boolean isSecure() {
+        return isSecure;
+    }
+
+    public void setSecure(boolean isSecure) {
+        this.isSecure = isSecure;
+    }
+
+    public boolean isUserInRoleAdmin() {
+        return isUserInRoleAdmin;
+    }
+
+    public void setUserInRoleAdmin(boolean isUserInRoleAdmin) {
+        this.isUserInRoleAdmin = isUserInRoleAdmin;
+    }
+
+    public boolean isUserInRoleNull() {
+        return isUserInRoleNull;
+    }
+
+    public void setUserInRoleNull(boolean isUserInRoleNull) {
+        this.isUserInRoleNull = isUserInRoleNull;
+    }
+
+    public boolean isUserInRoleUser() {
+        return isUserInRoleUser;
+    }
+
+    public void setUserInRoleUser(boolean isUserInRoleUser) {
+        this.isUserInRoleUser = isUserInRoleUser;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/test/SecurityContextTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/test/SecurityContextTest.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/test/SecurityContextTest.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/securitycontext/test/SecurityContextTest.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,199 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.securitycontext.test;
+
+import java.io.IOException;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+
+import jaxrs.tests.context.securitycontext.server.xml.ObjectFactory;
+import jaxrs.tests.context.securitycontext.server.xml.SecurityContextInfo;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.GetMethod;
+
+import framework.defaults.test.FVTTestCase;
+
+public class SecurityContextTest extends FVTTestCase {
+
+    public static junit.framework.Test suite() {
+        return FVTTestCase.getTestSuite(SecurityContextTest.class,
+                "jaxrs.tests.context.securitycontext.server.Application");
+    }
+
+    /**
+     * Tests that a security context can be injected via a parameter.
+     *
+     * @throws IOException
+     * @throws HttpException
+     * @throws JAXBException 
+     */
+    public void testSecurityContextParamResource() throws HttpException,
+            IOException, JAXBException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/securitycontext/param");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+
+            JAXBContext context = JAXBContext.newInstance(ObjectFactory.class
+                    .getPackage().getName());
+            SecurityContextInfo secContextInfo = (SecurityContextInfo) context
+                    .createUnmarshaller().unmarshal(
+                            getMethod.getResponseBodyAsStream());
+            assertNotNull(secContextInfo);
+            assertEquals(false, secContextInfo.isSecure());
+            assertEquals(false, secContextInfo.isUserInRoleAdmin());
+            assertEquals(false, secContextInfo.isUserInRoleNull());
+            assertEquals(false, secContextInfo.isUserInRoleUser());
+            assertEquals("null", secContextInfo.getUserPrincipal());
+            assertNull(secContextInfo.getAuthScheme());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a security context can be injected via a constructor.
+     *
+     * @throws IOException
+     * @throws HttpException
+     * @throws JAXBException 
+     */
+    public void testSecurityContextConstructorResource() throws HttpException,
+            IOException, JAXBException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/securitycontext/constructor");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+
+            JAXBContext context = JAXBContext.newInstance(ObjectFactory.class
+                    .getPackage().getName());
+            SecurityContextInfo secContextInfo = (SecurityContextInfo) context
+                    .createUnmarshaller().unmarshal(
+                            getMethod.getResponseBodyAsStream());
+            assertNotNull(secContextInfo);
+            assertEquals(false, secContextInfo.isSecure());
+            assertEquals(false, secContextInfo.isUserInRoleAdmin());
+            assertEquals(false, secContextInfo.isUserInRoleNull());
+            assertEquals(false, secContextInfo.isUserInRoleUser());
+            assertEquals("null", secContextInfo.getUserPrincipal());
+            assertNull(secContextInfo.getAuthScheme());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a security context can be injected via a bean method.
+     *
+     * @throws IOException
+     * @throws HttpException
+     * @throws JAXBException 
+     */
+    public void testSecurityContextBeanResource() throws HttpException,
+            IOException, JAXBException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/securitycontext/bean");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+
+            JAXBContext context = JAXBContext.newInstance(ObjectFactory.class
+                    .getPackage().getName());
+            SecurityContextInfo secContextInfo = (SecurityContextInfo) context
+                    .createUnmarshaller().unmarshal(
+                            getMethod.getResponseBodyAsStream());
+            assertNotNull(secContextInfo);
+            assertEquals(false, secContextInfo.isSecure());
+            assertEquals(false, secContextInfo.isUserInRoleAdmin());
+            assertEquals(false, secContextInfo.isUserInRoleNull());
+            assertEquals(false, secContextInfo.isUserInRoleUser());
+            assertEquals("null", secContextInfo.getUserPrincipal());
+            assertNull(secContextInfo.getAuthScheme());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a security context will not be injected into non-bean methods.
+     *
+     * @throws IOException
+     * @throws HttpException
+     */
+    public void testSecurityContextNotBeanResource() throws HttpException,
+            IOException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/securitycontext/notbeanmethod");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+            assertEquals(getMethod.getResponseBodyAsString(), "false");
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+
+    /**
+     * Tests that a security context can be injected via a member field.
+     *
+     * @throws IOException
+     * @throws HttpException
+     * @throws JAXBException 
+     */
+    public void testSecurityContextFieldResource() throws HttpException,
+            IOException, JAXBException {
+        HttpClient client = new HttpClient();
+
+        GetMethod getMethod = new GetMethod(getBaseURI()
+                + "/context/securitycontext/field");
+        try {
+            client.executeMethod(getMethod);
+            assertEquals(200, getMethod.getStatusCode());
+
+            JAXBContext context = JAXBContext.newInstance(ObjectFactory.class
+                    .getPackage().getName());
+            SecurityContextInfo secContextInfo = (SecurityContextInfo) context
+                    .createUnmarshaller().unmarshal(
+                            getMethod.getResponseBodyAsStream());
+            assertNotNull(secContextInfo);
+            assertEquals(false, secContextInfo.isSecure());
+            assertEquals(false, secContextInfo.isUserInRoleAdmin());
+            assertEquals(false, secContextInfo.isUserInRoleNull());
+            assertEquals(false, secContextInfo.isUserInRoleUser());
+            assertEquals("null", secContextInfo.getUserPrincipal());
+            assertNull(secContextInfo.getAuthScheme());
+        } finally {
+            getMethod.releaseConnection();
+        }
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/buildTest.xml
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/buildTest.xml?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/buildTest.xml (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/buildTest.xml Tue Jun 23 05:37:57 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ 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.
+  -->
+
+<project name="jaxrs.tests.context.uriinfo" default="all">
+	<import file="../../../../buildCommon.xml" />
+</project>

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/Application.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/Application.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/Application.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/Application.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class Application extends javax.ws.rs.core.Application {
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        Set<Class<?>> clazzes = new HashSet<Class<?>>();
+        clazzes.add(UriInfoBeanResource.class);
+        clazzes.add(UriInfoConstructorResource.class);
+        clazzes.add(UriInfoDetailedMethods.class);
+        clazzes.add(UriInfoFieldResource.class);
+        clazzes.add(UriInfoNotBeanMethodResource.class);
+        clazzes.add(UriInfoParamResource.class);
+        clazzes.add(UriInfoResource.class);
+        return clazzes;
+    }
+
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedResourcesSubResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedResourcesSubResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedResourcesSubResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedResourcesSubResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+public class MatchedResourcesSubResource {
+
+    private String resourceClassNames;
+
+    private UriInfo uriInfo;
+
+    public MatchedResourcesSubResource(String resourceClassNames, UriInfo uriInfo) {
+        this.resourceClassNames = resourceClassNames;
+        this.uriInfo = uriInfo;
+    }
+
+    @GET
+    public Response getUriMatchedResourcesInfo() {
+        List<Object> matchedResources = uriInfo.getMatchedResources();
+        String subResourceClassNames = "";
+        for (Object o : matchedResources) {
+            Class<?> c = (Class<?>) o;
+            subResourceClassNames += c.getName() + ":";
+        }
+        return Response.ok(resourceClassNames + "-" + subResourceClassNames)
+                .build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedURIsSubResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedURIsSubResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedURIsSubResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/MatchedURIsSubResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+public class MatchedURIsSubResource {
+
+    private String matchedURIs;
+
+    private UriInfo uriInfo;
+
+    public MatchedURIsSubResource(String matchedURIs, UriInfo uriInfo) {
+        this.matchedURIs = matchedURIs;
+        this.uriInfo = uriInfo;
+    }
+
+    @GET
+    public Response getUriMatchedResourcesInfo() {
+        List<String> matchedURIsList = uriInfo.getMatchedURIs();
+        String retStr = "";
+        for (String s : matchedURIsList) {
+            retStr += s + ":";
+        }
+        return Response.ok(matchedURIs + "-" + retStr).build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoBeanResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoBeanResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoBeanResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoBeanResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/bean")
+public class UriInfoBeanResource {
+
+    private UriInfo uriInfo = null;
+
+    @GET
+    public Response requestUriInfo() {
+        if (uriInfo == null) {
+            return Response.serverError().build();
+        }
+        return Response.noContent().build();
+    }
+
+    @Context
+    public void setUri(UriInfo uriInfo) {
+        this.uriInfo = uriInfo;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoConstructorResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoConstructorResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoConstructorResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoConstructorResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/constructor")
+public class UriInfoConstructorResource {
+
+    final private UriInfo info;
+
+    public UriInfoConstructorResource(@Context UriInfo info) {
+        this.info = info;
+    }
+
+    @GET
+    public Response requestUriInfo() {
+        if (info == null) {
+            return Response.serverError().build();
+        }
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoDetailedMethods.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoDetailedMethods.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoDetailedMethods.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoDetailedMethods.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,332 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/detailed")
+public class UriInfoDetailedMethods {
+
+    @GET
+    public Response getUriInfo(@Context UriInfo uriInfo, @QueryParam("reqInfo") String requestInfo) {
+        if ("getAbsolutePath".equals(requestInfo)) {
+            return Response.ok(uriInfo.getAbsolutePath().toString()).build();
+        } else if ("getAbsolutePathBuilder".equals(requestInfo)) {
+            return Response.ok(
+                    uriInfo.getAbsolutePathBuilder().host("abcd").build(
+                            "unusedTemplateValue1").toString()).build();
+        } else if ("getBaseUri".equals(requestInfo)) {
+            return Response.ok(uriInfo.getBaseUri().toString()).build();
+        } else if ("getBaseUriBuilder".equals(requestInfo)) {
+            return Response.ok(
+                    uriInfo.getBaseUriBuilder().host("abcd").build(
+                            "unusedTemplateValue1").toString()).build();
+        } else if ("getPath".equals(requestInfo)) {
+            return Response.ok(uriInfo.getPath()).build();
+        } else if ("getPathDecodedTrue".equals(requestInfo)) {
+            return Response.ok(uriInfo.getPath(true)).build();
+        } else if ("getPathDecodedFalse".equals(requestInfo)) {
+            return Response.ok(uriInfo.getPath(false)).build();
+        } else if ("getMatchedResources".equals(requestInfo)) {
+            List<Object> matchedResources = uriInfo.getMatchedResources();
+            String resourceClassNames = "";
+            for (Object o : matchedResources) {
+                Class<?> c = (Class<?>) o;
+                resourceClassNames += c.getName() + ":";
+            }
+            return Response.ok(resourceClassNames).build();
+            /*
+             * check if this should be the actual instances or just the classes
+             */
+        } else if ("getMatchedURIs".equals(requestInfo)) {
+            List<String> matchedURIs = uriInfo.getMatchedURIs();
+            String retStr = "";
+            for (String s : matchedURIs) {
+                retStr += s + ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getMatchedURIsDecodedTrue".equals(requestInfo)) {
+            List<String> matchedURIs = uriInfo.getMatchedURIs(true);
+            String retStr = "";
+            for (String s : matchedURIs) {
+                retStr += s + ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getMatchedURIsDecodedFalse".equals(requestInfo)) {
+            List<String> matchedURIs = uriInfo.getMatchedURIs(false);
+            String retStr = "";
+            for (String s : matchedURIs) {
+                retStr += s + ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathParameters".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo.getPathParameters();
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            /*
+             * may want to test for {test}/{test}
+             */
+            String retStr = "";
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathParametersDecodedTrue".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo
+                    .getPathParameters(true);
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            /*
+             * may want to test for {test}/{test}
+             */
+            String retStr = "";
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathParametersDecodedFalse".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo
+                    .getPathParameters(false);
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            /*
+             * may want to test for {test}/{test}
+             */
+            String retStr = "";
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathSegments".equals(requestInfo)) {
+            List<PathSegment> params = uriInfo.getPathSegments();
+            String retStr = "";
+            for (PathSegment p : params) {
+                retStr += p.getPath() + "#";
+                MultivaluedMap<String, String> matrixParams = p
+                        .getMatrixParameters();
+
+                List<String> keys = new ArrayList<String>(matrixParams.keySet());
+                Collections.sort(keys);
+                for (String k : keys) {
+                    retStr += k + "=";
+                    List<String> values = matrixParams.get(k);
+                    for (String v : values) {
+                        retStr += v + ":";
+                    }
+                }
+                retStr += ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getPathSegmentsDecodedFalse".equals(requestInfo)) {
+            List<PathSegment> params = uriInfo.getPathSegments(false);
+            String retStr = "";
+            for (PathSegment p : params) {
+                retStr += p.getPath() + "#";
+                MultivaluedMap<String, String> matrixParams = p
+                        .getMatrixParameters();
+
+                List<String> keys = new ArrayList<String>(matrixParams.keySet());
+                Collections.sort(keys);
+                for (String k : keys) {
+                    retStr += k + "=";
+                    List<String> values = matrixParams.get(k);
+                    for (String v : values) {
+                        retStr += v + ":";
+                    }
+                }
+                retStr += ":";
+            }
+            return Response.ok(retStr).build();
+        } else if ("getQueryParameters".equals(requestInfo)) {
+            MultivaluedMap<String, String> params = uriInfo
+                    .getQueryParameters();
+            String retStr = "";
+            List<String> keys = new ArrayList<String>(params.keySet());
+            Collections.sort(keys);
+            for (String k : keys) {
+                retStr += k + "=";
+
+                List<String> values = params.get(k);
+                for (String v : values) {
+                    retStr += v + ":";
+                }
+            }
+            return Response.ok(retStr).build();
+        } else if ("getRequestUri".equals(requestInfo)) {
+            return Response.ok(uriInfo.getRequestUri().toString()).build();
+        } else if ("getRequestUriBuilder".equals(requestInfo)) {
+            return Response.ok(
+                    uriInfo.getRequestUriBuilder().host("abcd").build(
+                            "unusedTemplateValue1").toString()).build();
+        }
+
+        return Response.serverError().build();
+    }
+
+    @Path("decoded/{path}")
+    @GET
+    public Response getUriInfoPathDecoded(@Context UriInfo uriInfo, @QueryParam("decoded") boolean decoded, @PathParam("path") String path) {
+        return Response.ok(uriInfo.getPath(decoded)).build();
+    }
+
+    @Path("pathparamsone{p1:.*}")
+    @GET
+    public Response getUriInfoPathParametersOne(@Context UriInfo uriInfo, @QueryParam("decoded") Boolean decoded, @PathParam("p1") String path) {
+        MultivaluedMap<String, String> params = null;
+        if (decoded == null) {
+            params = uriInfo.getPathParameters();
+        } else if (decoded == true) {
+            params = uriInfo.getPathParameters(true);
+        } else if (decoded == false) {
+            params = uriInfo.getPathParameters(false);
+        }
+        List<String> keys = new ArrayList<String>(params.keySet());
+        Collections.sort(keys);
+        /*
+         * may want to test for {test}/{test}
+         */
+        String retStr = "";
+        for (String k : keys) {
+            retStr += k + "=";
+
+            List<String> values = params.get(k);
+            for (String v : values) {
+                retStr += v + ":";
+            }
+        }
+        return Response.ok(retStr).build();
+    }
+
+    @Path("pathparamsmany/{p1}/{p2}{p3:.*}")
+    @GET
+    public Response getUriInfoPathParametersMany(@Context UriInfo uriInfo, @QueryParam("decoded") Boolean decoded, @PathParam("p1") String p1, @PathParam("p2") String p2, @PathParam("p3") String p3) {
+        MultivaluedMap<String, String> params = null;
+        if (decoded == null) {
+            params = uriInfo.getPathParameters();
+        } else if (decoded == true) {
+            params = uriInfo.getPathParameters(true);
+        } else if (decoded == false) {
+            params = uriInfo.getPathParameters(false);
+        }
+        List<String> keys = new ArrayList<String>(params.keySet());
+        Collections.sort(keys);
+        /*
+         * may want to test for {test}/{test}
+         */
+        String retStr = "";
+        for (String k : keys) {
+            retStr += k + "=";
+
+            List<String> values = params.get(k);
+            for (String v : values) {
+                retStr += v + ":";
+            }
+        }
+        return Response.ok(retStr).build();
+    }
+
+    @Path("matchedurisdecoded/{path}")
+    @GET
+    public Response getMatchedUrisDecoded(@Context UriInfo uriInfo, @QueryParam("decoded") Boolean decoded, @PathParam("path") String path) {
+        return Response.ok(uriInfo.getPath(decoded)).build();
+    }
+
+    @Path("absolutepathbuilder")
+    @GET
+    public Response getAbsoluteUriBuilder(@Context UriInfo uriInfo, @QueryParam("reqInfo") String requestInfo) {
+        if ("getAbsolutePath".equals(requestInfo)) {
+            return Response.ok(uriInfo.getAbsolutePath().toString()).build();
+        }
+        return Response.serverError().build();
+    }
+
+    @Path("matchedresources")
+    public MatchedResourcesSubResource getMatchedResourcesSubresource(@Context UriInfo uriInfo) {
+        List<Object> matchedResources = uriInfo.getMatchedResources();
+        String resourceClassNames = "";
+        for (Object o : matchedResources) {
+            Class<?> c = (Class<?>) o;
+            resourceClassNames += c.getName() + ":";
+        }
+        return new MatchedResourcesSubResource(resourceClassNames, uriInfo);
+    }
+
+    @Path("matcheduris")
+    public MatchedURIsSubResource getMatchedURIsSubresource(@Context UriInfo uriInfo) {
+        List<String> matchedURIs = uriInfo.getMatchedURIs();
+        String retStr = "";
+        for (String s : matchedURIs) {
+            retStr += s + ":";
+        }
+        return new MatchedURIsSubResource(retStr, uriInfo);
+    }
+
+    @Path("queryparams")
+    @GET
+    public Response getUriInfoQueryParameters(@Context UriInfo uriInfo, @QueryParam("decoded") Boolean decoded) {
+        MultivaluedMap<String, String> queryParams = null;
+        if (decoded == null) {
+            queryParams = uriInfo.getQueryParameters();
+        } else if (decoded == true) {
+            queryParams = uriInfo.getQueryParameters(true);
+        } else if (decoded == false) {
+            queryParams = uriInfo.getQueryParameters(false);
+        }
+        String retStr = "";
+        List<String> keys = new ArrayList<String>(queryParams.keySet());
+        Collections.sort(keys);
+        for (String k : keys) {
+            retStr += k + "=";
+
+            List<String> values = queryParams.get(k);
+            for (String v : values) {
+                retStr += v + ":";
+            }
+        }
+        return Response.ok(retStr).build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoFieldResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoFieldResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoFieldResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoFieldResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/field")
+public class UriInfoFieldResource {
+
+    @Context
+    private UriInfo uriInfo = null;
+
+    @GET
+    public Response requestUriInfo() {
+        if (uriInfo == null) {
+            return Response.serverError().build();
+        }
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoNotBeanMethodResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoNotBeanMethodResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoNotBeanMethodResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoNotBeanMethodResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/notbeanmethod")
+public class UriInfoNotBeanMethodResource {
+
+    private UriInfo u = null;
+
+    @GET
+    public Response requestSecurityInfo() {
+        if (u == null) {
+            return Response.noContent().build();
+        }
+        return Response.serverError().build();
+    }
+
+    @Context
+    public void injectSecurityContext(UriInfo u) {
+        /*
+         * this method does not start with "set" as its name so it is not
+         * expected to be injected.
+         */
+        this.u = u;
+    }
+
+    public void setSecurityContext(UriInfo u) {
+        /*
+         * this method does not have a @Context annotation so it is not expected
+         * to be injected.
+         */
+        this.u = u;
+    }
+
+    @Context
+    public void setSecurityContext(UriInfo u, UriInfo u2) {
+        /*
+         * this method is not a Java bean method (it has 2 parameters) so it
+         * will not be used for injection
+         */
+        this.u = u;
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoParamResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoParamResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoParamResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoParamResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+@Path("/context/uriinfo/param")
+public class UriInfoParamResource {
+
+    @GET
+    public Response getUriInfo(@Context UriInfo uriInfo) {
+        if (uriInfo == null) {
+            return Response.serverError().build();
+        }
+        return Response.noContent().build();
+    }
+}

Added: incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoResource.java?rev=787553&view=auto
==============================================================================
--- incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoResource.java (added)
+++ incubator/wink/contrib/ibm-jaxrs/tests/fvt/jaxrs/tests/context/uriinfo/server/UriInfoResource.java Tue Jun 23 05:37:57 2009
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package jaxrs.tests.context.uriinfo.server;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+
+@Path("uriinfo")
+public class UriInfoResource {
+
+    @Context
+    private UriInfo uriInfo;
+
+    @GET
+    public String getURIInfoPath(@QueryParam("info") String info) {
+        return getInfo(info);
+    }
+
+    @GET
+    @Path("sub")
+    public String getSubURIInfoPath(@QueryParam("info") String info) {
+        return getInfo(info);
+    }
+
+    private String getInfo(String info) {
+        if ("path".equals(info)) {
+            return uriInfo.getPath();
+        }
+        if ("host".equals(info)) {
+            return uriInfo.getBaseUri().getHost();
+        }
+        if ("protocol".equals(info)) {
+            return uriInfo.getBaseUri().getScheme();
+        }
+        if ("query".equals(info)) {
+            return uriInfo.getRequestUri().getQuery();
+        }
+        if ("rawquery".equals(info)) {
+            return uriInfo.getRequestUri().getRawQuery();
+        }
+        return null;
+    }
+
+}



Mime
View raw message