org.apache.maven.wagon.providers.http.LightweightHttpWagon Java Examples

The following examples show how to use org.apache.maven.wagon.providers.http.LightweightHttpWagon. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ManualWagonProvider.java    From furnace with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * @see org.sonatype.aether.connector.wagon.WagonProvider#lookup(java.lang.String)
 */
@Override
public Wagon lookup(final String roleHint) throws Exception
{
   if (roleHint.equals(HTTP))
   {
      return setAuthenticator(new LightweightHttpWagon());
   }
   else if (roleHint.equals(HTTPS))
   {
      return setAuthenticator(new LightweightHttpsWagon());
   }
   else if (roleHint.equals(FILE))
   {
      return new FileWagon();
   }

   throw new RuntimeException("Role hint not supported: " + roleHint);
}
 
Example #2
Source File: RepositorySystemFactory.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
@Override
public Wagon lookup(String roleHint) throws Exception {
  if ("http".equals(roleHint)) {
    return new LightweightHttpWagon();
  }

  if ("https".equals(roleHint)) {
    return new HttpWagon();
  }

  return null;
}
 
Example #3
Source File: ManualWagonProvider.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
private LightweightHttpWagon setAuthenticator(final LightweightHttpWagon wagon)
{
   final Field authenticator;
   try
   {
      authenticator = AccessController.doPrivileged(new PrivilegedExceptionAction<Field>()
      {
         @Override
         public Field run() throws Exception
         {
            final Field field = LightweightHttpWagon.class.getDeclaredField("authenticator");
            field.setAccessible(true);
            return field;
         }
      });
   }
   catch (final PrivilegedActionException pae)
   {
      throw new RuntimeException("Could not manually set authenticator to accessible on "
               + LightweightHttpWagon.class.getName(), pae);
   }
   try
   {
      authenticator.set(wagon, new LightweightHttpWagonAuthenticator());
   }
   catch (final Exception e)
   {
      throw new RuntimeException("Could not manually set authenticator on " + LightweightHttpWagon.class.getName(),
               e);
   }

   // SHRINKRES-69
   // Needed to ensure that we do not cache BASIC Auth values
   wagon.setPreemptiveAuthentication(true);

   return wagon;
}