Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Genesys Backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
45
Issues
45
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Backend
Commits
a7a839af
Commit
a7a839af
authored
May 04, 2016
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issues with URL encoded paths
parent
1d1068d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
src/main/java/org/genesys2/server/servlet/controller/admin/RepositoryController.java
...server/servlet/controller/admin/RepositoryController.java
+12
-3
src/main/java/org/genesys2/server/servlet/filter/NewGUIFilter.java
...java/org/genesys2/server/servlet/filter/NewGUIFilter.java
+5
-1
src/main/java/org/genesys2/spring/config/SpringServletConfig.java
.../java/org/genesys2/spring/config/SpringServletConfig.java
+13
-0
No files found.
src/main/java/org/genesys2/server/servlet/controller/admin/RepositoryController.java
View file @
a7a839af
...
...
@@ -17,9 +17,11 @@
package
org.genesys2.server.servlet.controller.admin
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.UUID
;
...
...
@@ -49,6 +51,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.servlet.HandlerMapping
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
org.springframework.web.util.UriUtils
;
@Controller
@RequestMapping
(
RepositoryController
.
CONTROLLER_PATH
)
...
...
@@ -65,16 +68,22 @@ public class RepositoryController extends BaseController {
private
ImageGalleryService
imageGalleryService
;
@RequestMapping
(
value
=
"/files/**"
,
method
=
RequestMethod
.
GET
)
public
String
listAllFiles
(
HttpServletRequest
request
,
ModelMap
model
)
{
public
String
listAllFiles
(
HttpServletRequest
request
,
ModelMap
model
)
throws
UnsupportedEncodingException
{
String
fullpath
=
(
String
)
request
.
getAttribute
(
HandlerMapping
.
PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE
);
fullpath
=
fullpath
.
substring
(
CONTROLLER_PATH
.
length
()
+
"/files"
.
length
());
// System.err.println(fullpath);
// The /** mapping does not decode the URL
fullpath
=
UriUtils
.
decode
(
fullpath
,
"UTF-8"
);
return
listAllFiles
(
fullpath
,
model
);
}
@RequestMapping
(
value
=
"/files"
,
method
=
RequestMethod
.
GET
)
public
String
listAllFiles
(
@RequestParam
(
defaultValue
=
"/"
)
String
repositoryPath
,
ModelMap
model
)
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"Listing files for path="
+
repositoryPath
);
}
List
<
RepositoryFile
>
fileList
=
repositoryService
.
getFiles
(
repositoryPath
);
model
.
addAttribute
(
"fileList"
,
fileList
);
model
.
addAttribute
(
"currentPath"
,
repositoryPath
);
...
...
src/main/java/org/genesys2/server/servlet/filter/NewGUIFilter.java
View file @
a7a839af
...
...
@@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletResponseWrapper;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.genesys2.spring.config.NewGUIViewResolver
;
import
org.springframework.web.util.UriUtils
;
/**
* The {@code NewGUIFilter} allows for having URL-based versioned user
...
...
@@ -75,6 +76,7 @@ public class NewGUIFilter implements Filter {
final
HttpServletRequest
httpRequest
=
(
HttpServletRequest
)
servletRequest
;
HttpServletResponse
httpResponse
=
(
HttpServletResponse
)
servletResponse
;
final
String
originalUrl
=
httpRequest
.
getRequestURI
().
substring
(
httpRequest
.
getContextPath
().
length
());
final
String
origianlUrlDecoded
=
UriUtils
.
decode
(
originalUrl
,
"UTF-8"
);
if
(
LOG
.
isTraceEnabled
())
{
LOG
.
trace
(
"Incoming URL: "
+
originalUrl
);
...
...
@@ -95,7 +97,8 @@ public class NewGUIFilter implements Filter {
@Override
public
String
getServletPath
()
{
String
servletPath
=
super
.
getServletPath
();
if
(
originalUrl
.
equals
(
servletPath
))
{
// servletPath is URL decoded, must use origianlUrlDecoded.
if
(
origianlUrlDecoded
.
equals
(
servletPath
))
{
if
(
LOG
.
isDebugEnabled
())
LOG
.
debug
(
"servletPath="
+
servletPath
+
" remaining="
+
remainingUrl
);
return
remainingUrl
;
...
...
@@ -106,6 +109,7 @@ public class NewGUIFilter implements Filter {
@Override
public
String
getRequestURI
()
{
String
requestURI
=
super
.
getRequestURI
();
// requestURI is URL encoded, must use originalUrl.
if
(
originalUrl
.
equals
(
requestURI
))
{
if
(
LOG
.
isDebugEnabled
())
LOG
.
debug
(
"requestURI="
+
requestURI
+
" remaining="
+
remainingUrl
);
...
...
src/main/java/org/genesys2/spring/config/SpringServletConfig.java
View file @
a7a839af
...
...
@@ -143,4 +143,17 @@ public class SpringServletConfig extends WebMvcConfigurerAdapter {
cookieThemeResolver
.
setDefaultThemeName
(
defaultThemeName
);
return
cookieThemeResolver
;
}
// @Override
// public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
// configurer.favorPathExtension(false);
// }
//
// /**
// * http://stackoverflow.com/questions/16332092/spring-mvc-pathvariable-with-dot-is-getting-truncated
// */
// @Override
// public void configurePathMatch(PathMatchConfigurer configurer) {
// configurer.setUseSuffixPatternMatch(false);
// }
}
\ No newline at end of file
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