url-pattern

decorator() got an unexpected keyword argument

拜拜、爱过 提交于 2019-12-10 18:48:33
问题 I have this error on Django view: TypeError at /web/host/1/ decorator() got an unexpected keyword argument 'host_id' Request Method: GET Request URL: http://127.0.0.1:8000/web/host/1/edit Django Version: 1.10.4 Exception Type: TypeError Exception Value: decorator() got an unexpected keyword argument 'host_id' and the urlpatterns is: url(r'^host/(?P<host_id>[0-9]+)$', host, name='host'), the view function is : @check_login def host(request, host_id, *args, **kwargs): h = Host() # resultHost =

Django1.4: Generic way to set language links in template to work with i18n_patterns?

走远了吗. 提交于 2019-12-09 10:33:59
问题 I started to play with new i18n_patterns in Django 1.4. Basically, i want to have language links for each of my supported languages on all of my templates headers. I have implemented my header as a separate template that is being included in other templates. Is there a way to keep my header generic and solve this without passing the current view name or current url in template context? I guess it comes to a question how do i retrieve the current view or url from inside the template in a

Servlet filter url mapping

我与影子孤独终老i 提交于 2019-12-08 19:01:14
问题 How can a filter be mapped to the root of a URL? I'm using Tomcat 7.0.2 and deploying an application as ROOT.war. The welcome page is sign_in.xhtml. I would like to run a filter whenever the client sends a request for the root of the site (i.e. the domain name only), or when the the client requests sign_in.xhtml. Here is what I have so far: <filter> <filter-name>My filter</filter-name> <filter-class>com.myApp.myFilter</filter-class> </filter> <filter-mapping> <filter-name>My filter</filter

/faces/index.xhtml Not Found in ExternalContext as a Resource in Glassfish

自闭症网瘾萝莉.ら 提交于 2019-12-08 16:19:29
问题 I am getting this error while launching application. com.sun.faces.context.FacesFileNotFoundException: /faces/index.xhtml Not Found in ExternalContext as a Resource This is the context of web.xml: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param

tomcat的url-pattern的源码分析

谁说我不能喝 提交于 2019-12-06 21:26:56
#1 静态文件的处理前言分析 最近想把SpringMVC对于静态资源的处理策略弄清楚,如它和普通的请求有什么区别吗? 有人可能就要说了,现在有些静态资源都不是交给这些框架来处理,而是直接交给容器来处理,这样更加高效。我想说的是,虽然是这样,处理静态资源也是MVC框架应该提供的功能,而不是依靠外界。 这里以tomcat容器中的SpringMVC项目为例。整个静态资源的访问,效果图如下: 可以分成如下2个大的过程 tomcat根据url-pattern选择servlet的过程 SpringMVC对静态资源的处理过程(这个留到下一篇文章来详细的源码说明) #2 tomcat的处理策略 这里要看tomcat的源码,所以pom中加入相应依赖,使debug的时候能够定位到源码文件,目前我所使用的tomcat版本为7.0.55,你要是使用的不同版本,则更换下对应依赖的版本就行 <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-catalina</artifactId> <version>7.0.55</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.tomcat</groupId>

java.lang.IllegalArgumentException: Invalid URL Pattern: [xhtml] [duplicate]

为君一笑 提交于 2019-12-04 12:55:48
This question already has an answer here: java.lang.IllegalArgumentException: Invalid <url-pattern> in servlet mapping 2 answers I am trying to deploy a very simple & my first JSF application (following a really good tutorial by BalusC ) on glassfish local server. I completed all the steps to create the application. And when I tried to deploy the application on the glassfish server, it just failed with the following exception message:- cannot Deploy Playground Deployment Error for module: Playground: Exception while deploying the app : java.lang.IllegalArgumentException: Invalid URL Pattern:

Error: /login.xhtml Not Found in ExternalContext as a Resource

亡梦爱人 提交于 2019-12-04 11:26:45
问题 I'm using JBoss 7.1 with JSF 2.1/Prime Faces and keep running into the error listed in the title. I've tried many of the suggestions made here and all end up with the same error. File structure is: WEB-INF faces login.xhtml I have the following in web.xml: <display-name>clientAccountManager</display-name> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name>

Django - Strange behavior using static files

泄露秘密 提交于 2019-12-04 06:15:29
问题 I'm new to Django. I'm getting insane trying to understand what is going on with static files(css's and images). The resume of the problem is the following... when I use static views from a 3rd party App(Haystack) I can't use static files. My project have this directory structure: 1001empbr (name of the folder for the project) | |------ 1001emp (name of the django project) | |------ 1001empbr (name of my App) |------ site_media (folder with static files CSS/JPG/GIF) |------ templates (folder

@WebFilter exclude url-pattern

徘徊边缘 提交于 2019-12-03 19:04:45
问题 I use a filter to check URL patterns for the logged in user. But I have many URL patterns I need to filter. { "/table/*", "/user/*", "/contact/*", "/run/*", "/conf/*", ..., ..., ...} It's becoming unmaintainable. It will be simpler just to exclude: { "/", "/login", "/logout", "/register" } How can I achieve this? @WebFilter(urlPatterns = { "/table/*","/user/*", "/contact/*","/run/*","/conf/*"}) public class SessionTimeoutRedirect implements Filter { protected final Logger logger =

django - regex for optional url parameters

核能气质少年 提交于 2019-12-03 13:13:25
问题 I have a view in django that can accept a number of different filter parameters, but they are all optional. If I have 6 optional filters, do I really have to write urls for every combination of the 6 or is there a way to define what parts of the url are optional? To give you an example with just 2 filters, I could have all of these url possibilities: /<city>/<state>/ /<city>/<state>/radius/<miles>/ /<city>/<state>/company/<company-name>/ /<city>/<state>/radius/<miles>/company/<company-name>/