├── .classpath ├── .gitignore ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── JaxrsGrailsPlugin.groovy ├── LICENSE.txt ├── README.md ├── application.properties ├── grails-app ├── conf │ ├── BuildConfig.groovy │ └── JaxrsUrlMappings.groovy └── controllers │ └── org │ └── grails │ └── jaxrs │ └── JaxrsController.groovy ├── lib └── org.restlet.ext.jaxrs-noruntimedel-2.1.4.jar ├── scripts ├── CreateResource.groovy ├── GenerateResources.groovy └── _Events.groovy ├── src ├── groovy │ └── org │ │ └── grails │ │ └── jaxrs │ │ ├── JaxrsClasses.groovy │ │ ├── generator │ │ └── CodeGenerator.groovy │ │ ├── itest │ │ ├── IntegrationTestCase.groovy │ │ ├── IntegrationTestEnvironment.groovy │ │ ├── IntegrationTestSpec.groovy │ │ ├── JaxRsIntegrationTest.groovy │ │ ├── JaxRsIntegrationTestMixin.groovy │ │ └── integrationTestEnvironment.xml │ │ ├── provider │ │ ├── DomainObjectNotFoundException.groovy │ │ ├── DomainObjectReader.groovy │ │ └── DomainObjectWriter.groovy │ │ ├── response │ │ └── Responses.groovy │ │ ├── support │ │ ├── ConverterUtils.groovy │ │ ├── DomainObjectReaderSupport.groovy │ │ └── DomainObjectWriterSupport.groovy │ │ └── test │ │ ├── CustomRequestEntity.groovy │ │ ├── CustomRequestEntityReader.groovy │ │ ├── CustomResponseEntity.groovy │ │ ├── CustomResponseEntityWriter.groovy │ │ ├── TestClasses.groovy │ │ ├── TestPerson.groovy │ │ ├── TestQueryParamResource.groovy │ │ ├── TestResource01.groovy │ │ ├── TestResource02.groovy │ │ ├── TestResource03.groovy │ │ ├── TestResource04.groovy │ │ ├── TestResource05.groovy │ │ └── TestResource06.groovy ├── java │ └── org │ │ └── grails │ │ └── jaxrs │ │ ├── DefaultGrailsProviderClass.java │ │ ├── DefaultGrailsResourceClass.java │ │ ├── GrailsProviderClass.java │ │ ├── GrailsResourceClass.java │ │ ├── ProviderArtefactHandler.java │ │ ├── ResourceArtefactHandler.java │ │ ├── provider │ │ ├── JSONReader.java │ │ ├── JSONWriter.java │ │ ├── XMLReader.java │ │ └── XMLWriter.java │ │ ├── support │ │ ├── IllegalTypeException.java │ │ ├── MessageBodyReaderSupport.java │ │ ├── MessageBodyWriterSupport.java │ │ ├── ProviderSupport.java │ │ └── ProviderUtils.java │ │ └── web │ │ ├── JaxrsConfig.java │ │ ├── JaxrsContext.java │ │ ├── JaxrsFilter.java │ │ ├── JaxrsListener.java │ │ ├── JaxrsService.java │ │ ├── JaxrsUtils.java │ │ ├── JerseyServlet.java │ │ ├── RequestWrapper.java │ │ └── RestletServlet.java └── templates │ ├── artifacts │ └── Resource.groovy │ └── scaffolding │ ├── CollectionResource.groovy │ ├── Resource.groovy │ └── ResourceService.groovy └── test ├── integration └── org │ └── grails │ └── jaxrs │ └── itest │ ├── ExampleIntegrationSpec.groovy │ ├── ExampleIntegrationTest.groovy │ ├── JaxrsControllerIntegrationSpec.groovy │ ├── JaxrsControllerIntegrationTest.groovy │ ├── JerseyControllerIntegrationSpec.groovy │ ├── JerseyControllerIntegrationTest.groovy │ ├── RestletControllerIntegrationSpec.groovy │ └── RestletControllerIntegrationTest.groovy └── unit └── org └── grails └── jaxrs ├── JaxrsClassesTests.groovy ├── JaxrsControllerTests.groovy ├── support └── ProviderSupportTests.groovy └── web └── UnitTestEnvironment.groovy /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | *.log 3 | *target 4 | *target-eclipse 5 | web-app 6 | plugin.xml 7 | 8 | #Mac File 9 | .DS_Store 10 | 11 | #Vi/Emacs temporary files 12 | *~ 13 | 14 | .settings -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | jaxrs 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.grails.ide.eclipse.core.nature 16 | org.eclipse.jdt.groovy.core.groovyNature 17 | org.eclipse.jdt.core.javanature 18 | 19 | 20 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Wed Jan 06 16:21:57 CET 2010 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning 4 | org.eclipse.jdt.core.compiler.problem.autoboxing=ignore 5 | org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning 6 | org.eclipse.jdt.core.compiler.problem.deadCode=warning 7 | org.eclipse.jdt.core.compiler.problem.deprecation=warning 8 | org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled 9 | org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled 10 | org.eclipse.jdt.core.compiler.problem.discouragedReference=warning 11 | org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore 12 | org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore 13 | org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled 14 | org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore 15 | org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning 16 | org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning 17 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=error 18 | org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning 19 | org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning 20 | org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore 21 | org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore 22 | org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore 23 | org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning 24 | org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore 25 | org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore 26 | org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore 27 | org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning 28 | org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore 29 | org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning 30 | org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning 31 | org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore 32 | org.eclipse.jdt.core.compiler.problem.nullReference=warning 33 | org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning 34 | org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore 35 | org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore 36 | org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore 37 | org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore 38 | org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore 39 | org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore 40 | org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled 41 | org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning 42 | org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled 43 | org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore 44 | org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning 45 | org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning 46 | org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore 47 | org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning 48 | org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore 49 | org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore 50 | org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore 51 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore 52 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled 53 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled 54 | org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled 55 | org.eclipse.jdt.core.compiler.problem.unusedImport=warning 56 | org.eclipse.jdt.core.compiler.problem.unusedLabel=warning 57 | org.eclipse.jdt.core.compiler.problem.unusedLocal=warning 58 | org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore 59 | org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled 60 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled 61 | org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled 62 | org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning 63 | org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning 64 | org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning 65 | -------------------------------------------------------------------------------- /JaxrsGrailsPlugin.groovy: -------------------------------------------------------------------------------- 1 | import org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet 2 | import org.grails.jaxrs.ProviderArtefactHandler 3 | import org.grails.jaxrs.ResourceArtefactHandler 4 | import org.grails.jaxrs.generator.CodeGenerator 5 | import org.grails.jaxrs.provider.* 6 | import org.grails.jaxrs.web.JaxrsContext 7 | import org.grails.jaxrs.web.JaxrsFilter 8 | import org.grails.jaxrs.web.JaxrsListener 9 | 10 | import static org.grails.jaxrs.web.JaxrsUtils.JAXRS_CONTEXT_NAME 11 | 12 | class JaxrsGrailsPlugin { 13 | def groupId = "org.grails.plugins" 14 | def version = "0.11" 15 | def grailsVersion = "2.4 > *" 16 | def pluginExcludes = [ 17 | "grails-app/domain/*", 18 | "grails-app/providers/*", 19 | "grails-app/resources/*", 20 | "src/groovy/org/grails/jaxrs/test/*", 21 | "lib/*-sources.jar", 22 | "web-app/**" 23 | ] 24 | 25 | def loadAfter = ['controllers', 'services', 'spring-security-core'] 26 | def artefacts = [ 27 | new ResourceArtefactHandler(), 28 | new ProviderArtefactHandler() 29 | ] 30 | def watchedResources = [ 31 | "file:./grails-app/resources/**/*Resource.groovy", 32 | "file:./grails-app/providers/**/*Reader.groovy", 33 | "file:./grails-app/providers/**/*Writer.groovy", 34 | "file:./plugins/*/grails-app/resources/**/*Resource.groovy", 35 | "file:./plugins/*/grails-app/providers/**/*Reader.groovy", 36 | "file:./plugins/*/grails-app/providers/**/*Writer.groovy" 37 | ] 38 | 39 | def author = "Martin Krasser" 40 | def authorEmail = "krasserm@googlemail.com" 41 | def title = "JSR 311 plugin" 42 | def description = """ 43 | A plugin that supports the development of RESTful web services based on the 44 | Java API for RESTful Web Services (JSR 311: JAX-RS). It is targeted at 45 | developers who want to structure the web service layer of an application in 46 | a JSR 311 compatible way but still want to continue to use Grails' powerful 47 | features such as GORM, automated XML and JSON marshalling, Grails services, 48 | Grails filters and so on. This plugin is an alternative to Grails' built-in 49 | mechanism for implementing RESTful web services. 50 | 51 | At the moment, plugin users may choose between Jersey and Restlet as JAX-RS 52 | implementation. Both implementations are packaged with the plugin. Support for 53 | Restlet was added in version 0.2 of the plugin in order to support deployments 54 | on the Google App Engine. Other JAX-RS implementations such as RestEasy or 55 | Apache Wink are likely to be added in upcoming versions of the plugin. 56 | """ 57 | 58 | def developers = [ 59 | [name: 'Davide Cavestro', email: 'davide.cavestro@gmail.com'], 60 | [name: 'Noam Y. Tenne', email: 'noam@10ne.org'] 61 | ] 62 | 63 | def documentation = 'https://github.com/krasserm/grails-jaxrs/wiki' 64 | 65 | def issueManagement = [url: 'https://github.com/krasserm/grails-jaxrs/issues'] 66 | 67 | def scm = [url: 'https://github.com/krasserm/grails-jaxrs'] 68 | 69 | /** 70 | * Adds the JaxrsFilter and JaxrsListener to the web application 71 | * descriptor. 72 | */ 73 | def doWithWebDescriptor = { xml -> 74 | 75 | def lastListener = xml.'listener'.iterator().toList().last() 76 | lastListener + { 77 | 'listener' { 78 | 'listener-class'(JaxrsListener.name) 79 | } 80 | } 81 | 82 | def firstFilter = xml.'filter'[0] 83 | firstFilter + { 84 | 'filter' { 85 | 'filter-name'('jaxrsFilter') 86 | 'filter-class'(JaxrsFilter.name) 87 | } 88 | } 89 | 90 | def firstFilterMapping = xml.'filter-mapping'[0] 91 | firstFilterMapping + { 92 | 'filter-mapping' { 93 | 'filter-name'('jaxrsFilter') 94 | 'url-pattern'('/*') 95 | 'dispatcher'('FORWARD') 96 | 'dispatcher'('REQUEST') 97 | } 98 | } 99 | 100 | def grailsServlet = xml.servlet.find { servlet -> 101 | 102 | 'grails'.equalsIgnoreCase(servlet.'servlet-name'.text()) 103 | 104 | } 105 | 106 | // reload default GrailsDispatcherServlet adding 'dispatchOptionsRequest':'true' 107 | grailsServlet.replaceNode { node -> 108 | 'servlet' { 109 | 'servlet-name'('grails') 110 | 'servlet-class'(GrailsDispatcherServlet.name) 111 | 'init-param' { 112 | 'param-name'('dispatchOptionsRequest') 113 | 'param-value'('true') 114 | } 115 | 'load-on-startup'('1') 116 | } 117 | } 118 | } 119 | 120 | /** 121 | * Adds the JaxrsContext and plugin- and application-specific JAX-RS 122 | * resource and provider classes to the application context. 123 | */ 124 | def doWithSpring = { 125 | 126 | // Configure the JAX-RS context 127 | 'jaxrsContext'(JaxrsContext) 128 | 129 | // Configure default providers 130 | "${XMLWriter.name}"(XMLWriter) 131 | "${XMLReader.name}"(XMLReader) 132 | "${JSONWriter.name}"(JSONWriter) 133 | "${JSONReader.name}"(JSONReader) 134 | "${DomainObjectReader.name}"(DomainObjectReader) 135 | "${DomainObjectWriter.name}"(DomainObjectWriter) 136 | 137 | // Configure application-provided resources 138 | application.resourceClasses.each { rc -> 139 | "${rc.propertyName}"(rc.clazz) { bean -> 140 | bean.scope = owner.getResourceScope(application) 141 | bean.autowire = true 142 | } 143 | } 144 | 145 | // Configure application-provided providers 146 | application.providerClasses.each { pc -> 147 | "${pc.propertyName}"(pc.clazz) { bean -> 148 | bean.scope = 'singleton' 149 | bean.autowire = true 150 | } 151 | } 152 | 153 | // Configure the resource code generator 154 | "${CodeGenerator.name}"(CodeGenerator) 155 | } 156 | 157 | /** 158 | * Updates application-specific JAX-RS resource and provider classes in 159 | * the application context. 160 | */ 161 | def onChange = { event -> 162 | 163 | if (!event.ctx) { 164 | return 165 | } 166 | 167 | if (application.isArtefactOfType(ResourceArtefactHandler.TYPE, event.source)) { 168 | def resourceClass = application.addArtefact(ResourceArtefactHandler.TYPE, event.source) 169 | beans { 170 | "${resourceClass.propertyName}"(resourceClass.clazz) { bean -> 171 | bean.scope = owner.getResourceScope(application) 172 | bean.autowire = true 173 | } 174 | }.registerBeans(event.ctx) 175 | } else if (application.isArtefactOfType(ProviderArtefactHandler.TYPE, event.source)) { 176 | def providerClass = application.addArtefact(ProviderArtefactHandler.TYPE, event.source) 177 | beans { 178 | "${providerClass.propertyName}"(providerClass.clazz) { bean -> 179 | bean.scope = 'singleton' 180 | bean.autowire = true 181 | } 182 | }.registerBeans(event.ctx) 183 | } else { 184 | return 185 | } 186 | 187 | // Setup the JaxrsConfig 188 | doWithApplicationContext(event.ctx) 189 | 190 | // Resfresh the JaxrsContext 191 | event.ctx.getBean(JAXRS_CONTEXT_NAME).refresh() 192 | } 193 | 194 | /** 195 | * Reconfigures the JaxrsConfig with plugin- and application-specific 196 | * JAX-RS resource and provider classes. Configures the JaxrsContext 197 | * with the JAX-RS implementation to use. The name of the JAX-RS 198 | * implementation is obtained from the configuration property 199 | * org.grails.jaxrs.provider.name. Default value is 200 | * jersey. 201 | */ 202 | def doWithApplicationContext = { applicationContext -> 203 | 204 | def context = applicationContext.getBean(JAXRS_CONTEXT_NAME) 205 | def config = context.jaxrsConfig 206 | 207 | context.jaxrsProviderName = getProviderName(application) 208 | context.jaxrsProviderExtraPaths = getProviderExtraPaths(application) 209 | context.jaxrsProviderInitParameters = getProviderInitParameters(application) 210 | 211 | config.reset() 212 | config.classes << XMLWriter 213 | config.classes << XMLReader 214 | config.classes << JSONWriter 215 | config.classes << JSONReader 216 | config.classes << DomainObjectReader 217 | config.classes << DomainObjectWriter 218 | 219 | application.getArtefactInfo('Resource').classesByName.values().each { clazz -> 220 | config.classes << clazz 221 | } 222 | application.getArtefactInfo('Provider').classesByName.values().each { clazz -> 223 | config.classes << clazz 224 | } 225 | } 226 | 227 | private String getResourceScope(application) { 228 | def scope = application.config.org.grails.jaxrs.resource.scope 229 | if (!scope) { 230 | scope = 'prototype' 231 | } 232 | scope 233 | } 234 | 235 | private String getProviderName(application) { 236 | def name = application.config.org.grails.jaxrs.provider.name 237 | if (!name) { 238 | name = JaxrsContext.JAXRS_PROVIDER_NAME_JERSEY 239 | } 240 | name 241 | } 242 | 243 | private String getProviderExtraPaths(application) { 244 | application.config.org.grails.jaxrs.provider.extra.paths 245 | } 246 | 247 | private Map getProviderInitParameters(application) { 248 | application.config.org.grails.jaxrs.provider.init.parameters 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #Project Moved 2 | 3 | Development of this plugin will continue at the fork located at https://github.com/budjb/grails-jaxrs. 4 | -------------------------------------------------------------------------------- /application.properties: -------------------------------------------------------------------------------- 1 | #Grails Metadata file 2 | #Thu Jun 12 18:00:09 CEST 2014 3 | app.grails.version=2.5.0 4 | app.name=JaxrsGrailsPlugin 5 | app.servlet.version=2.5 6 | -------------------------------------------------------------------------------- /grails-app/conf/BuildConfig.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2011 the original author or authors. 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 | grails.project.class.dir = 'target/classes' 18 | grails.project.test.class.dir = 'target/test-classes' 19 | grails.project.test.reports.dir = 'target/test-reports' 20 | grails.project.work.dir = 'target/work' 21 | grails.project.target.level = 1.7 22 | grails.project.source.level = 1.7 23 | 24 | grails.project.dependency.distribution = { 25 | remoteRepository(id: 'snapshots-repo', url: 'http://noams.artifactoryonline.com/noams/grails-jaxrs-plugin-snapshots') { 26 | authentication username: System.getProperty('DEPLOYER_USERNAME'), password: System.getProperty('DEPLOYER_PASSWORD') 27 | } 28 | } 29 | grails.project.dependency.resolver = 'maven' 30 | grails.project.dependency.resolution = { 31 | 32 | inherits('global') { 33 | excludes 'hibernate' 34 | } 35 | log 'warn' 36 | 37 | repositories { 38 | grailsPlugins() 39 | grailsCentral() 40 | mavenRepo 'http://jcenter.bintray.com' 41 | mavenLocal() 42 | mavenRepo 'http://maven.restlet.org' 43 | mavenRepo 'http://noams.artifactoryonline.com/noams/grails-jaxrs-plugin-libs' 44 | } 45 | 46 | dependencies { 47 | String restletVersion = '2.1.4' 48 | String jerseyVersion = '1.18.1' 49 | 50 | compile "org.restlet.gae:org.restlet:$restletVersion" 51 | 52 | compile("org.restlet.gae:org.restlet.ext.servlet:$restletVersion") { 53 | excludes 'org.restlet', 'servlet-api' 54 | } 55 | 56 | // A modified version (with removed META-INF/services/javax.ws.rs.ext.RuntimeDelegate) 57 | // is contained in project's custom lib directory and repository. This is needed because of a bug described 58 | // at http://restlet.tigris.org/issues/show_bug.cgi?id=1251 59 | provided group: 'org.restlet.gae', 60 | name: 'org.restlet.ext.jaxrs-noruntimedel', 61 | version: restletVersion 62 | 63 | compile("org.restlet.gae:org.restlet.ext.json:$restletVersion") { 64 | excludes 'org.restlet' 65 | } 66 | 67 | compile("com.sun.jersey:jersey-core:$jerseyVersion") { 68 | excludes 'jaxb-api', 'jsr311-api', 'junit', 'mail', 'org.osgi.core' 69 | } 70 | 71 | compile("com.sun.jersey:jersey-servlet:$jerseyVersion") { 72 | excludes 'ant', 'commons-io', 'javax.ejb', 'javax.servlet-api', 'jsp-api', 'junit', 'osgi_R4_core', 73 | 'persistence-api', 'weld-osgi-bundle' 74 | } 75 | 76 | compile("com.sun.jersey:jersey-server:$jerseyVersion") { 77 | excludes 'asm', 'commons-io', 'jaxb-api', 'jsr250-api', 'junit', 'mail', 'osgi_R4_core' 78 | } 79 | 80 | compile("com.sun.jersey:jersey-json:$jerseyVersion") { 81 | excludes 'jackson-core-asl', 'jackson-jaxrs', 'jackson-mapper-asl', 'jackson-xc', 'jaxb-impl', 'jettison', 'junit', 'org.eclipse.persistence.moxy' 82 | } 83 | 84 | compile("com.sun.jersey.contribs:jersey-spring:$jerseyVersion") { 85 | excludes 'jaxb-impl', 'jsr250-api', 'junit', 'servlet-api', 'testng', 'spring-core', 'spring-beans', 86 | 'spring-context', 'spring-web', 'spring-aop' 87 | } 88 | 89 | compile('javax.ws.rs:jsr311-api:1.1.1') { 90 | excludes 'junit' 91 | } 92 | } 93 | 94 | plugins { 95 | build(':release:3.0.1', ':rest-client-builder:2.0.3') { 96 | export = false 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /grails-app/conf/JaxrsUrlMappings.groovy: -------------------------------------------------------------------------------- 1 | /* * Copyright 2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import org.apache.commons.logging.LogFactory /** * Defined URL mapping for the JaxrsController. By default any URL is mapped to * the the JaxrsController i.e. other controllers are not accessible by default. * In order to map only a subset of possible URLs to JaxrsController an * additional entry must be made to grails-app/conf/Config.groovy. * For example, the entry * *
 * org.grails.jaxrs.url.mappings=['/test', '/notes']
 * 
* * only maps the URLs * *