jresty-rest

a tranditional but rapid development RESTful API framework based on Struts2 and Spring

License

License

GroupId

GroupId

com.github.downgoon
ArtifactId

ArtifactId

jresty-rest
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

jresty-rest
a tranditional but rapid development RESTful API framework based on Struts2 and Spring
Project URL

Project URL

http://maven.apache.org

Download jresty-rest

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.downgoon/jresty-rest/ -->
<dependency>
    <groupId>com.github.downgoon</groupId>
    <artifactId>jresty-rest</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.downgoon/jresty-rest/
implementation 'com.github.downgoon:jresty-rest:0.0.1'
// https://jarcasting.com/artifacts/com.github.downgoon/jresty-rest/
implementation ("com.github.downgoon:jresty-rest:0.0.1")
'com.github.downgoon:jresty-rest:jar:0.0.1'
<dependency org="com.github.downgoon" name="jresty-rest" rev="0.0.1">
  <artifact name="jresty-rest" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.downgoon', module='jresty-rest', version='0.0.1')
)
libraryDependencies += "com.github.downgoon" % "jresty-rest" % "0.0.1"
[com.github.downgoon/jresty-rest "0.0.1"]

Dependencies

compile (8)

Group / Artifact Type Version
javax.servlet : servlet-api jar 2.5
org.apache.struts : struts2-core jar 2.1.8
org.apache.struts : struts2-spring-plugin jar 2.1.8
org.apache.struts : struts2-config-browser-plugin jar 2.1.8
net.sf.json-lib : json-lib jar 2.2.1
com.thoughtworks.xstream : xstream jar 1.3.1
org.slf4j : slf4j-api jar 1.7.7
org.slf4j : slf4j-log4j12 jar 1.7.7

test (2)

Group / Artifact Type Version
org.apache.struts : struts2-junit-plugin jar 2.1.8
junit : junit jar 4.10

Project Modules

There are no modules declared in this project.

jresty

  • jresty-rest-example

  • jresty-rest

  • jresty-data-orm

  • jresty-data-cache

  • jresty-data-http

  • jresty-commons

  • jresty-security


jresty-rest-example

hello-world-jresty: a quick start example

how to run

  • run in eclipse

    org.example.jresty.runner.JettyEmbedRunner

  • run with maven

    // in rd env (development environment) mvn -Djetty.port=8080 jetty:run -Dmaven.test.skip=true -Prd

    // in op env (production environment) mvn -Djetty.port=8080 jetty:run -Pop

how to access

multi representation

curl http://localhost:8080/jresty/ping.json -i
curl http://localhost:8080/jresty/ping.jsonp -i
curl http://localhost:8080/jresty/ping.xml -i
curl http://localhost:8080/jresty/ping.html -i
curl http://localhost:8080/jresty/ping.jsp -i

# redirect support for .html|.jsp
http://localhost:8080/jresty/ping.jsp?redirect=http://www.baidu.com
http://localhost:8080/jresty/ping.html?redirect=http://www.baidu.com

two URLs for one method

# GET ping.json is equal to GET ping-index.json
# POST ping.json is equal to GET ping-create.json
# DELETE ping.json is equal to GET ping-remove.json
# PUT ping.json is equal to GET ping-update.json
# GET ping/ABC.json is equal to GET ping-view.json?id=ABC

curl http://localhost:8080/jresty/ping.json -i
curl http://localhost:8080/jresty/ping-index.json -i

some examples

$ curl http://localhost:8080/jresty/ping.json -i
HTTP/1.1 200 OK
Content-Language: zh-cn
Access-Control-Allow-Origin: *
Content-Length: 97
Content-Type: application/json;charset=UTF-8
Cache-Control: max-age=0
Server: Jetty(7.2.0.v20101020)

$ curl http://localhost:8080/jresty/ping.xml -i
HTTP/1.1 200 OK
Content-Language: zh-cn
Access-Control-Allow-Origin: *
Content-Length: 200
Content-Type: application/xml;charset=UTF-8
Cache-Control: max-age=0
Server: Jetty(7.2.0.v20101020)

<io.downgoon.jresty.rest.model.UnifiedResponse>
	<status>200</status>
	<message>OK</message>
	<debug>20161218152559257318:系统正在运行</debug>
</io.downgoon.jresty.rest.model.UnifiedResponse

Versions

Version
0.0.1