Package org.eclipse.jgit.transport

Examples of org.eclipse.jgit.transport.UploadPack


            }
            File srcGitdir = new File(rootDir, args[1]);
            RepositoryCache.FileKey key = RepositoryCache.FileKey.lenient(srcGitdir, FS.DETECTED);
            Repository db = key.open(true /* must exist */);
            if ("git-upload-pack".equals(args[0])) {
                new UploadPack(db).upload(in, out, err);
            } else if ("git-receive-pack".equals(args[0])) {
                new ReceivePack(db).receive(in, out, err);
            } else {
                throw new IllegalArgumentException("Unknown git command: " + command);
            }
View Full Code Here


      HttpServletResponse res, String textForGit) throws IOException {
    ByteArrayOutputStream buf = new ByteArrayOutputStream(128);
    PacketLineOut pckOut = new PacketLineOut(buf);

    boolean sideband;
    UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER);
    if (up != null) {
      try {
        sideband = up.isSideBand();
      } catch (RequestNotYetReadException e) {
        sideband = isUploadPackSideBand(req);
      }
    } else
      sideband = isUploadPackSideBand(req);
View Full Code Here

      public void flush() throws IOException {
        doFlush();
      }
    };

    UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER);
    try {
      up.setBiDirectionalPipe(false);
      rsp.setContentType(UPLOAD_PACK_RESULT_TYPE);

      up.upload(getInputStream(req), out, null);
      out.close();

    } catch (ServiceMayNotContinueException e) {
      if (e.isOutput()) {
        consumeRequestBody(req);
View Full Code Here

    @Override
    protected void begin(HttpServletRequest req, Repository db)
        throws IOException, ServiceNotEnabledException,
        ServiceNotAuthorizedException {
      UploadPack up = uploadPackFactory.create(req, db);
      req.setAttribute(ATTRIBUTE_HANDLER, up);
    }
View Full Code Here

    @Override
    protected void advertise(HttpServletRequest req,
        PacketLineOutRefAdvertiser pck) throws IOException,
        ServiceNotEnabledException, ServiceNotAuthorizedException {
      UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER);
      try {
        up.setBiDirectionalPipe(false);
        up.sendAdvertisedRefs(pck);
      } finally {
        up.getRevWalk().release();
      }
    }
View Full Code Here

    public void doFilter(ServletRequest request, ServletResponse response,
        FilterChain chain) throws IOException, ServletException {
      HttpServletRequest req = (HttpServletRequest) request;
      HttpServletResponse rsp = (HttpServletResponse) response;
      UploadPack rp;
      try {
        rp = uploadPackFactory.create(req, getRepository(req));
      } catch (ServiceNotAuthorizedException e) {
        rsp.sendError(SC_UNAUTHORIZED);
        return;
View Full Code Here

    try {
      SshKey key = getContext().getClient().getKey();
      if (key != null && !key.canClone()) {
        throw new Failure(1, "Sorry, your SSH public key is not allowed to clone!");
      }
      UploadPack up = uploadPackFactory.create(getContext().getClient(), repo);
      up.upload(in, out, null);
    } catch (Exception e) {
      throw new Failure(1, "fatal: Cannot upload pack: ", e);
    }
  }
View Full Code Here

          @Override
          protected void execute(final GitDaemonClient dc, final Repository db)
              throws IOException, ServiceNotEnabledException,
              ServiceNotAuthorizedException {
            UploadPack up = uploadPackFactory.create(dc, db);
            InputStream in = dc.getInputStream();
            OutputStream out = dc.getOutputStream();
            up.upload(in, out, null);
          }
        }, new GitDaemonService("receive-pack", "receivepack") {
          {
            setEnabled(true);
            setOverridable(false);
View Full Code Here

      GitDaemonClient client = (GitDaemonClient) req;
      // set timeout from Git daemon
      timeout = client.getDaemon().getTimeout();
    }

    UploadPack up = new UploadPack(db);
    up.setTimeout(timeout);

    return up;
  }
View Full Code Here

      HttpServletResponse res, String textForGit) throws IOException {
    ByteArrayOutputStream buf = new ByteArrayOutputStream(128);
    PacketLineOut pckOut = new PacketLineOut(buf);

    boolean sideband;
    UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER);
    if (up != null) {
      try {
        sideband = up.isSideBand();
      } catch (RequestNotYetReadException e) {
        sideband = isUploadPackSideBand(req);
      }
    } else
      sideband = isUploadPackSideBand(req);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.transport.UploadPack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.