48 |
--------------------------------------------------------------------------------
/cdi-webapp/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/cdi-webapp/src/main/webapp/WEB-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/declarative-linking/src/main/java/org/glassfish/jersey/examples/linking/model/ItemModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.linking.model;
42 |
43 | /**
44 | * @author Mark Hadley
45 | * @author Gerard Davison (gerard.davison at oracle.com)
46 | */
47 | public class ItemModel {
48 | String name;
49 |
50 | public ItemModel(String name) {
51 | this.name = name;
52 | }
53 |
54 | public String getName() {
55 | return name;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/extended-wadl-webapp/src/main/resources/application-grammars.xml:
--------------------------------------------------------------------------------
1 |
2 |
43 |
44 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/extended-wadl-webapp/src/test/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | #
4 | # Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | #
6 | # The contents of this file are subject to the terms of either the GNU
7 | # General Public License Version 2 only ("GPL") or the Common Development
8 | # and Distribution License("CDDL") (collectively, the "License"). You
9 | # may not use this file except in compliance with the License. You can
10 | # obtain a copy of the License at
11 | # https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | # or LICENSE.txt. See the License for the specific
13 | # language governing permissions and limitations under the License.
14 | #
15 | # When distributing the software, include this License Header Notice in each
16 | # file and include the License file at LICENSE.txt.
17 | #
18 | # GPL Classpath Exception:
19 | # Oracle designates this particular file as subject to the "Classpath"
20 | # exception as provided by Oracle in the GPL Version 2 section of the License
21 | # file that accompanied this code.
22 | #
23 | # Modifications:
24 | # If applicable, add the following below the License Header, with the fields
25 | # enclosed by brackets [] replaced by your own identifying information:
26 | # "Portions Copyright [year] [name of copyright owner]"
27 | #
28 | # Contributor(s):
29 | # If you wish your version of this file to be governed by only the CDDL or
30 | # only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | # elects to include this software in this distribution under the [CDDL or GPL
32 | # Version 2] license." If you don't indicate a single choice of license, a
33 | # recipient has the option to distribute your version of this file under
34 | # either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | # its licensees as provided above. However, if you add GPL Version 2 code
36 | # and therefore, elected the GPL Version 2 license, then the option applies
37 | # only if the new code is made subject to such option by the copyright
38 | # holder.
39 | #
40 |
41 | log4j.rootCategory=DEBUG, stdout
42 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
43 | log4j.appender.stdout.layout.ConversionPattern=[%30.30c{1}] - %m%n
44 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
45 |
--------------------------------------------------------------------------------
/freemarker-webapp/src/main/resources/freemarker/hello-default-model.ftl:
--------------------------------------------------------------------------------
1 | <#--
2 |
3 | DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 |
5 | Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
6 |
7 | The contents of this file are subject to the terms of either the GNU
8 | General Public License Version 2 only ("GPL") or the Common Development
9 | and Distribution License("CDDL") (collectively, the "License"). You
10 | may not use this file except in compliance with the License. You can
11 | obtain a copy of the License at
12 | https://oss.oracle.com/licenses/CDDL+GPL-1.1
13 | or LICENSE.txt. See the License for the specific
14 | language governing permissions and limitations under the License.
15 |
16 | When distributing the software, include this License Header Notice in each
17 | file and include the License file at LICENSE.txt.
18 |
19 | GPL Classpath Exception:
20 | Oracle designates this particular file as subject to the "Classpath"
21 | exception as provided by Oracle in the GPL Version 2 section of the License
22 | file that accompanied this code.
23 |
24 | Modifications:
25 | If applicable, add the following below the License Header, with the fields
26 | enclosed by brackets [] replaced by your own identifying information:
27 | "Portions Copyright [year] [name of copyright owner]"
28 |
29 | Contributor(s):
30 | If you wish your version of this file to be governed by only the CDDL or
31 | only the GPL Version 2, indicate your decision by adding "[Contributor]
32 | elects to include this software in this distribution under the [CDDL or GPL
33 | Version 2] license." If you don't indicate a single choice of license, a
34 | recipient has the option to distribute your version of this file under
35 | either the CDDL, the GPL Version 2 or to extend the choice of license to
36 | its licensees as provided above. However, if you add GPL Version 2 code
37 | and therefore, elected the GPL Version 2 license, then the option applies
38 | only if the new code is made subject to such option by the copyright
39 | holder.
40 |
41 | -->
42 |
43 |
44 | Welcome!
45 |
46 |
47 |
48 |
Welcome ${model}!
49 |
50 |
51 |
--------------------------------------------------------------------------------
/freemarker-webapp/src/main/resources/freemarker/hello.ftl:
--------------------------------------------------------------------------------
1 | <#--
2 |
3 | DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4 |
5 | Copyright (c) 2011-2017 Oracle and/or its affiliates. All rights reserved.
6 |
7 | The contents of this file are subject to the terms of either the GNU
8 | General Public License Version 2 only ("GPL") or the Common Development
9 | and Distribution License("CDDL") (collectively, the "License"). You
10 | may not use this file except in compliance with the License. You can
11 | obtain a copy of the License at
12 | https://oss.oracle.com/licenses/CDDL+GPL-1.1
13 | or LICENSE.txt. See the License for the specific
14 | language governing permissions and limitations under the License.
15 |
16 | When distributing the software, include this License Header Notice in each
17 | file and include the License file at LICENSE.txt.
18 |
19 | GPL Classpath Exception:
20 | Oracle designates this particular file as subject to the "Classpath"
21 | exception as provided by Oracle in the GPL Version 2 section of the License
22 | file that accompanied this code.
23 |
24 | Modifications:
25 | If applicable, add the following below the License Header, with the fields
26 | enclosed by brackets [] replaced by your own identifying information:
27 | "Portions Copyright [year] [name of copyright owner]"
28 |
29 | Contributor(s):
30 | If you wish your version of this file to be governed by only the CDDL or
31 | only the GPL Version 2, indicate your decision by adding "[Contributor]
32 | elects to include this software in this distribution under the [CDDL or GPL
33 | Version 2] license." If you don't indicate a single choice of license, a
34 | recipient has the option to distribute your version of this file under
35 | either the CDDL, the GPL Version 2 or to extend the choice of license to
36 | its licensees as provided above. However, if you add GPL Version 2 code
37 | and therefore, elected the GPL Version 2 license, then the option applies
38 | only if the new code is made subject to such option by the copyright
39 | holder.
40 |
41 | -->
42 |
43 |
44 | Welcome!
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/groovy/src/main/groovy/org/glassfish/jersey/examples/groovy/GroovyResource.groovy:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.groovy
42 |
43 | import javax.ws.rs.GET;
44 | import javax.ws.rs.Path;
45 | import javax.ws.rs.Produces;
46 |
47 | /**
48 | * Example Groovy JAX-RS resource.
49 | */
50 | @Path("groovy")
51 | class GroovyResource {
52 | @Produces(["text/plain"]) @GET def show() {
53 | "groovy"
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/EnglishGoodbyeService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.hello.spring.annotations;
42 |
43 | import org.springframework.stereotype.Component;
44 |
45 | @Component
46 | public class EnglishGoodbyeService implements GoodbyeService {
47 |
48 | @Override
49 | public String goodbye(final String who) {
50 | return String.format("goodbye, %s!", who);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/GoodbyeService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.hello.spring.annotations;
42 |
43 | public interface GoodbyeService {
44 |
45 | String goodbye(String who);
46 | }
47 |
--------------------------------------------------------------------------------
/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/GreetingService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.hello.spring.annotations;
42 |
43 | import org.springframework.stereotype.Service;
44 |
45 | /**
46 | * Simple greeting service
47 | *
48 | * @author Geoffroy Warin (http://geowarin.github.io)
49 | */
50 | @Service
51 | public class GreetingService {
52 | public String greet(String who) {
53 | return String.format("hello, %s!", who);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/helloworld-spring-annotations/src/main/java/org/glassfish/jersey/examples/hello/spring/annotations/NorwegianGoodbyeService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.hello.spring.annotations;
42 |
43 | import org.springframework.stereotype.Component;
44 |
45 | @Component
46 | public class NorwegianGoodbyeService implements GoodbyeService {
47 |
48 | @Override
49 | public String goodbye(final String who) {
50 | return String.format("hadet, %s!", who);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/helloworld-spring-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/spring/GreetingService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.helloworld.spring;
42 |
43 | /**
44 | * Simple greeting service.
45 | *
46 | * @author Marko Asplund (marko.asplund at oracle.com)
47 | */
48 | public interface GreetingService {
49 |
50 | /**
51 | * Workout a greeting.
52 | *
53 | * @param who to greet.
54 | * @return greeting.
55 | */
56 | String greet(String who);
57 | }
58 |
--------------------------------------------------------------------------------
/helloworld-webapp/src/main/java/org/glassfish/jersey/examples/helloworld/webapp/HelloWorldResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.helloworld.webapp;
42 |
43 | import javax.ws.rs.GET;
44 | import javax.ws.rs.Path;
45 | import javax.ws.rs.Produces;
46 |
47 | /**
48 | * @author Pavel Bucek (pavel.bucek at oracle.com)
49 | */
50 | @Path("helloworld")
51 | public class HelloWorldResource {
52 |
53 | @GET
54 | @Produces("text/plain")
55 | public String getHello() {
56 | return "Hello World!";
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/helloworld-weld/src/main/resources/META-INF/beans.xml:
--------------------------------------------------------------------------------
1 |
2 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/https-clientserver-grizzly/client.cert:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDJTCCAuOgAwIBAgIET5ZyYjALBgcqhkjOOAQDBQAwdjELMAkGA1UEBhMCQ1oxFzAVBgNVBAgT
3 | DkN6ZWNoIFJlcHVibGljMQ8wDQYDVQQHEwZQcmFndWUxGzAZBgNVBAoTEk9yYWNsZSBDb3Jwb3Jh
4 | dGlvbjEPMA0GA1UECxMGSmVyc2V5MQ8wDQYDVQQDEwZDbGllbnQwHhcNMTIwNDI0MDkyOTA2WhcN
5 | MTIwNzIzMDkyOTA2WjB2MQswCQYDVQQGEwJDWjEXMBUGA1UECBMOQ3plY2ggUmVwdWJsaWMxDzAN
6 | BgNVBAcTBlByYWd1ZTEbMBkGA1UEChMST3JhY2xlIENvcnBvcmF0aW9uMQ8wDQYDVQQLEwZKZXJz
7 | ZXkxDzANBgNVBAMTBkNsaWVudDCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQD9f1OBHXUSKVLfSpwu
8 | 7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSf
9 | n+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgB
10 | xwIVAJdgUI8VIwvMspK5gqLrhAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrqgvlXTAs9
11 | B4JnUVlXjrrUWU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6
12 | ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GEAAKBgBmHNACDk1aw
13 | vUZjsRecMSBlkkCSqr/cCrYOsNwpfleQKsM6rdOofujANUVeoUFhX8e8K45FknxEqAugmhGQ9NRn
14 | uMenrvV+XupC0V2uGH0OciXeAzHbfeItBCbmJcvMdPW/q+I2vFchv6+ajEiNHogBrCc3qwSMhyVQ
15 | ug2fXHmJMAsGByqGSM44BAMFAAMvADAsAhQYznYmH0hrcLni4EqX3Ovac+pNJgIUehnEaW1V5djn
16 | dhYBAYUkSycETl4=
17 | -----END CERTIFICATE-----
18 |
--------------------------------------------------------------------------------
/https-clientserver-grizzly/keystore_client:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/jersey-tutorial/ab3c070fba68a09fa4f4eceb49e9b8795f07c685/https-clientserver-grizzly/keystore_client
--------------------------------------------------------------------------------
/https-clientserver-grizzly/keystore_server:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/jersey-tutorial/ab3c070fba68a09fa4f4eceb49e9b8795f07c685/https-clientserver-grizzly/keystore_server
--------------------------------------------------------------------------------
/https-clientserver-grizzly/server.cert:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDKzCCAumgAwIBAgIET5ZyzjALBgcqhkjOOAQDBQAweTELMAkGA1UEBhMCQ1oxFzAVBgNVBAgT
3 | DkN6ZWNoIFJlcHVibGljMQ8wDQYDVQQHEwZQcmFndWUxGzAZBgNVBAoTEk9yYWNsZSBDb3Jwb3Jh
4 | dGlvbjEPMA0GA1UECxMGSmVyc2V5MRIwEAYDVQQDEwlsb2NhbGhvc3QwHhcNMTIwNDI0MDkzMDU0
5 | WhcNMTIwNzIzMDkzMDU0WjB5MQswCQYDVQQGEwJDWjEXMBUGA1UECBMOQ3plY2ggUmVwdWJsaWMx
6 | DzANBgNVBAcTBlByYWd1ZTEbMBkGA1UEChMST3JhY2xlIENvcnBvcmF0aW9uMQ8wDQYDVQQLEwZK
7 | ZXJzZXkxEjAQBgNVBAMTCWxvY2FsaG9zdDCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQD9f1OBHXUS
8 | KVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3
9 | a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/Ii
10 | Axmd0UgBxwIVAJdgUI8VIwvMspK5gqLrhAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrq
11 | gvlXTAs9B4JnUVlXjrrUWU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1
12 | kW6jfwv6ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GEAAKBgGIs
13 | VTo7dODp6iOyHFL+mkOVlOloZcymyWlHUZXzKqrvAi5jISptZZM+AoJcUUlUWEO9uwVTvX0MCk+4
14 | viwlPwt+XhaPM0kqfFcx1IS07BAx7z9cXREfYQpoFSsFW7pUs6cdvu0rjj8Ip6BnHALxQDgaBk40
15 | zXM39kB9LdGBt4uDMAsGByqGSM44BAMFAAMvADAsAhQE4QoQP4xPibjnozo8x5ORJqBuCAIUTkLQ
16 | 2udZ2DeknwPYXp/zMkYXLN4=
17 | -----END CERTIFICATE-----
18 |
--------------------------------------------------------------------------------
/https-clientserver-grizzly/truststore_client:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/jersey-tutorial/ab3c070fba68a09fa4f4eceb49e9b8795f07c685/https-clientserver-grizzly/truststore_client
--------------------------------------------------------------------------------
/https-clientserver-grizzly/truststore_server:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/jersey-tutorial/ab3c070fba68a09fa4f4eceb49e9b8795f07c685/https-clientserver-grizzly/truststore_server
--------------------------------------------------------------------------------
/jersey-crud-example/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/jersey-crud-example/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | jersey-crud-example
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.wst.common.project.facet.core.builder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 | org.eclipse.wst.validation.validationbuilder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.jem.workbench.JavaEMFNature
31 | org.eclipse.wst.common.modulecore.ModuleCoreNature
32 | org.eclipse.jdt.core.javanature
33 | org.eclipse.m2e.core.maven2Nature
34 | org.eclipse.wst.common.project.facet.core.nature
35 | org.eclipse.wst.jsdt.core.jsNature
36 |
37 |
38 |
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.8
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13 | org.eclipse.jdt.core.compiler.source=1.8
14 |
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/org.eclipse.wst.common.component:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/jersey-crud-example/.settings/org.eclipse.wst.validation.prefs:
--------------------------------------------------------------------------------
1 | disabled=06target
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/config/AppResourceConfig.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.config;
2 |
3 | import java.util.logging.Level;
4 | import java.util.logging.Logger;
5 |
6 | import javax.ws.rs.ApplicationPath;
7 |
8 | import org.glassfish.jersey.logging.LoggingFeature;
9 | // Deployment of a JAX-RS application using @ApplicationPath with Servlet 3.0
10 | // Descriptor-less deployment
11 | import org.glassfish.jersey.server.ResourceConfig;
12 |
13 | @ApplicationPath("/api")
14 | public class AppResourceConfig extends ResourceConfig {
15 |
16 | public AppResourceConfig() {
17 | // if there are more than two packanges then separate them with semicolon
18 | // exmaple : packages("org.foo.rest;org.bar.rest");
19 | packages("com.javadevelopersguide.jersey.resources");
20 | register(new LoggingFeature(Logger.getLogger(LoggingFeature.DEFAULT_LOGGER_NAME), Level.INFO, LoggingFeature.Verbosity.PAYLOAD_ANY, 10000));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/exception/ApiException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.javadevelopersguide.jersey.exception;
18 |
19 | public class ApiException extends Exception{
20 | private int code;
21 | public ApiException (int code, String msg) {
22 | super(msg);
23 | this.code = code;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/exception/BadRequestException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.javadevelopersguide.jersey.exception;
18 |
19 | public class BadRequestException extends ApiException{
20 | private int code;
21 | public BadRequestException (int code, String msg) {
22 | super(code, msg);
23 | this.code = code;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/exception/NotFoundException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.javadevelopersguide.jersey.exception;
18 |
19 | public class NotFoundException extends ApiException {
20 | private int code;
21 | public NotFoundException (int code, String msg) {
22 | super(code, msg);
23 | this.code = code;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/exception/ResourceNotFoundException.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.exception;
2 |
3 | public class ResourceNotFoundException extends Exception{
4 | /**
5 | *
6 | */
7 | private static final long serialVersionUID = 1L;
8 |
9 | public ResourceNotFoundException(String message){
10 | super(message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/model/APIResponse.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.model;
2 |
3 | import javax.xml.bind.annotation.XmlRootElement;
4 |
5 | @XmlRootElement
6 | public class APIResponse {
7 | private int errorCode;
8 | private String message;
9 |
10 | public APIResponse(){
11 |
12 | }
13 |
14 | public APIResponse(int errorCode, String message) {
15 | super();
16 | this.errorCode = errorCode;
17 | this.message = message;
18 | }
19 |
20 | public int getErrorCode() {
21 | return errorCode;
22 | }
23 |
24 | public void setErrorCode(int errorCode) {
25 | this.errorCode = errorCode;
26 | }
27 |
28 | public String getMessage() {
29 | return message;
30 | }
31 |
32 | public void setMessage(String message) {
33 | this.message = message;
34 | }
35 |
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/model/User.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.model;
2 |
3 | import javax.xml.bind.annotation.XmlRootElement;
4 |
5 | @XmlRootElement
6 | public class User {
7 | private long id;
8 | private String name;
9 | private String email;
10 |
11 | public User() {
12 |
13 | }
14 |
15 |
16 | public User(long id, String name, String email) {
17 | super();
18 | this.id = id;
19 | this.name = name;
20 | this.email = email;
21 | }
22 | public long getId() {
23 | return id;
24 | }
25 | public void setId(long id) {
26 | this.id = id;
27 | }
28 | public String getName() {
29 | return name;
30 | }
31 | public void setName(String name) {
32 | this.name = name;
33 | }
34 | public String getEmail() {
35 | return email;
36 | }
37 | public void setEmail(String email) {
38 | this.email = email;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/resources/CustomExceptionMapper.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.resources;
2 |
3 | import java.util.HashMap;
4 |
5 | import javax.ws.rs.NotFoundException;
6 | import javax.ws.rs.core.Response;
7 | import javax.ws.rs.core.Response.Status;
8 | import javax.ws.rs.ext.ExceptionMapper;
9 | import javax.ws.rs.ext.Provider;
10 |
11 | import com.javadevelopersguide.jersey.exception.BadRequestException;
12 | import com.javadevelopersguide.jersey.exception.ResourceNotFoundException;
13 | import com.javadevelopersguide.jersey.model.APIResponse;
14 |
15 | @Provider
16 | public class CustomExceptionMapper {
17 |
18 | // -- Exception Mappers
19 | @Provider
20 | public static class ResourceNotFoundExceptionMapper implements ExceptionMapper {
21 |
22 | @Override
23 | public Response toResponse(ResourceNotFoundException exception) {
24 | return Response
25 | .status(Status.NOT_FOUND)
26 | .entity(new HashMap<>().put(Status.INTERNAL_SERVER_ERROR, exception.getMessage())).build();
27 | }
28 | }
29 |
30 | @Provider
31 | public static class BadRequestExceptionMapper implements ExceptionMapper {
32 |
33 | @Override
34 | public Response toResponse(BadRequestException exception) {
35 | return Response.status(Response.Status.BAD_REQUEST).entity(
36 | "Code:" + Response.Status.BAD_REQUEST + ":" + exception.getMessage()).build();
37 | }
38 | }
39 |
40 | @Provider
41 | public static class NotFoundExceptionMapper implements ExceptionMapper {
42 |
43 | @Override
44 | public Response toResponse(NotFoundException exception) {
45 | Response r = exception.getResponse();
46 | return Response.status(r.getStatus()).entity(
47 | new APIResponse(r.getStatus(),exception.getMessage())).build();
48 | }
49 | }
50 |
51 | }
52 |
53 |
54 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/java/com/javadevelopersguide/jersey/services/UserService.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.services;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import javax.ws.rs.NotFoundException;
7 |
8 | import com.javadevelopersguide.jersey.model.User;
9 |
10 | public class UserService {
11 |
12 | private List users = new ArrayList();
13 |
14 | public List fetchAll() {
15 |
16 | users.add(new User(100, "A", "demo@gmail.com"));
17 | users.add(new User(101, "B", "demo1@gmail.com"));
18 | users.add(new User(102, "C", "demo2@gmail.com"));
19 | return users;
20 | }
21 |
22 | public User fetchBy(long id) throws NotFoundException {
23 | for (User user2 : fetchAll()) {
24 | if (id == user2.getId()) {
25 | return user2;
26 | }else{
27 | throw new NotFoundException("Resource not found with Id :: " + id);
28 | }
29 | }
30 | return null;
31 | }
32 |
33 | public void create(User user) {
34 | users.add(user);
35 | }
36 |
37 | public void update(User user) {
38 | for (User user2 : users) {
39 | if (user.getId() == user2.getId()) {
40 | users.remove(user2);
41 | users.add(user);
42 | }
43 | }
44 | }
45 |
46 | public void delete(long id) throws NotFoundException {
47 | // delete operation
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Archetype Created Web Application
7 |
8 |
--------------------------------------------------------------------------------
/jersey-crud-example/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Hello World!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/jersey-ejb/src/main/java/org/glassfish/jersey/examples/jersey_ejb/exceptions/CustomNotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.jersey_ejb.exceptions;
42 |
43 | /**
44 | * This exceptions will get mapped to a 404 response with the application exception mapper
45 | * implemented by {@link NotFoundExceptionMapper} class.
46 | *
47 | * @author Pavel Bucek (pavel.bucek at oracle.com)
48 | */
49 | public class CustomNotFoundException extends Exception {
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | jersey-exception-mapping-example
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.wst.common.project.facet.core.builder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 | org.eclipse.wst.validation.validationbuilder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.jem.workbench.JavaEMFNature
31 | org.eclipse.wst.common.modulecore.ModuleCoreNature
32 | org.eclipse.jdt.core.javanature
33 | org.eclipse.m2e.core.maven2Nature
34 | org.eclipse.wst.common.project.facet.core.nature
35 | org.eclipse.wst.jsdt.core.jsNature
36 |
37 |
38 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.8
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13 | org.eclipse.jdt.core.compiler.source=1.8
14 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/org.eclipse.wst.common.component:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/.settings/org.eclipse.wst.validation.prefs:
--------------------------------------------------------------------------------
1 | disabled=06target
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | com.javadevelopersguide.jersey
5 | jersey-exception-mapping-example
6 | war
7 | 0.0.1-SNAPSHOT
8 | jersey-exception-mapping-example Maven Webapp
9 | http://maven.apache.org
10 |
11 |
12 |
13 |
14 |
15 | javax.servlet
16 | javax.servlet-api
17 | 3.1.0
18 | provided
19 |
20 |
21 |
22 | org.glassfish.jersey.core
23 | jersey-server
24 | 2.7
25 |
26 |
27 | org.glassfish.jersey.containers
28 | jersey-container-servlet
29 | 2.7
30 |
31 |
32 |
33 | jersey-exception-mapping-example
34 |
35 |
36 | org.apache.maven.plugins
37 | maven-war-plugin
38 |
39 | false
40 |
41 |
42 |
43 | maven-compiler-plugin
44 | 2.0.2
45 |
46 | 1.8
47 | 1.8
48 |
49 |
50 |
51 | org.apache.tomcat.maven
52 | tomcat7-maven-plugin
53 | 2.2
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/config/JerseyServletContainerConfig.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.config;
2 |
3 | import javax.ws.rs.ApplicationPath;
4 |
5 | // Deployment of a JAX-RS application using @ApplicationPath with Servlet 3.0
6 | // Descriptor-less deployment
7 | import org.glassfish.jersey.server.ResourceConfig;
8 |
9 | @ApplicationPath("resources")
10 | public class JerseyServletContainerConfig extends ResourceConfig {
11 | public JerseyServletContainerConfig() {
12 |
13 | // if there are more than two packanges then separate them with semicolon
14 | // exmaple : packages("org.foo.rest;org.bar.rest");
15 | packages("com.javadevelopersguide.jersey.helloworld;com.javadevelopersguide.jersey.resources");
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/helloworld/HelloWorldResource.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.helloworld;
2 |
3 | import javax.ws.rs.GET;
4 | import javax.ws.rs.Path;
5 |
6 | @Path("/")
7 | public class HelloWorldResource {
8 |
9 | @GET
10 | @Path("helloworld")
11 | public String helloworld(){
12 | return "Helloworld !!!!";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/resources/ApiResponse.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.javadevelopersguide.jersey.resources;
18 |
19 | import javax.xml.bind.annotation.XmlTransient;
20 |
21 | @javax.xml.bind.annotation.XmlRootElement
22 | public class ApiResponse {
23 | public static final int ERROR = 1;
24 | public static final int WARNING = 2;
25 | public static final int INFO = 3;
26 | public static final int OK = 4;
27 | public static final int TOO_BUSY = 5;
28 |
29 | int code;
30 | String type;
31 | String message;
32 |
33 | public ApiResponse(){}
34 |
35 | public ApiResponse(int code, String message){
36 | this.code = code;
37 | switch(code){
38 | case ERROR:
39 | setType("error");
40 | break;
41 | case WARNING:
42 | setType("warning");
43 | break;
44 | case INFO:
45 | setType("info");
46 | break;
47 | case OK:
48 | setType("ok");
49 | break;
50 | case TOO_BUSY:
51 | setType("too busy");
52 | break;
53 | default:
54 | setType("unknown");
55 | break;
56 | }
57 | this.message = message;
58 | }
59 |
60 | @XmlTransient
61 | public int getCode() {
62 | return code;
63 | }
64 |
65 | public void setCode(int code) {
66 | this.code = code;
67 | }
68 |
69 | public String getType() {
70 | return type;
71 | }
72 |
73 | public void setType(String type) {
74 | this.type = type;
75 | }
76 |
77 | public String getMessage() {
78 | return message;
79 | }
80 |
81 | public void setMessage(String message) {
82 | this.message = message;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/resources/CustomExceptionMapper.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.resources;
2 |
3 | import javax.ws.rs.core.Response;
4 | import javax.ws.rs.core.Response.Status;
5 | import javax.ws.rs.ext.ExceptionMapper;
6 | import javax.ws.rs.ext.Provider;
7 |
8 | @Provider
9 | public class CustomExceptionMapper implements ExceptionMapper {
10 |
11 | @Override
12 | public Response toResponse(ResourceNotFoundException exception) {
13 | return Response
14 | .status(Status.NOT_FOUND)
15 | .entity(new ApiResponse(ApiResponse.ERROR, exception
16 | .getMessage())).build();
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/resources/CustomExceptionResource.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.resources;
2 |
3 | import javax.ws.rs.GET;
4 | import javax.ws.rs.Path;
5 | import javax.ws.rs.Produces;
6 | import javax.ws.rs.core.MediaType;
7 |
8 | import com.javadevelopersguide.jersey.resources.exception.BadRequestException;
9 |
10 | @Path("customexception/")
11 | public class CustomExceptionResource {
12 |
13 | @GET
14 | @Path("notfound")
15 | @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
16 | public String notfound() throws ResourceNotFoundException {
17 | throw new ResourceNotFoundException("Resource not found exception.");
18 | }
19 |
20 | @GET
21 | @Path("badrequest")
22 | @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
23 | public String badrequest() throws BadRequestException {
24 | throw new BadRequestException(400, "Bad Request Exception.");
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/resources/ResourceNotFoundException.java:
--------------------------------------------------------------------------------
1 | package com.javadevelopersguide.jersey.resources;
2 |
3 | public class ResourceNotFoundException extends Exception{
4 | /**
5 | *
6 | */
7 | private static final long serialVersionUID = 1L;
8 |
9 | public ResourceNotFoundException(String message){
10 | super(message);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/resources/exception/ApiException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.javadevelopersguide.jersey.resources.exception;
18 |
19 | public class ApiException extends Exception{
20 | private int code;
21 | public ApiException (int code, String msg) {
22 | super(msg);
23 | this.code = code;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/resources/exception/BadRequestException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.javadevelopersguide.jersey.resources.exception;
18 |
19 | public class BadRequestException extends ApiException{
20 | private int code;
21 | public BadRequestException (int code, String msg) {
22 | super(code, msg);
23 | this.code = code;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/java/com/javadevelopersguide/jersey/resources/exception/NotFoundException.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2016 SmartBear Software
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.javadevelopersguide.jersey.resources.exception;
18 |
19 | public class NotFoundException extends ApiException {
20 | private int code;
21 | public NotFoundException (int code, String msg) {
22 | super(code, msg);
23 | this.code = code;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Archetype Created Web Application
7 |
8 |
--------------------------------------------------------------------------------
/jersey-exception-mapping-example/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | jersey-jpa-bookmark-example
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.wst.common.project.facet.core.builder
15 |
16 |
17 |
18 |
19 | org.eclipse.m2e.core.maven2Builder
20 |
21 |
22 |
23 |
24 | org.eclipse.wst.validation.validationbuilder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.jem.workbench.JavaEMFNature
31 | org.eclipse.wst.common.modulecore.ModuleCoreNature
32 | org.eclipse.jdt.core.javanature
33 | org.eclipse.m2e.core.maven2Nature
34 | org.eclipse.wst.common.project.facet.core.nature
35 | org.eclipse.wst.jsdt.core.jsNature
36 |
37 |
38 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
4 | org.eclipse.jdt.core.compiler.compliance=1.5
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8 | org.eclipse.jdt.core.compiler.source=1.5
9 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/org.eclipse.wst.common.component:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/.settings/org.eclipse.wst.validation.prefs:
--------------------------------------------------------------------------------
1 | disabled=06target
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/src/main/java/com/javadevelopersguide/jersey/exception/ExtendedNotFoundException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package com.javadevelopersguide.jersey.exception;
42 |
43 | import javax.ws.rs.NotFoundException;
44 | import javax.ws.rs.core.Response;
45 |
46 | /**
47 | * @author Michal Gajdos
48 | */
49 | public class ExtendedNotFoundException extends NotFoundException {
50 |
51 | public ExtendedNotFoundException(final String message) {
52 | super(Response.status(Response.Status.NOT_FOUND).entity(message).build());
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/jersey-jpa-bookmark-example/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/json-jackson/src/main/assembly/src.xml:
--------------------------------------------------------------------------------
1 |
42 |
43 |
44 | project
45 |
46 | zip
47 |
48 |
49 |
50 | .
51 |
52 | true
53 |
54 | **/target/**
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/json-jackson/src/main/java/org/glassfish/jersey/examples/jackson/EmptyArrayBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.jackson;
42 |
43 | import javax.xml.bind.annotation.XmlRootElement;
44 |
45 | /**
46 | * TODO javadoc.
47 | *
48 | * @author Jakub Podlesak (jakub.podlesak at oracle.com)
49 | */
50 | @XmlRootElement
51 | public class EmptyArrayBean {
52 |
53 | public String[] emtpyArray = new String[0];
54 | }
55 |
--------------------------------------------------------------------------------
/json-jackson1/src/main/java/org/glassfish/jersey/examples/jackson1/EmptyArrayBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.jackson1;
42 |
43 | import javax.xml.bind.annotation.XmlRootElement;
44 |
45 | /**
46 | * @author Jakub Podlesak (jakub.podlesak at oracle.com)
47 | */
48 | @XmlRootElement
49 | public class EmptyArrayBean {
50 |
51 | public String[] emtpyArray = new String[0];
52 | }
53 |
--------------------------------------------------------------------------------
/json-with-padding/src/main/assembly/src.xml:
--------------------------------------------------------------------------------
1 |
42 |
43 |
44 | project
45 |
46 | zip
47 |
48 |
49 |
50 | .
51 |
52 | true
53 |
54 | **/target/**
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/managed-beans-webapp/src/main/java/org/glassfish/jersey/examples/managedbeans/resources/ManagedBeanException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.managedbeans.resources;
42 |
43 | /**
44 | * Exception to be thrown and mapped by the web application.
45 | *
46 | * @author Paul Sandoz
47 | */
48 | public class ManagedBeanException extends RuntimeException {
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/monitoring-webapp/src/main/java/org/glassfish/jersey/examples/monitoring/MyException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.monitoring;
42 |
43 | /**
44 | *
45 | * @author Miroslav Fuksa
46 | */
47 |
48 | public class MyException extends RuntimeException {
49 | public MyException(String message) {
50 | super(message);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/monitoring-webapp/src/main/java/org/glassfish/jersey/examples/monitoring/MyExceptionMapper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.monitoring;
42 |
43 | import javax.ws.rs.core.Response;
44 | import javax.ws.rs.ext.ExceptionMapper;
45 |
46 | /**
47 | *
48 | * @author Miroslav Fuksa
49 | */
50 |
51 | public class MyExceptionMapper implements ExceptionMapper {
52 |
53 | @Override
54 | public Response toResponse(MyException exception) {
55 | return Response.ok("mapped").build();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/multipart-webapp/src/main/java/org/glassfish/jersey/examples/multipart/webapp/Bean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.multipart.webapp;
42 |
43 | import javax.xml.bind.annotation.XmlRootElement;
44 |
45 | @XmlRootElement
46 | public class Bean {
47 |
48 | public String value;
49 |
50 | public Bean() {
51 | }
52 |
53 | public Bean(String str) {
54 | value = str;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/oauth2-client-google-webapp/src/main/java/org/glassfish/jersey/examples/oauth2/googleclient/model/TaskModel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.oauth2.googleclient.model;
42 |
43 | /**
44 | * Model (MVC) that contains one google task.
45 | *
46 | * @author Miroslav Fuksa
47 | */
48 | public class TaskModel {
49 | private final String title;
50 |
51 | public TaskModel(String title) {
52 | this.title = title;
53 | }
54 |
55 | public String getTitle() {
56 | return title;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/osgi-helloworld-webapp/functional-test/src/test/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | #
4 | # Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | #
6 | # The contents of this file are subject to the terms of either the GNU
7 | # General Public License Version 2 only ("GPL") or the Common Development
8 | # and Distribution License("CDDL") (collectively, the "License"). You
9 | # may not use this file except in compliance with the License. You can
10 | # obtain a copy of the License at
11 | # https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | # or LICENSE.txt. See the License for the specific
13 | # language governing permissions and limitations under the License.
14 | #
15 | # When distributing the software, include this License Header Notice in each
16 | # file and include the License file at LICENSE.txt.
17 | #
18 | # GPL Classpath Exception:
19 | # Oracle designates this particular file as subject to the "Classpath"
20 | # exception as provided by Oracle in the GPL Version 2 section of the License
21 | # file that accompanied this code.
22 | #
23 | # Modifications:
24 | # If applicable, add the following below the License Header, with the fields
25 | # enclosed by brackets [] replaced by your own identifying information:
26 | # "Portions Copyright [year] [name of copyright owner]"
27 | #
28 | # Contributor(s):
29 | # If you wish your version of this file to be governed by only the CDDL or
30 | # only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | # elects to include this software in this distribution under the [CDDL or GPL
32 | # Version 2] license." If you don't indicate a single choice of license, a
33 | # recipient has the option to distribute your version of this file under
34 | # either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | # its licensees as provided above. However, if you add GPL Version 2 code
36 | # and therefore, elected the GPL Version 2 license, then the option applies
37 | # only if the new code is made subject to such option by the copyright
38 | # holder.
39 | #
40 |
41 | log4j.rootCategory=ERROR, stdout
42 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
43 | log4j.appender.stdout.layout.ConversionPattern=[%30.30c{1}] - %m%n
44 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
45 |
--------------------------------------------------------------------------------
/osgi-helloworld-webapp/functional-test/src/test/resources/runtime.policy:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | grant {
42 | permission java.security.AllPermission;
43 | };
44 |
--------------------------------------------------------------------------------
/osgi-helloworld-webapp/lib-bundle/src/main/java/org/glassfish/jersey/examples/osgi/helloworld/resource/AnotherResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.osgi.helloworld.resource;
42 |
43 | import javax.ws.rs.GET;
44 | import javax.ws.rs.Path;
45 | import javax.ws.rs.Produces;
46 |
47 | @Path("/another")
48 | public class AnotherResource {
49 |
50 | @GET
51 | @Produces("text/plain")
52 | public String getAnotherMessage() {
53 | return "Another";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/osgi-helloworld-webapp/lib-bundle/src/main/java/org/glassfish/jersey/examples/osgi/helloworld/resource/HelloWorldResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.osgi.helloworld.resource;
42 |
43 | import javax.ws.rs.GET;
44 | import javax.ws.rs.Path;
45 | import javax.ws.rs.Produces;
46 |
47 | @Path("/helloworld")
48 | public class HelloWorldResource {
49 |
50 | @GET
51 | @Produces("text/plain")
52 | public String getClichedMessage() {
53 | return "Hello World";
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/osgi-http-service/bundle/src/main/java/org/glassfish/jersey/examples/osgihttpservice/StatusResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2010-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.osgihttpservice;
42 |
43 | import javax.ws.rs.GET;
44 | import javax.ws.rs.Path;
45 | import javax.ws.rs.Produces;
46 |
47 | /**
48 | * @author Jakub Podlesak (jakub.podlesak at oracle.com)
49 | */
50 | @Path("status")
51 | public class StatusResource {
52 |
53 | @GET
54 | @Produces("text/plain")
55 | public String getStatus() {
56 | return "active";
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/osgi-http-service/functional-test/src/test/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | #
4 | # Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | #
6 | # The contents of this file are subject to the terms of either the GNU
7 | # General Public License Version 2 only ("GPL") or the Common Development
8 | # and Distribution License("CDDL") (collectively, the "License"). You
9 | # may not use this file except in compliance with the License. You can
10 | # obtain a copy of the License at
11 | # https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | # or LICENSE.txt. See the License for the specific
13 | # language governing permissions and limitations under the License.
14 | #
15 | # When distributing the software, include this License Header Notice in each
16 | # file and include the License file at LICENSE.txt.
17 | #
18 | # GPL Classpath Exception:
19 | # Oracle designates this particular file as subject to the "Classpath"
20 | # exception as provided by Oracle in the GPL Version 2 section of the License
21 | # file that accompanied this code.
22 | #
23 | # Modifications:
24 | # If applicable, add the following below the License Header, with the fields
25 | # enclosed by brackets [] replaced by your own identifying information:
26 | # "Portions Copyright [year] [name of copyright owner]"
27 | #
28 | # Contributor(s):
29 | # If you wish your version of this file to be governed by only the CDDL or
30 | # only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | # elects to include this software in this distribution under the [CDDL or GPL
32 | # Version 2] license." If you don't indicate a single choice of license, a
33 | # recipient has the option to distribute your version of this file under
34 | # either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | # its licensees as provided above. However, if you add GPL Version 2 code
36 | # and therefore, elected the GPL Version 2 license, then the option applies
37 | # only if the new code is made subject to such option by the copyright
38 | # holder.
39 | #
40 |
41 | log4j.rootCategory=ERROR, stdout
42 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
43 | log4j.appender.stdout.layout.ConversionPattern=[%30.30c{1}] - %m%n
44 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
45 |
--------------------------------------------------------------------------------
/reload/resources:
--------------------------------------------------------------------------------
1 | org.glassfish.jersey.examples.reload.DeparturesResource
2 | org.glassfish.jersey.examples.reload.ArrivalsResource
3 | #org.glassfish.jersey.examples.reload.StatsResource
4 |
--------------------------------------------------------------------------------
/reload/src/main/java/org/glassfish/jersey/examples/reload/FlightsDB.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.reload;
42 |
43 | import java.util.concurrent.atomic.AtomicInteger;
44 |
45 | /**
46 | *
47 | * @author Jakub Podlesak (jakub.podlesak at oracle.com)
48 | */
49 | public class FlightsDB {
50 |
51 | static AtomicInteger departuresReqCount = new AtomicInteger();
52 | static AtomicInteger arrivalsReqCount = new AtomicInteger();
53 | }
54 |
--------------------------------------------------------------------------------
/shortener-webapp/src/main/resources/ValidationMessages.properties:
--------------------------------------------------------------------------------
1 | #
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | #
4 | # Copyright (c) 2013-2017 Oracle and/or its affiliates. All rights reserved.
5 | #
6 | # The contents of this file are subject to the terms of either the GNU
7 | # General Public License Version 2 only ("GPL") or the Common Development
8 | # and Distribution License("CDDL") (collectively, the "License"). You
9 | # may not use this file except in compliance with the License. You can
10 | # obtain a copy of the License at
11 | # https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | # or LICENSE.txt. See the License for the specific
13 | # language governing permissions and limitations under the License.
14 | #
15 | # When distributing the software, include this License Header Notice in each
16 | # file and include the License file at LICENSE.txt.
17 | #
18 | # GPL Classpath Exception:
19 | # Oracle designates this particular file as subject to the "Classpath"
20 | # exception as provided by Oracle in the GPL Version 2 section of the License
21 | # file that accompanied this code.
22 | #
23 | # Modifications:
24 | # If applicable, add the following below the License Header, with the fields
25 | # enclosed by brackets [] replaced by your own identifying information:
26 | # "Portions Copyright [year] [name of copyright owner]"
27 | #
28 | # Contributor(s):
29 | # If you wish your version of this file to be governed by only the CDDL or
30 | # only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | # elects to include this software in this distribution under the [CDDL or GPL
32 | # Version 2] license." If you don't indicate a single choice of license, a
33 | # recipient has the option to distribute your version of this file under
34 | # either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | # its licensees as provided above. However, if you add GPL Version 2 code
36 | # and therefore, elected the GPL Version 2 license, then the option applies
37 | # only if the new code is made subject to such option by the copyright
38 | # holder.
39 | #
40 |
41 | not.valid.shortened.link=Given identifier doesn't represent a valid shortened link:
42 | not.valid.url=Provided URL for shortening is not valid:
43 |
--------------------------------------------------------------------------------
/sse-twitter-aggregator/client.cert:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDJTCCAuOgAwIBAgIET5ZyYjALBgcqhkjOOAQDBQAwdjELMAkGA1UEBhMCQ1oxFzAVBgNVBAgT
3 | DkN6ZWNoIFJlcHVibGljMQ8wDQYDVQQHEwZQcmFndWUxGzAZBgNVBAoTEk9yYWNsZSBDb3Jwb3Jh
4 | dGlvbjEPMA0GA1UECxMGSmVyc2V5MQ8wDQYDVQQDEwZDbGllbnQwHhcNMTIwNDI0MDkyOTA2WhcN
5 | MTIwNzIzMDkyOTA2WjB2MQswCQYDVQQGEwJDWjEXMBUGA1UECBMOQ3plY2ggUmVwdWJsaWMxDzAN
6 | BgNVBAcTBlByYWd1ZTEbMBkGA1UEChMST3JhY2xlIENvcnBvcmF0aW9uMQ8wDQYDVQQLEwZKZXJz
7 | ZXkxDzANBgNVBAMTBkNsaWVudDCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQD9f1OBHXUSKVLfSpwu
8 | 7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2y5tVbNeBO4AdNG/yZmC3a5lQpaSf
9 | n+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgB
10 | xwIVAJdgUI8VIwvMspK5gqLrhAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrqgvlXTAs9
11 | B4JnUVlXjrrUWU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6
12 | ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GEAAKBgBmHNACDk1aw
13 | vUZjsRecMSBlkkCSqr/cCrYOsNwpfleQKsM6rdOofujANUVeoUFhX8e8K45FknxEqAugmhGQ9NRn
14 | uMenrvV+XupC0V2uGH0OciXeAzHbfeItBCbmJcvMdPW/q+I2vFchv6+ajEiNHogBrCc3qwSMhyVQ
15 | ug2fXHmJMAsGByqGSM44BAMFAAMvADAsAhQYznYmH0hrcLni4EqX3Ovac+pNJgIUehnEaW1V5djn
16 | dhYBAYUkSycETl4=
17 | -----END CERTIFICATE-----
18 |
--------------------------------------------------------------------------------
/sse-twitter-aggregator/keystore_client:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/jersey-tutorial/ab3c070fba68a09fa4f4eceb49e9b8795f07c685/sse-twitter-aggregator/keystore_client
--------------------------------------------------------------------------------
/sse-twitter-aggregator/src/main/java/org/glassfish/jersey/examples/aggregator/DataAggregator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | package org.glassfish.jersey.examples.aggregator;
42 |
43 | /**
44 | * Data aggregator for listening for events aggregated based on give keywords.
45 | *
46 | * @author Marek Potociar (marek.potociar at oracle.com)
47 | */
48 | public interface DataAggregator {
49 | void start(String keywords, DataListener msgListener);
50 |
51 | void stop();
52 | }
53 |
--------------------------------------------------------------------------------
/sse-twitter-aggregator/src/main/resources/webroot/css/main.css:
--------------------------------------------------------------------------------
1 | /*
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | *
4 | * Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | *
6 | * The contents of this file are subject to the terms of either the GNU
7 | * General Public License Version 2 only ("GPL") or the Common Development
8 | * and Distribution License("CDDL") (collectively, the "License"). You
9 | * may not use this file except in compliance with the License. You can
10 | * obtain a copy of the License at
11 | * https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | * or LICENSE.txt. See the License for the specific
13 | * language governing permissions and limitations under the License.
14 | *
15 | * When distributing the software, include this License Header Notice in each
16 | * file and include the License file at LICENSE.txt.
17 | *
18 | * GPL Classpath Exception:
19 | * Oracle designates this particular file as subject to the "Classpath"
20 | * exception as provided by Oracle in the GPL Version 2 section of the License
21 | * file that accompanied this code.
22 | *
23 | * Modifications:
24 | * If applicable, add the following below the License Header, with the fields
25 | * enclosed by brackets [] replaced by your own identifying information:
26 | * "Portions Copyright [year] [name of copyright owner]"
27 | *
28 | * Contributor(s):
29 | * If you wish your version of this file to be governed by only the CDDL or
30 | * only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | * elects to include this software in this distribution under the [CDDL or GPL
32 | * Version 2] license." If you don't indicate a single choice of license, a
33 | * recipient has the option to distribute your version of this file under
34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | * its licensees as provided above. However, if you add GPL Version 2 code
36 | * and therefore, elected the GPL Version 2 license, then the option applies
37 | * only if the new code is made subject to such option by the copyright
38 | * holder.
39 | */
40 |
41 | div.message {
42 | border: thick solid;
43 | border-radius: 10px;
44 | margin: 10px;
45 | width: 300px;
46 | padding: 10px;
47 | box-shadow: 5px 5px 5px #888888;
48 | font-family: Helvetica, serif;
49 | color: #444444;
50 | }
51 |
--------------------------------------------------------------------------------
/sse-twitter-aggregator/src/main/resources/webroot/index.html:
--------------------------------------------------------------------------------
1 |
42 |
43 |
44 |
45 |
46 | Jersey Message Streaming Example
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/sse-twitter-aggregator/truststore_client:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/jersey-tutorial/ab3c070fba68a09fa4f4eceb49e9b8795f07c685/sse-twitter-aggregator/truststore_client
--------------------------------------------------------------------------------
/sse-twitter-aggregator/twitter-api.properties:
--------------------------------------------------------------------------------
1 | #
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 | #
4 | # Copyright (c) 2012-2017 Oracle and/or its affiliates. All rights reserved.
5 | #
6 | # The contents of this file are subject to the terms of either the GNU
7 | # General Public License Version 2 only ("GPL") or the Common Development
8 | # and Distribution License("CDDL") (collectively, the "License"). You
9 | # may not use this file except in compliance with the License. You can
10 | # obtain a copy of the License at
11 | # https://oss.oracle.com/licenses/CDDL+GPL-1.1
12 | # or LICENSE.txt. See the License for the specific
13 | # language governing permissions and limitations under the License.
14 | #
15 | # When distributing the software, include this License Header Notice in each
16 | # file and include the License file at LICENSE.txt.
17 | #
18 | # GPL Classpath Exception:
19 | # Oracle designates this particular file as subject to the "Classpath"
20 | # exception as provided by Oracle in the GPL Version 2 section of the License
21 | # file that accompanied this code.
22 | #
23 | # Modifications:
24 | # If applicable, add the following below the License Header, with the fields
25 | # enclosed by brackets [] replaced by your own identifying information:
26 | # "Portions Copyright [year] [name of copyright owner]"
27 | #
28 | # Contributor(s):
29 | # If you wish your version of this file to be governed by only the CDDL or
30 | # only the GPL Version 2, indicate your decision by adding "[Contributor]
31 | # elects to include this software in this distribution under the [CDDL or GPL
32 | # Version 2] license." If you don't indicate a single choice of license, a
33 | # recipient has the option to distribute your version of this file under
34 | # either the CDDL, the GPL Version 2 or to extend the choice of license to
35 | # its licensees as provided above. However, if you add GPL Version 2 code
36 | # and therefore, elected the GPL Version 2 license, then the option applies
37 | # only if the new code is made subject to such option by the copyright
38 | # holder.
39 | #
40 |
41 | twitter.user.name=
42 | twitter.user.password=
43 |
--------------------------------------------------------------------------------