Skip to content

Commit 023a733

Browse files
authored
Merge pull request #189 from devfeel/develop
Remove all features in dotweb
2 parents 0cd7330 + 1fd60e6 commit 023a733

9 files changed

Lines changed: 33 additions & 119 deletions

File tree

config/configs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ type (
4848
EnabledGzip bool `xml:"enabledgzip,attr"` // enable gzip
4949
EnabledAutoHEAD bool `xml:"enabledautohead,attr"` // ehanble HEAD routing, default is false, will add HEAD routing for all routes except for websocket and HEAD
5050
EnabledAutoOPTIONS bool // enable OPTIONS routing, default is false, will add OPTIONS routing for all routes except for websocket and OPTIONS
51-
EnabledAutoCORS bool `xml:"enabledautocors,attr"` // enable automatic CORS, if set, all [GET, POST, PUT, DELETE, OPTIONS] requests will allow CORS
5251
EnabledIgnoreFavicon bool `xml:"enabledignorefavicon,attr"` // ignore favicon.ico request, return empty reponse if set
5352
EnabledBindUseJsonTag bool `xml:"enabledbindusejsontag,attr"` // allow Bind to use JSON tag, default is false, Bind will use json tag automatically and ignore form tag
5453
EnabledStaticFileMiddleware bool // The flag which enabled or disabled middleware for static-file route

context.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ type (
112112
innerItems core.ConcurrenceMap
113113
items core.ConcurrenceMap
114114
viewData core.ConcurrenceMap
115-
features *xFeatureTools
116115
handler HttpHandle
117116
}
118117
)
@@ -129,7 +128,6 @@ func (ctx *HttpContext) reset(res *Response, r *Request, server *HttpServer, nod
129128
ctx.innerItems = nil
130129
ctx.items = nil
131130
ctx.isEnd = false
132-
ctx.features = FeatureTools
133131
ctx.handler = handler
134132
ctx.Items().Set(ItemKeyHandleStartTime, time.Now())
135133
}
@@ -147,7 +145,6 @@ func (ctx *HttpContext) release() {
147145
ctx.isWebSocket = false
148146
ctx.httpServer = nil
149147
ctx.isEnd = false
150-
ctx.features = nil
151148
ctx.innerItems = nil
152149
ctx.items = nil
153150
ctx.viewData = nil
@@ -225,10 +222,6 @@ func (ctx *HttpContext) SessionID() string {
225222
return ctx.sessionID
226223
}
227224

228-
func (ctx *HttpContext) Features() *xFeatureTools {
229-
return ctx.features
230-
}
231-
232225
// AppContext get application's global appcontext
233226
// issue #3
234227
func (ctx *HttpContext) AppItems() core.ConcurrenceMap {

example/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# DotWeb
2+
Simple and easy go web micro framework
3+
4+
More examples: https://github.com/devfeel/dotweb-example
5+
6+
## Contact Us
7+
#### QQ-Group:193409346 - <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=836e11667837ad674462a4a97fb21fba487cd3dff5b2e1ca0d7ea4c2324b4574"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Golang-Devfeel" title="Golang-Devfeel"></a>
8+
#### Gitter:[![Gitter](https://badges.gitter.im/devfeel/dotweb.svg)](https://gitter.im/devfeel-dotweb/wechat)

feature.go

Lines changed: 0 additions & 24 deletions
This file was deleted.

feature/cors.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

feature/features.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

server.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"strconv"
1515

1616
"github.com/devfeel/dotweb/config"
17-
"github.com/devfeel/dotweb/feature"
1817
"github.com/devfeel/dotweb/framework/file"
1918
"github.com/devfeel/dotweb/framework/json"
2019
"github.com/devfeel/dotweb/logger"
@@ -40,7 +39,6 @@ type (
4039
binder Binder
4140
render Renderer
4241
offline bool
43-
Features *feature.Feature
4442
virtualPath string // virtual path when deploy on no root path
4543
}
4644

@@ -73,7 +71,6 @@ func NewHttpServer() *HttpServer {
7371
Modules: make([]*HttpModule, 0),
7472
lock_session: new(sync.RWMutex),
7573
binder: newBinder(),
76-
Features: &feature.Feature{},
7774
}
7875
// setup router
7976
server.router = NewRouter(server)
@@ -83,10 +80,6 @@ func NewHttpServer() *HttpServer {
8380

8481
// initConfig init config from app config
8582
func (server *HttpServer) initConfig() {
86-
// CROS Config
87-
if server.ServerConfig().EnabledAutoCORS {
88-
server.Features.SetEnabledCROS()
89-
}
9083
server.SetEnabledGzip(server.ServerConfig().EnabledGzip)
9184

9285
// VirtualPath config
@@ -519,14 +512,6 @@ func prepareHttpContext(server *HttpServer, w http.ResponseWriter, req *http.Req
519512
httpCtx.Response().SetHeader(HeaderContentEncoding, gzipScheme)
520513
}
521514

522-
// CROS handling
523-
if server.Features.CROSConfig != nil {
524-
c := server.Features.CROSConfig
525-
if c.EnabledCROS {
526-
FeatureTools.SetCROSConfig(httpCtx, c)
527-
}
528-
}
529-
530515
return httpCtx
531516
}
532517

server_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ func TestNewHttpServer(t *testing.T) {
1717
test.NotNil(t, server.SessionConfig)
1818
test.NotNil(t, server.lock_session)
1919
test.NotNil(t, server.binder)
20-
test.NotNil(t, server.Features)
2120
test.NotNil(t, server.pool)
2221
test.NotNil(t, server.pool.context)
2322
test.NotNil(t, server.pool.request)

version.MD

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
## dotweb版本记录:
22

3+
#### Version 1.6
4+
* Remove: remove all features in dotweb!
5+
* Remove: remove ServerConfig().EnabledAutoCORS.
6+
* Add: add example/README.md
7+
* Demo for how to use ConfigSet tools?
8+
- first define config file named 'user-conf.xml'
9+
```
10+
<?xml version="1.0" encoding="UTF-8"?>
11+
<config>
12+
<set key="set1" value="1" />
13+
<set key="set2" value="2" />
14+
<set key="set3" value="3" />
15+
<set key="set4" value="4" />
16+
</config>
17+
```
18+
- include config file
19+
```
20+
err := app.Config.IncludeConfigSet("/home/your/user-conf.xml", config.ConfigType_XML)
21+
```
22+
- use it in your HttpContext
23+
```
24+
value := ctx.ConfigSet().GetString("set1")
25+
```
26+
* 2019-02-02 12:00
27+
328
#### Version 1.5.9.11
429
* New Feature: HttpServer add SetIndexPage used to config default index-page name, default is "index.html"
530
* Remove: remove example/basemiddleware demo, more examples you can see "https://github.com/devfeel/dotweb-example"

0 commit comments

Comments
 (0)