def get_context_path(self, request: HttpServletRequest) -> str:
     contextPath: str = request.get_attribute(
         WebUtils.INCLUDE_SERVLET_PATH_ATTRIBUTE)
     if not contextPath:
         contextPath = request.get_context_path()
     if contextPath == "/":
         contextPath = ""
     return self.decode_request_string(request, contextPath)
Beispiel #2
0
 def set_session_attribute(cls, request: HttpServletRequest, name: str,
                           value):
     if request is None:
         raise AssertionError("Request must not be null")
     if value is not None:
         request.get_session().set_attribute(name, value)
     else:
         session: HttpSession = request.get_session(False)
         if session is not None:
             session.remove_attribute(name)
 def init_lookup_path(self, request: HttpServletRequest) -> str:
     if self.uses_path_patterns():
         request.remove_attribute(UrlPathHelper.PATH_ATTRIBUTE)
         requestPath = ServletRequestPathUtils.get_parsed_request_path(
             request)
         lookupPath = requestPath.path_within_application().value()
         return UrlPathHelper.defaultInstance.remove_semicolon_content(
             lookupPath)
     else:
         return self.get_url_path_helper().resolve_and_cache_lookup_path(
             request)
 def get_path_within_servlet_mapping(self, request: HttpServletRequest,
                                     pathWithinApp: str) -> str:
     servletPath: str = request.get_servlet_path()
     sanitizedPathWithinApp: str = self.get_sanitized_path(pathWithinApp)
     path: str = ""
     if sanitizedPathWithinApp in servletPath:
         path = self.get_remaining_path(sanitizedPathWithinApp, servletPath,
                                        False)
     else:
         path = self.get_remaining_path(pathWithinApp, servletPath, False)
     if path:
         return path
     else:
         return request.get_path_info()
Beispiel #5
0
 def init_lookup_path(self, request: HttpServletRequest):
     logging.info(f"[request.pathInfo] = {request.pathInfo()}")
     return request.pathInfo()
Beispiel #6
0
 def get_session_attribute(cls, request: HttpServletRequest, name: str):
     if request is None:
         raise AssertionError("Request must not be null")
     session: HttpSession = request.get_session(False)
     return session.get_attribute(name) if session is not None else None
Beispiel #7
0
 def get_session_id(cls, request: HttpServletRequest):
     if request is None:
         raise AssertionError("Request must not be null")
     session: HttpSession = request.get_session(False)
     return session.get_id() if session is not None else None
 def get_request_uri(self, request: HttpServletRequest) -> str:
     uri: str = request.get_attribute(
         WebUtils.INCLUDE_REQUEST_URI_ATTRIBUTE)
     if not uri:
         uri = request.get_request_uri()
     return self.decode_and_clean_uri_string(request, uri)
 def resolve_and_cache_lookup_path(self,
                                   request: HttpServletRequest) -> str:
     lookupPath: str = self.get_lookup_path_for_request(request)
     logging.info(f"[lookupPath] = {lookupPath}")
     request.set_attribute(self.PATH_ATTRIBUTE, lookupPath)
     return lookupPath