Reputation: 1614
I have a Jetty server 7 running in Android 6. It listens to custom incoming HTTP methods.
It works however, in the ADB log it shows a peculiar System.err
. There is not much info about it.
02-17 02:33:31.461 12626 12626 W System.err: 2018-02-17 02:33:31.461:INFO:oejs.Server:jetty-7.x.y-SNAPSHOT
02-17 02:33:31.496 12626 12626 W System.err: 2018-02-17 02:33:31.495:INFO:oejs.AbstractConnector:Started [email protected]:8082
What is this error.
This is code implementation, partial. Complete MainActivity here.
public class HelloWorld extends AbstractHandler
{
@Override
public void handle( String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response ) throws IOException,
ServletException
{
// Declare response encoding and types
try {
response.setContentType("text/html; charset=utf-8");
// Declare response status code
response.setStatus(HttpServletResponse.SC_OK);
// Write back response
response.getWriter().println("Hello World");
} catch (UnsupportedEncodingException ec) {
Log.w("JettyTest", "There is a UnsupportedEncodingException");
Log.w("JettyTest", ec);
}
// Inform jetty that this request has now been handled
baseRequest.setHandled(true);
String requestMethod = baseRequest.getMethod().toUpperCase();
StringBuffer jb = new StringBuffer();
String line = null;
Map<String, String> map = new HashMap<String, String>();
try {
switch (requestMethod) {
case "POST":
// do post logic
Log.w("JettyTest", "Handle POST request");
break;
case "NOTIFY":
// do notify logic
Log.w("JettyTest", "Handle NOTIFY request");
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String key = (String) headerNames.nextElement();
String value = request.getHeader(key);
map.put(key, value);
}
for (String key : map.keySet()) {
System.out.println(key + ": " + map.get(key));
Log.w("JettyTest", key + ": " + map.get(key));
}
Log.w("JettyTest", "Remote: "+request.getRemoteHost()+":"+request.getRemotePort());
BufferedReader reader = request.getReader();
while ((line = reader.readLine()) != null)
jb.append(line);
Log.w("JettyTest", jb.toString());
break;
case "GET":
// do get logic
Log.w("JettyTest", "Handle GET request");
break;
default:
// do default
Log.w("JettyTest", "NOT IMPLEMENTED");
}
} catch (Exception e) {
Log.w("JettyTest", "Server error within handle method.");
Log.w("JettyTest",e);
}
}
} // end HelloWorld
Complete ADB Log
02-17 02:33:31.154 21021 21792 I ActivityManager: Start proc 12626:com.example.arjun.hellotest/u0a239 for activity com.example.arjun.hellotest/.MainActivity
02-17 02:33:31.160 12626 12626 I art : Late-enabling -Xcheck:jni
02-17 02:33:31.198 12626 12626 D TidaProvider: TidaProvider()
02-17 02:33:31.228 22074 22141 D WtProcessController: set foreground process size 1 pid:12626pacakgeName:com.example.arjun.hellotest
02-17 02:33:31.262 12626 12626 W System : ClassLoader referenced unknown path: /data/app/com.example.arjun.hellotest-1/lib/arm64
02-17 02:33:31.307 12626 12626 W art : Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
02-17 02:33:31.441 12626 12626 I art : Rejecting re-init on previously-failed class java.lang.Class<org.eclipse.jetty.util.log.JettyAwareLogger>
02-17 02:33:31.442 12626 12626 I art : Rejecting re-init on previously-failed class java.lang.Class<org.eclipse.jetty.util.log.JettyAwareLogger>
02-17 02:33:31.461 12626 12626 W System.err: 2018-02-17 02:33:31.461:INFO:oejs.Server:jetty-7.x.y-SNAPSHOT
02-17 02:33:31.496 12626 12626 W System.err: 2018-02-17 02:33:31.495:INFO:oejs.AbstractConnector:Started [email protected]:8082
02-17 02:33:31.526 12626 12673 D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
02-17 02:33:31.536 12626 12626 D ActivityThreadInjector: clearCachedDrawables.
02-17 02:33:31.625 12626 12673 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.UM.5.3_RB1.06.00.01.211.056_msm8937_64_refs/tags/AU_LINUX_ANDROID_LA.UM.5.3_RB1.06.00.01.211.056__release_AU (I48a9d37399)
02-17 02:33:31.625 12626 12673 I Adreno-EGL: OpenGL ES Shader Compiler Version: XE031.08.00.00
02-17 02:33:31.625 12626 12673 I Adreno-EGL: Build Date: 10/18/16 Tue
02-17 02:33:31.625 12626 12673 I Adreno-EGL: Local Branch:
02-17 02:33:31.625 12626 12673 I Adreno-EGL: Remote Branch: refs/tags/AU_LINUX_ANDROID_LA.UM.5.3_RB1.06.00.01.211.056
02-17 02:33:31.625 12626 12673 I Adreno-EGL: Local Patches: NONE
02-17 02:33:31.625 12626 12673 I Adreno-EGL: Reconstruct Branch: NOTHING
02-17 02:33:31.633 12626 12673 I OpenGLRenderer: Initialized EGL, version 1.4
02-17 02:33:31.672 12626 12673 E HAL : Dawei load: module=/system/lib64/hw/gralloc.msm8937.so
02-17 02:33:31.681 12626 12673 E HAL : Dawei load: module=/system/lib64/hw/gralloc.msm8937.so
02-17 02:33:53.361 12626 12661 W JettyTest: Handle GET request
Build.gradle I have implementation 'org.eclipse.jetty:jetty-webapp:7.6.21.v20160908'
Upvotes: 0
Views: 137
Reputation: 49462
Those events are showing up on System.err
.
You have the default logging configured in Jetty which writes to System.err
via the StdErrLog
implementation.
You'll probably want to write your own Logger interface for Jetty to use.
You might want to look at the ancient i-jetty
codebase for some ideas on how to do this.
Note: i-jetty is built against Jetty 7, which is now EOL (End of Life). It is not recommended to use Jetty 7 on the public internet, especially with SSL/TLS.
Upvotes: 1