Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #22 from paulerickson/boot
Browse files Browse the repository at this point in the history
Change all the things
  • Loading branch information
paulerickson committed Sep 21, 2015
2 parents 337a316 + c1472ee commit 14b94de
Show file tree
Hide file tree
Showing 31 changed files with 355 additions and 697 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ hs_err_pid*
.classpath
.project
.settings
.gradle
build/
.idea/
*.swp
*.iml
7 changes: 0 additions & 7 deletions Application.groovy

This file was deleted.

31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# json-proxy-service
A Simple server side JSON proxy service written in Java
# rest-proxy
A Simple server side REST proxy service written in Groovy

[![Build Status](https://travis-ci.org/UW-Madison-DoIT/json-proxy-service.svg)](https://travis-ci.org/UW-Madison-DoIT/json-proxy-service)
[![Build Status](https://travis-ci.org/UW-Madison-DoIT/rest-proxy.svg)](https://travis-ci.org/UW-Madison-DoIT/rest-proxy)

### Purpose

This is an important component with a couple of use cases.

* Picture an app in the portal providing a preview of a fuller external application. Without this component, we would need to write REST controllers in the app that are a façade to the external-to-portal REST web services (that might even be provided out of the WSO2 ESB). With this component, we can drop `json-proxy-service` in the portal app, configure it with the ESB endpoint address for the application's REST API and credentials, and then NOT have to write any controllers! The AngularJS controllers can talk to the (same domain) URIs presented by the `json-proxy-service` controllers, which in turn relay to the ESB and the external application.
* Picture an app in the portal providing a preview of a fuller external application. Without this component, we would need to write REST controllers in the app that are a façade to the external-to-portal REST web services (that might even be provided out of the WSO2 ESB). With this component, we can drop `rest-proxy-core` in the portal app, configure it with the ESB endpoint address for the application's REST API and credentials, and then NOT have to write any controllers! The AngularJS controllers can talk to the (same domain) URIs presented by the `rest-proxy-core` controllers, which in turn relay to the ESB and the external application.
* Picture this module deployed as a façade for ESB endpoints. `my.wisc.edu/esb/someservice/api/foo` . You could theoretically write 100% javascript apps against the proxy proxying ESB-provided JSON.

### Add Proxy Servlet to Existing Service
Expand All @@ -19,12 +19,12 @@ This is an important component with a couple of use cases.
+ Setup a servlet:
```xml
<servlet>
<servlet-name>json-proxy-api</servlet-name>
<servlet-name>rest-proxy-api</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>json-proxy-api</servlet-name>
<servlet-name>rest-proxy-api</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>

Expand All @@ -33,15 +33,20 @@ This is an important component with a couple of use cases.

### Run Standalone Microservice

#### Prerequisites
* [Grails 3.0.x](https://grails.org/)

#### Running
* Run `grails run-app` to start the server
* [Verify it works](localhost:8080/todos.json)
* Supply endpoint configuration - you can copy application.properties.example to get started, or add a command-line flag, e.g. `--todos.uri=http://jsonplaceholder.typicode.com/todos`
* Run `gradle bootRun` to start the server
* [Verify in your browser](localhost:8080/todos)

__OR__

* Run `grails package` to build a jar artifact
* Start the server by running `java -jar build/proxy-service-0.1.jar`
* Run `gradle build` to build a standalone jar
* Start the server by running `java -jar rest-proxy-boot/build/rest-proxy-boot-<VERSION>.jar`

### Releasing to Artifact Repository

#### Manually
Only authorized users can perform the release. Contact one of the core contributors if you think you should have access.

* Run `gradle uploadArchives` and provide Sonatype credentials when prompted (if they are not already supplied in ~/.gradle/gradle.properties). This will build both projects and generate pomfiles, javadoc, test, and sources artifacts, and then upload them to the Sonatype Nexus repository.

53 changes: 0 additions & 53 deletions application.yml

This file was deleted.

88 changes: 88 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
buildscript {
repositories { jcenter() }
dependencies { classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1' }
}

subprojects {

group = 'edu.wisc.my.restproxy'
version = '2.1.0-SNAPSHOT'

repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://code.doit.wisc.edu/maven/content/repositories/public-releases/" }
maven { url "https://code.doit.wisc.edu/maven/content/repositories/uw-releases/" }
maven { url "http://repo.maven.apache.org/maven2" }
}

apply plugin: 'groovy'
apply plugin: 'com.bmuschko.nexus'

// Nexus deploy configuration
nexus {
sign = true
repositoryUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
snapshotRepositoryUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
}

extraArchive {
javadoc = true
sources = true
tests = true
}

modifyPom {
project {
url 'https://github.com/UW-Madison-DoIT/rest-proxy'
inceptionYear '2015'
scm {
url 'https://github.com/UW-Madison-DoIT/rest-proxy'
connection 'scm:https://github.com/UW-Madison-DoIT/rest-proxy.git'
developerConnection 'scm:git://github.com/UW-Madison-DoIT/rest-proxy.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
name 'My UW Dev Team'
email '[email protected]'
url 'https://github.com/UW-Madison-DoIT'
organization 'UW-Madison-DoIT'
}
}
// The nexus plugin overlooks provided dependencies
// so we override this bit to make sure they get in
def generatedDeps = dependencies
dependencies {
generatedDeps.each { dep ->
dependency {
groupId dep.groupId
artifactId dep.artifactId
version dep.version
scope dep.scope
}
}
project.configurations.provided.allDependencies.each { dep ->
dependency {
groupId dep.group
artifactId dep.name
version dep.version
scope 'provided'
}
}
}
}
}

// Define provided scope
configurations {
provided
compile.extendsFrom provided
}

}
Loading

0 comments on commit 14b94de

Please sign in to comment.