Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
sentinel
Commits
c07effb8
Commit
c07effb8
authored
Nov 24, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xx
parent
3d7ca65f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
AdminFirstController.java
...va/com/egolm/film/api/web/admin/AdminFirstController.java
+1
-1
Common.java
src/main/java/com/egolm/film/util/Common.java
+11
-2
No files found.
src/main/java/com/egolm/film/api/web/admin/AdminFirstController.java
View file @
c07effb8
...
@@ -119,7 +119,7 @@ public class AdminFirstController {
...
@@ -119,7 +119,7 @@ public class AdminFirstController {
locale
=
new
Locale
(
"en"
,
"US"
);
locale
=
new
Locale
(
"en"
,
"US"
);
}
}
String
subject
=
messages
.
get
(
"email.getPassword.subject"
,
locale
);
String
subject
=
messages
.
get
(
"email.getPassword.subject"
,
locale
);
String
content
=
Common
.
getStringAsStream
(
"
classpath:/
doc/first_pass_"
+
locale
.
getLanguage
().
toLowerCase
()
+
"_"
+
locale
.
getCountry
().
toUpperCase
()
+
".txt"
);
String
content
=
Common
.
getStringAsStream
(
"doc/first_pass_"
+
locale
.
getLanguage
().
toLowerCase
()
+
"_"
+
locale
.
getCountry
().
toUpperCase
()
+
".txt"
);
MessageFormat
.
format
(
content
,
member
.
getUsername
(),
memberFilm
.
getId
());
MessageFormat
.
format
(
content
,
member
.
getUsername
(),
memberFilm
.
getId
());
emailService
.
send
(
subject
,
content
,
member
.
getEmail
());
emailService
.
send
(
subject
,
content
,
member
.
getEmail
());
return
Rjx
.
jsonOk
();
return
Rjx
.
jsonOk
();
...
...
src/main/java/com/egolm/film/util/Common.java
View file @
c07effb8
package
com
.
egolm
.
film
.
util
;
package
com
.
egolm
.
film
.
util
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.Random
;
import
java.util.Random
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.FileUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.StringUtil
;
...
@@ -29,8 +32,14 @@ public class Common {
...
@@ -29,8 +32,14 @@ public class Common {
public
static
String
getStringAsStream
(
String
filename
)
{
public
static
String
getStringAsStream
(
String
filename
)
{
logger
.
debug
(
"read at classpath: "
+
filename
);
logger
.
debug
(
"read at classpath: "
+
filename
);
InputStream
stream
=
Common
.
class
.
getClassLoader
().
getResourceAsStream
(
filename
);
Resource
resource
=
new
ClassPathResource
(
filename
);
return
new
String
(
FileUtil
.
streamToBytes
(
stream
));
try
{
InputStream
stream
=
resource
.
getInputStream
();
return
new
String
(
FileUtil
.
streamToBytes
(
stream
));
}
catch
(
IOException
e
)
{
logger
.
warn
(
""
,
e
);
return
null
;
}
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
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