Tabnine Logo
FileLfsServlet.sendError
Code IndexAdd Tabnine to your IDE (free)

How to use
sendError
method
in
org.eclipse.jgit.lfs.server.fs.FileLfsServlet

Best Java code snippets using org.eclipse.jgit.lfs.server.fs.FileLfsServlet.sendError (Showing top 8 results out of 315)

origin: org.eclipse.jgit/org.eclipse.jgit.lfs.server

  /**
   * {@inheritDoc}
   *
   * Handle errors
   */
  @Override
  public void onError(Throwable e) {
    try {
      FileLfsServlet.sendError(response,
          HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getMessage());
      context.complete();
      in.close();
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, ex.getMessage(), ex);
    }
  }
}
origin: sonia.jgit/org.eclipse.jgit.lfs.server

  /**
   * Handle errors
   *
   * @param e
   *            the cause
   */
  @Override
  public void onError(Throwable e) {
    try {
      FileLfsServlet.sendError(response,
          HttpStatus.SC_INTERNAL_SERVER_ERROR, e.getMessage());
      context.complete();
      in.close();
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, ex.getMessage(), ex);
    }
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.lfs.server

  /** {@inheritDoc} */
  @Override
  public void onError(Throwable e) {
    try {
      out.abort();
      inChannel.close();
      channel.close();
      int status;
      if (e instanceof CorruptLongObjectException) {
        status = HttpStatus.SC_BAD_REQUEST;
        LOG.log(Level.WARNING, e.getMessage(), e);
      } else {
        status = HttpStatus.SC_INTERNAL_SERVER_ERROR;
        LOG.log(Level.SEVERE, e.getMessage(), e);
      }
      FileLfsServlet.sendError(response, status, e.getMessage());
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, ex.getMessage(), ex);
    }
  }
}
origin: sonia.jgit/org.eclipse.jgit.lfs.server

private AnyLongObjectId getObjectToTransfer(HttpServletRequest req,
    HttpServletResponse rsp) throws IOException {
  String info = req.getPathInfo();
  int length = 1 + Constants.LONG_OBJECT_ID_STRING_LENGTH;
  if (info.length() != length) {
    sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, MessageFormat
        .format(LfsServerText.get().invalidPathInfo, info));
    return null;
  }
  try {
    return LongObjectId.fromString(info.substring(1, length));
  } catch (InvalidLongObjectIdException e) {
    sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, e.getMessage());
    return null;
  }
}
origin: sonia.jgit/org.eclipse.jgit.lfs.server

  /**
   * @param e
   *            the exception that caused the problem
   */
  @Override
  public void onError(Throwable e) {
    try {
      out.abort();
      inChannel.close();
      channel.close();
      int status;
      if (e instanceof CorruptLongObjectException) {
        status = HttpStatus.SC_BAD_REQUEST;
        LOG.log(Level.WARNING, e.getMessage(), e);
      } else {
        status = HttpStatus.SC_INTERNAL_SERVER_ERROR;
        LOG.log(Level.SEVERE, e.getMessage(), e);
      }
      FileLfsServlet.sendError(response, status, e.getMessage());
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, ex.getMessage(), ex);
    }
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.lfs.server

/**
 * Retrieve object id from request
 *
 * @param req
 *            servlet request
 * @param rsp
 *            servlet response
 * @return object id, or <code>null</code> if the object id could not be
 *         retrieved
 * @throws java.io.IOException
 *             if an I/O error occurs
 * @since 4.6
 */
protected AnyLongObjectId getObjectToTransfer(HttpServletRequest req,
    HttpServletResponse rsp) throws IOException {
  String info = req.getPathInfo();
  int length = 1 + Constants.LONG_OBJECT_ID_STRING_LENGTH;
  if (info.length() != length) {
    sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, MessageFormat
        .format(LfsServerText.get().invalidPathInfo, info));
    return null;
  }
  try {
    return LongObjectId.fromString(info.substring(1, length));
  } catch (InvalidLongObjectIdException e) {
    sendError(rsp, HttpStatus.SC_UNPROCESSABLE_ENTITY, e.getMessage());
    return null;
  }
}
origin: org.eclipse.jgit/org.eclipse.jgit.lfs.server

/**
 * {@inheritDoc}
 *
 * Handle object downloads
 */
@Override
protected void doGet(HttpServletRequest req,
    HttpServletResponse rsp) throws ServletException, IOException {
  AnyLongObjectId obj = getObjectToTransfer(req, rsp);
  if (obj != null) {
    if (repository.getSize(obj) == -1) {
      sendError(rsp, HttpStatus.SC_NOT_FOUND, MessageFormat
          .format(LfsServerText.get().objectNotFound,
              obj.getName()));
      return;
    }
    AsyncContext context = req.startAsync();
    context.setTimeout(timeout);
    rsp.getOutputStream()
        .setWriteListener(new ObjectDownloadListener(repository,
            context, rsp, obj));
  }
}
origin: sonia.jgit/org.eclipse.jgit.lfs.server

/**
 * Handles object downloads
 *
 * @param req
 *            servlet request
 * @param rsp
 *            servlet response
 * @throws ServletException
 *             if a servlet-specific error occurs
 * @throws IOException
 *             if an I/O error occurs
 */
@Override
protected void doGet(HttpServletRequest req,
    HttpServletResponse rsp) throws ServletException, IOException {
  AnyLongObjectId obj = getObjectToTransfer(req, rsp);
  if (obj != null) {
    if (repository.getSize(obj) == -1) {
      sendError(rsp, HttpStatus.SC_NOT_FOUND, MessageFormat
          .format(LfsServerText.get().objectNotFound,
              obj.getName()));
      return;
    }
    AsyncContext context = req.startAsync();
    context.setTimeout(timeout);
    rsp.getOutputStream()
        .setWriteListener(new ObjectDownloadListener(repository,
            context, rsp, obj));
  }
}
org.eclipse.jgit.lfs.server.fsFileLfsServletsendError

Javadoc

Send an error response.

Popular methods of FileLfsServlet

  • getObjectToTransfer
    Retrieve object id from request

Popular in Java

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Permission (java.security)
    Legacy security code; do not use.
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now