@Override public void protocolCommandSent(ProtocolCommandEvent event) { if (__directionMarker) { __writer.print("> "); } if (__nologin) { String cmd = event.getCommand(); if ("PASS".equalsIgnoreCase(cmd) || "USER".equalsIgnoreCase(cmd)) { __writer.print(cmd); __writer.println(" *******"); // Don't bother with EOL marker for this! } else { final String IMAP_LOGIN = "LOGIN"; if (IMAP_LOGIN.equalsIgnoreCase(cmd)) { // IMAP String msg = event.getMessage(); msg=msg.substring(0, msg.indexOf(IMAP_LOGIN)+IMAP_LOGIN.length()); __writer.print(msg); __writer.println(" *******"); // Don't bother with EOL marker for this! } else { __writer.print(getPrintableString(event.getMessage())); } } } else { __writer.print(getPrintableString(event.getMessage())); } __writer.flush(); }
@Override public void protocolCommandSent( ProtocolCommandEvent event ) { /* because we can only pause a file upload, we check if the event has a STOR command */ if (event.getCommand().equals(FTPCmd.STOR.getCommand())) { // Check only progress events so the transfer be paused when the // transfer is taking place not before or after it. log.debug("Progress event #" + (currentProgessEvent)); if (currentProgessEvent++ == progressEventNumber && Thread.holdsLock(owner)) { try { log.debug("Waiting for the transfer to be resumed..."); // Release the monitor and wait to be notified to continue the transfer. owner.wait(); } catch (InterruptedException e) { log.error("Transfer thread interrupted while paused. Continue transfer.", e); } } } }
public void protocolReplyReceived(ProtocolCommandEvent ev) { try { String info = new String(("receive->"+ev.getReplyCode()+"-"+"c->"+ev.getCommand()+"-"+ev.getMessage()).getBytes("iso8859-1"), "gbk"); if (this.debug && listener != null) listener.onInfo(info); } catch (UnsupportedEncodingException e) { String info = e.toString(); if (listener != null) listener.onError(info, e); } } }
public void protocolCommandSent(ProtocolCommandEvent ev) { try { String info = new String(("sent->"+ev.getReplyCode()+"-"+"c->"+ev.getCommand()+"-"+ev.getMessage()).getBytes("iso8859-1"), "gbk"); if (this.debug && listener != null) listener.onInfo(info); } catch (UnsupportedEncodingException e) { String info = e.toString(); if (listener != null) listener.onError(info, e); } }