55 Star 101 Fork 1

花花 / url-shortener

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

url-shortener - 短网址


平台上需要评论或者描述产品。不可避免的用户会输入各种网址。为了控制住这些网址不能随意的展示给客户,也不能随意的从主站跳转出去...总之是为了尽量的控制网址的输入、跳转和节约输入字数。
我在想黑名单和白名单有没有必要加进去, 但是目前我又没想到到底有什么用,纠结~

配置说明

短网址的前缀配置: 如:http://t.cn/d2D2x9, 那么配置的值为:http://t.cn/ 配置文件:src/main/resources/conf/domain.properties

mongo配置: 配置文件:src/main/resources/conf/mongo.properties

log4j配置: 配置文件:src/main/webapp/WEB-INF/conf/log4j.properties][3]

启动说明

工程本身是个web工程, 可以直接gradle打成war包,放在web容器里跑;如果想看看代码,也可以用gradlew jettyRun启动;如果这些都不满足你,就使用自启动吧!

自启动:

①. 首先,下载url-shortener-.war

②. 然后,运行war包:java -jar url-shortener-.war
port:http端口。默认为8888端口
app.context:这个只要是web开发的都知道吧,不知道就不要设置这个参数o(╯□╰)o。默认是"/"
其他的参数(如jvm参数)就该怎样就怎样吧。
加上参数后的示例:java -jar -Dport=80 -Dapp.context=/wogai url-shortener-{version}.war

③. 最后,访问:http://{ip}:{port}/{app.context}/{api}。api请参照下面的“接口说明”

接口说明

对外三个接口:

  • /api/short?url=xxx: 缩短网址接口。url是要缩短的长网址;
  • /api/long?url=xxx: 查询长网址接口。url是短网址或编码,反正最终也是通过编码去查的;
  • /{surl}: 短网址访问接口。 调用她就会跳转到长网址去咯哟。

问题和建议

hh.suse@gmail.com


作者 [@crystony] 2015-03-10

Empty file

About

url 短网址,短链。让你长长的url链接变得短短的 expand collapse
Java
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Java
1
https://gitee.com/crystony/url-shortener.git
git@gitee.com:crystony/url-shortener.git
crystony
url-shortener
url-shortener
master

Search