Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
f9e8b4f1
Commit
f9e8b4f1
authored
Apr 09, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix multipart & add three useful function
c.GetString() c. GetInt() c.GetBool()
parent
4353c98f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
beego.go
beego.go
+7
-0
controller.go
controller.go
+18
-1
No files found.
beego.go
View file @
f9e8b4f1
...
...
@@ -35,6 +35,7 @@ var (
SessionGCMaxLifetime
int64
// session's gc maxlifetime
SessionSavePath
string
// session savepath if use mysql/redis/file this set to the connectinfo
UseFcgi
bool
MaxMemory
int64
GlobalSessions
*
session
.
Manager
//GlobalSessions
)
...
...
@@ -62,6 +63,7 @@ func init() {
SessionGCMaxLifetime
=
3600
SessionSavePath
=
""
UseFcgi
=
false
MaxMemory
=
1
<<
26
//64MB
}
else
{
HttpAddr
=
AppConfig
.
String
(
"httpaddr"
)
if
v
,
err
:=
AppConfig
.
Int
(
"httpport"
);
err
!=
nil
{
...
...
@@ -69,6 +71,11 @@ func init() {
}
else
{
HttpPort
=
v
}
if
v
,
err
:=
AppConfig
.
Int64
(
"maxmemory"
);
err
!=
nil
{
MaxMemory
=
1
<<
26
}
else
{
MaxMemory
=
v
}
AppName
=
AppConfig
.
String
(
"appname"
)
if
runmode
:=
AppConfig
.
String
(
"runmode"
);
runmode
!=
""
{
RunMode
=
runmode
...
...
controller.go
View file @
f9e8b4f1
...
...
@@ -170,10 +170,27 @@ func (c *Controller) ServeXml() {
}
func
(
c
*
Controller
)
Input
()
url
.
Values
{
c
.
Ctx
.
Request
.
ParseForm
()
ct
:=
c
.
Ctx
.
Request
.
Header
.
Get
(
"Content-Type"
)
if
ct
==
"multipart/form-data"
{
c
.
Ctx
.
Request
.
ParseMultipartForm
(
MaxMemory
)
//64MB
}
else
{
c
.
Ctx
.
Request
.
ParseForm
()
}
return
c
.
Ctx
.
Request
.
Form
}
func
(
c
*
Controller
)
GetString
(
key
string
)
string
{
return
c
.
Input
()
.
Get
(
key
)
}
func
(
c
*
Controller
)
GetInt
(
key
string
)
(
int64
,
error
)
{
return
strconv
.
ParseInt
(
c
.
Input
()
.
Get
(
key
),
10
,
64
)
}
func
(
c
*
Controller
)
GetBool
(
key
string
)
(
bool
,
error
)
{
return
strconv
.
ParseBool
(
c
.
Input
()
.
Get
(
key
))
}
func
(
c
*
Controller
)
StartSession
()
(
sess
session
.
SessionStore
)
{
sess
=
GlobalSessions
.
SessionStart
(
c
.
Ctx
.
ResponseWriter
,
c
.
Ctx
.
Request
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment