Bug 690689 - RFE: Maven client should handle 301/302 redirects
Summary: RFE: Maven client should handle 301/302 redirects
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Zanata
Classification: Retired
Component: Component-Maven
Version: unspecified
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Sean Flanigan
QA Contact: Ding-Yi Chen
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-03-25 03:45 UTC by Sean Flanigan
Modified: 2015-07-31 01:51 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-07-31 01:51:08 UTC
Embargoed:


Attachments (Terms of Use)

Description Sean Flanigan 2011-03-25 03:45:01 UTC
At present, the Maven client handles 301 and 302 redirects by trying to parse the HTML response and failing miserably:

[ERROR] Failed to execute goal net.openl10n.flies:flies-maven-plugin:1.2:publican-pull (default-cli) on project null: Flies mojo exception: Unable to find JAXBContext for media type: text/html;charset="iso-8859-1" -> [Help 1]

The Maven client should handle 302 redirects automatically.

In the interests of automation, I'm happy for the client to handle 301 redirects automatically as well (especially if -B is set), but it should log a warning in this case.

Comment 1 Sean Flanigan 2011-09-07 04:32:45 UTC
Assigning to Scrum product owner for prioritisation.

Comment 2 Runa Bhattacharjee 2012-07-30 14:06:59 UTC
Is thist still a problem with the newer versions? Thanks.

Comment 3 Sean Flanigan 2013-10-22 02:24:44 UTC
This should work as of https://github.com/zanata/zanata-client/commit/8db9eb16e8effc648f847f688dc447e6856f254b

client version: 3.1.3-SNAPSHOT

(Java and Maven clients)


NB: this will only work if the redirect is to an equivalent page.  

So if the REST URLs (eg http://zanata.example.com/zanata/rest/myrestservice) are simply directed to zanata's root context (eg http://zanata.example.com/) it won't help.

Comment 4 Ding-Yi Chen 2013-10-29 01:49:09 UTC
Tested with Zanata version 3.2-SNAPSHOT (20131029-0042),
client version 3.1.3-SNAPSHOT

Step to reproduce:
1. Set the redirect
   a. sudo mkdir /var/www/html/zanata
   b. save following as /etc/httpd/conf.d/zanataTest.conf
<Directory "/var/www/html/zanata">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

    c. Save following as /var/www/html/zanata/.htaccess
Redirect 301 /zanata/zp ZANATA_URL_WO_TRAILING_SLASH
Redirect 302 /zanata/zt ZANATA_URL_WO_TRAILING_SLASH

    d. restart httpd

2. mvn -e zanata:put-project -Dzanata.defaultProjectType=podir -Dzanata.projectSlug=About -Dzanata.projectName=About -Dzanata.projectDesc=About -Dzanata.url=REDIRECTURL

Expected:
Success without error

Actual:
[ERROR] Failed to execute goal org.zanata:zanata-maven-plugin:3.1.3-SNAPSHOT:put-project (default-cli) on project null: Zanata mojo exception: javax.ws.rs.ProcessingException: Unable to find a MessageBodyReader of content-type text/html;charset=iso-8859-1 and type class org.zanata.rest.dto.VersionInfo -> [Help 1]                                                             
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.zanata:zanata-maven-plugin:3.1.3-SNAPSHOT:put-project (default-cli) on project null: Zanata mojo exception                                                             
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)                                   
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)                                   
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)                                   
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)           
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)           
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)               
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)                           
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)                                                    
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)                                                      
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)                                                          
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)                                                           
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)                                                             
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                       
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)                                     
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Zanata mojo exception
        at org.zanata.maven.ConfigurableMojo.execute(ConfigurableMojo.java:136)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: org.jboss.resteasy.spi.ReaderException: javax.ws.rs.ProcessingException: Unable to find a MessageBodyReader of content-type text/html;charset=iso-8859-1 and type class org.zanata.rest.dto.VersionInfo
        at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:469)
        at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:385)
        at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:346)
        at org.zanata.rest.client.ZanataProxyFactory.<init>(ZanataProxyFactory.java:88)
        at org.zanata.client.commands.OptionsUtil.createRequestFactory(OptionsUtil.java:151)
        at org.zanata.client.commands.ConfigurableCommand.<init>(ConfigurableCommand.java:43)
        at org.zanata.client.commands.ConfigurableCommand.<init>(ConfigurableCommand.java:47)
        at org.zanata.client.commands.PutProjectCommand.<init>(PutProjectCommand.java:25)
        at org.zanata.maven.PutProjectMojo.initCommand(PutProjectMojo.java:73)
        at org.zanata.maven.PutProjectMojo.initCommand(PutProjectMojo.java:13)
        at org.zanata.maven.ConfigurableMojo.runCommand(ConfigurableMojo.java:143)
        at org.zanata.maven.ConfigurableMojo.execute(ConfigurableMojo.java:134)
        ... 21 more
Caused by: javax.ws.rs.ProcessingException: Unable to find a MessageBodyReader of content-type text/html;charset=iso-8859-1 and type class org.zanata.rest.dto.VersionInfo
        at org.jboss.resteasy.core.interception.ClientReaderInterceptorContext.throwReaderNotFound(ClientReaderInterceptorContext.java:39)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.getReader(AbstractReaderInterceptorContext.java:73)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:50)
        at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.aroundReadFrom(GZIPDecodingInterceptor.java:59)
        at org.jboss.resteasy.core.interception.AbstractReaderInterceptorContext.proceed(AbstractReaderInterceptorContext.java:53)
        at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:433)
        ... 32 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Reassigned.

Comment 5 Damian Jansen 2014-03-06 03:42:08 UTC
Should this be fixed, or at least ON_DEV?

Comment 6 Sean Flanigan 2014-03-06 04:20:47 UTC
I haven't had a chance to investigate the QA failure, so ASSIGNED is probably a little more accurate than ON_DEV.

Comment 7 Michelle Kim 2015-02-24 00:57:30 UTC
Sean, Is this fixed or are we still doing it? Can we close this bug?

Comment 8 Sean Flanigan 2015-02-24 01:30:02 UTC
I don't think this is fixed, but we should not close it.  One of these days, we'll have to change the URL for a Zanata server again, and we'll need redirects to be working already.

Comment 9 Zanata Migrator 2015-07-31 01:51:08 UTC
Migrated; check JIRA for bug status: http://zanata.atlassian.net/browse/ZNTA-577


Note You need to log in before you can comment on or make changes to this bug.