method path in class Join cannot be applied to given types

Splash Forums Rewrite Users method path in class Join cannot be applied to given types

This topic contains 1 reply, has 2 voices, and was last updated by  Christian Kaltepoth 2 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25213

    captainmorgan
    Participant

    I’ve just set up the following configuration based on the examples:

    
    import javax.servlet.ServletContext;
    import org.ocpsoft.rewrite.annotation.Join;
    import org.ocpsoft.rewrite.annotation.RewriteConfiguration;
    import org.ocpsoft.rewrite.config.Configuration;
    import org.ocpsoft.rewrite.config.ConfigurationBuilder;
    import org.ocpsoft.rewrite.servlet.config.HttpConfigurationProvider;
    import org.ocpsoft.rewrite.servlet.config.Response;
    
    @RewriteConfiguration
    public class ApplicationConfigurationProvider extends HttpConfigurationProvider {
        @Override
       public Configuration getConfiguration(final ServletContext context)
       {
          return ConfigurationBuilder.begin()
    
              // A basic join
              .addRule(Join.path("/").to("/pages/home.xhtml"))
    
              // Using parameters to return physical resources
              .addRule(Join.path("/{param}").to("/pages/{param}.html"))
    
              // Using parameterization (the value of 'p' is converted to a request parameter)
              .addRule(Join.path("/project/{p}").to("/pages/project/create.xhtml"))
    
              // Redirect requests to the server-side resource to the correct location
              .addRule(Join.path("/signup").to("/pages/signup.xhtml").withInboundCorrection())
    
              // Perform additional operations on rule execution
              .addRule(Join.path("/404").to("/pages/404.xhtml").perform(Response.setCode(404)));
    
       }
    
        @Override
        public int priority()
        {
            return 0;
        }
    }
    

    I get the following error on every addRule line:
    method path in class Join cannot be applied to given types;
    required: no arguements
    found: String
    reason: actual and formal argument lists differ in length

    What have I done wrong?

    #25215

    Check your imports. You imported the annotation org.ocpsoft.rewrite.annotation.Join instead of the rule org.ocpsoft.rewrite.servlet.config.rule.Join. Some of the rules and conditions have corresponding annotations. So double check that you are using the correct imports.

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

You must be logged in to reply to this topic.

Comments are closed.