/** * See {@link #setContentLength(int)} for the reasons for proxying. * * @param len * parameter of the proxied method */ @ProxyMethod public void setContentLengthLong(final long len) { contentLengthHeaderModifications.add(new Runnable() { @Override public void run() { wrappedResponse.setContentLengthLong(len); } }); }
/** * Proxy method for isReady method of the OutputStream. * * @return the ready state */ @ProxyMethod(isOptional = true) public boolean isReady() { return originalStream.isReady(); }
@Override @ProxyMethod public void flush() throws IOException { originalStream.flush(); }
@Override @ProxyMethod public void close() throws IOException { originalStream.close(); }
/** * Proxy method for setting the write listener. * * @param listener * write listener which should get set. */ @ProxyMethod(parameterTypes = { "javax.servlet.WriteListener" }, isOptional = true) public void setWriteListener(Object listener) { originalStream.setWriteListener(listener); }
@ProxyMethod(methodName = "doubleInt") public int doubleInt_renamed(int a) { return 2 * a; }
@ProxyMethod public String sayHello() { return "Hello!"; }
@ProxyMethod(returnType = "java.lang.StringBuffer") public Object createStringBuffer() { return new StringBuffer(); }
@ProxyMethod(parameterTypes = { "java.lang.StringBuffer", "java.lang.String" }) public void appendToStringBuffer(Object sb, Object stringToAppend) { ((StringBuffer) sb).append((String) stringToAppend); }
@ProxyMethod public void throwException() throws FileNotFoundException { throw new FileNotFoundException("testtext"); }
/** * Request committed event. This is earliest place we can start a span. * * @throws IOException * IOException */ @ProxyMethod() public void onRequestCommitted() throws IOException { spanStore.startSpan(); if (null != originalListener) { WHttpEventListenerWrapper.ON_REQUEST_COMMITED.call(originalListener); } }
/** * Connection failed. * * @param ex * Throwable */ @ProxyMethod(parameterTypes = "java.lang.Throwable") public void onConnectionFailed(Throwable ex) { handleThrowable(ex); if (null != originalListener) { WHttpEventListenerWrapper.ON_CONNECTION_FAILED.call(originalListener, ex); } }
/** * Exception occurred. * * @param ex * Throwable */ @ProxyMethod(parameterTypes = "java.lang.Throwable") public void onException(Throwable ex) { handleThrowable(ex); if (null != originalListener) { WHttpEventListenerWrapper.ON_EXCEPTION.call(originalListener, ex); } }
/** * Proxy method for print method of the OutputStream. * * @param arg0 * value which should get printed * @throws IOException * signals that an I/O exception in some sort happened */ @ProxyMethod public void print(String arg0) throws IOException { String newValue = injector.performInjection(String.valueOf(arg0)); if (newValue == null) { originalStream.print(arg0); } else { originalStream.print(newValue); } }
@Override @ProxyMethod public void write(int b) throws IOException { byte[] newValue = injector.performInjection(new byte[] { (byte) b }); if (newValue == null) { originalStream.write(b); } else { originalStream.write(newValue); } }
@Override @ProxyMethod public void write(byte[] b) throws IOException { byte[] newValue = injector.performInjection(b); if (newValue == null) { originalStream.write(b); } else { originalStream.write(newValue); } }
@Override @ProxyMethod public void write(byte[] b, int off, int len) throws IOException { byte[] newValue = injector.performInjection(b, off, len); if (newValue == null) { originalStream.write(b, off, len); } else { originalStream.write(newValue); } }
/** * Response complete event. We can finish span here. * * @throws IOException * IOException */ @ProxyMethod public void onResponseComplete() throws IOException { spanStore.finishSpan(new HttpResponseAdapter(this)); if (null != originalListener) { WHttpEventListenerWrapper.ON_RESPONSE_COMPLETE.call(originalListener); } }
/** * Proxy method for println method of the OutputStream. * * @param s * value which should get printed with an following line termination. * @throws IOException * signals that an I/O exception in some sort happened */ @ProxyMethod public void println(String s) throws IOException { String newValue = injector.performInjection(s + NL); if (newValue == null) { originalStream.println(s); } else { originalStream.print(newValue); } }
/** * Proxy method for println method of the OutputStream. Terminates the line. * * @throws IOException * signals that an I/O exception in some sort happened */ @ProxyMethod public void println() throws IOException { String newValue = injector.performInjection(NL); if (newValue == null) { originalStream.println(); } else { originalStream.print(newValue); } }