action generation

Splash Forums Rewrite Users action generation

This topic contains 6 replies, has 2 voices, and was last updated by  Christian Kaltepoth 1 year, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #27192

    acm
    Participant

    Hi there:

    I’m trying to add multi language support to my webapp. I’m using rewrite to support URLs such as http://domain/{lang}/{path}. I have tried using a rule as follows:

    .addRule(Join.path("/{lang}/{path}").to("/faces/{path}.xhtml"))
    .where("lang").matches("[a-zA-Z]{2}");

    It works. But this rule for some reason is making my form generated action field to be /faces/{path}.xhtml, when I was expecting /{lang}/{path}. Which makes all the forms useless, because when I try to submit them, the server throws ViewExpiredException.

    If I changed a rule for:

    .addRule(Join.path("/contact").to("/faces/contact.xhtml"));

    Then the action is set to /contact and every form works as expected.

    Is there something that I misunderstand the rewrite? Am I doing something wrong? Is this behaviour correct?

    Thanks in advance,
    Asiel

    #27193

    Could you tell us which dependencies you added to your project? And which container you deploy to?

    #27194

    acm
    Participant

    Hi Christian:

    First of all, thank you for your answer. I added to my pom file the next dependency:

    <dependency>
      <groupId>org.ocpsoft.rewrite</groupId>
      <artifactId>rewrite-servlet</artifactId>
      <version>2.0.12.Final</version>
    </dependency>

    I’m deploying to Wildfly 8.2. I’ve observed this behaviour only when rewrite sends parameters to my views.

    #27195

    acm
    Participant

    I was thinking that maybe you refer to all my dependencies. I add them all:

                 <dependencies>
    		<dependency>
    			<groupId>org.hibernate</groupId>
    			<artifactId>hibernate-core</artifactId>
    			<version>4.3.1.Final</version>
    			<type>jar</type>
    		</dependency>
    	        <dependency>
             	  <groupId>org.hibernate</groupId>
    	          <artifactId>hibernate-entitymanager</artifactId>
            	  <version>4.3.1.Final</version>
    	        </dependency>
            	 <dependency>
    			<groupId>javax</groupId>
    			<artifactId>javaee-api</artifactId>
    			<version>7.0</version>
    			<type>jar</type>
    		</dependency>
    		<dependency>
    			<groupId>javax</groupId>
    			<artifactId>javaee-web-api</artifactId>
    			<version>7.0</version>
    			<scope>provided</scope>
    		</dependency>
    		<dependency>
    			<groupId>org.ocpsoft.rewrite</groupId>
    			<artifactId>rewrite-servlet</artifactId>
    			<version>2.0.12.Final</version>
    		</dependency>
    		<dependency>  
    			<groupId>org.primefaces</groupId>  
    			<artifactId>primefaces</artifactId>  
    			<version>5.2</version>  
    		</dependency>  
    		<dependency>  
    			<groupId>org.primefaces.themes</groupId>  
    			<artifactId>cupertino</artifactId>  
    			<version>1.0.10</version>  
    		</dependency>  
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-web</artifactId>
    			<version>4.0.1.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-config</artifactId>
    			<version>4.0.1.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-core</artifactId>
    			<version>4.0.1.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-acl</artifactId>
    			<version>4.0.1.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.security</groupId>
    			<artifactId>spring-security-taglibs</artifactId>
    			<version>4.0.1.RELEASE</version>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.webflow</groupId>
    			<artifactId>spring-faces</artifactId>
    			<version>2.4.1.RELEASE</version>
    		</dependency>
    	</dependencies>
    #27196

    Could you try to add the JSF integration module to your project dependencies?

    <dependency>
      <groupId>org.ocpsoft.rewrite</groupId>
      <artifactId>rewrite-interfaces-faces</artifactId>
      <version>2.0.12.Final</version>
    </dependency>
    
    #27197

    acm
    Participant

    I think that you meant

    <dependency>
      <groupId>org.ocpsoft.rewrite</groupId>
      <artifactId>rewrite-integration-faces</artifactId>
      <version>2.0.12.Final</version>
    </dependency>

    I added it and, indeed, it solved my problem. Thank you for your help, and for rewrite, it’s an amazing tool.

    Best regards,
    Asiel

    #27198

    Ups. Typo. 😉

    Glad to hear this fixed your problem.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Comments are closed.