* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Pithos implements EntryPoint, ResizeHandler {
+ private static final boolean IsLOGEnabled = true;
+ public static final boolean IsDetailedHTTPLOGEnabled = true;
+ public static final Set<String> HTTPHeadersToIgnoreInLOG = new HashSet<String>();
+ static {
+ HTTPHeadersToIgnoreInLOG.add(Const.HTTP_HEADER_CONNECTION);
+ HTTPHeadersToIgnoreInLOG.add(Const.HTTP_HEADER_DATE);
+ HTTPHeadersToIgnoreInLOG.add(Const.HTTP_HEADER_KEEP_ALIVE);
+ HTTPHeadersToIgnoreInLOG.add(Const.HTTP_HEADER_SERVER);
+ HTTPHeadersToIgnoreInLOG.add(Const.HTTP_HEADER_VARY);
+ }
public static final Configuration config = GWT.create(Configuration.class);
}
}-*/;
- public static void LOG(Object ...args) {
- if(false) {
- final StringBuilder sb = new StringBuilder();
- for(Object arg : args) {
- if(arg instanceof Throwable) {
- final Throwable error = (Throwable) arg;
- sb.append("\nException: [" + error.toString().replace("\n", "\n ") + "]");
- Throwable cause = error.getCause();
- if(cause != null) {
- sb.append("\nCauses:\n");
- while(cause != null) {
- sb.append(" ");
- sb.append("[" + cause.toString().replace("\n", "\n ") + "]");
- sb.append("\n");
- cause = cause.getCause();
- }
- }
- else {
- sb.append("\n");
- }
-
- StackTraceElement[] stackTrace = error.getStackTrace();
- sb.append("Stack trace (" + stackTrace.length + " elements):\n");
- for(int i = 0; i < stackTrace.length; i++) {
- StackTraceElement errorElem = stackTrace[i];
- sb.append(" [" + i + "] ");
- sb.append(errorElem.toString());
- sb.append("\n");
- }
- }
- else {
- sb.append(arg);
- }
+ public static void LOGError(Throwable error, StringBuilder sb) {
+ if(!IsLOGEnabled) { return; }
+
+ sb.append("\nException: [" + error.toString().replace("\n", "\n ") + "]");
+ Throwable cause = error.getCause();
+ if(cause != null) {
+ sb.append("\nCauses:\n");
+ while(cause != null) {
+ sb.append(" ");
+ sb.append("[" + cause.toString().replace("\n", "\n ") + "]");
+ sb.append("\n");
+ cause = cause.getCause();
}
+ }
+ else {
+ sb.append("\n");
+ }
+ StackTraceElement[] stackTrace = error.getStackTrace();
+ sb.append("Stack trace (" + stackTrace.length + " elements):\n");
+ for(int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement errorElem = stackTrace[i];
+ sb.append(" [" + i + "] ");
+ sb.append(errorElem.toString());
+ sb.append("\n");
+ }
+ }
- if(sb.length() > 0) {
- __ConsoleLog(sb.toString());
+ public static void LOGError(Throwable error) {
+ if(!IsLOGEnabled) { return; }
+
+ final StringBuilder sb = new StringBuilder();
+ LOGError(error, sb);
+ if(sb.length() > 0) {
+ __ConsoleLog(sb.toString());
+ }
+ }
+
+ public static boolean isLogEnabled() {
+ return IsLOGEnabled;
+ }
+
+ public static void LOG(Object ...args) {
+ if(!IsLOGEnabled) { return; }
+
+ final StringBuilder sb = new StringBuilder();
+ for(Object arg : args) {
+ if(arg instanceof Throwable) {
+ LOGError((Throwable) arg, sb);
+ }
+ else {
+ sb.append(arg);
}
}
+
+ if(sb.length() > 0) {
+ __ConsoleLog(sb.toString());
+ }
}
private void initialize() {
+ userCatalogs.updateWithIDAndName("*", "All Pithos users");
+
lastModified = new Date(); //Initialize if-modified-since value with now.
resources.pithosCss().ensureInjected();
boolean bareContent = Window.Location.getParameter("noframe") != null;
- String contentWidth = bareContent ? Const.PERCENT_100 : "75%";
+ String contentWidth = bareContent ? Const.PERCENT_100 : Const.PERCENT_75;
VerticalPanel outer = new VerticalPanel();
outer.setWidth(Const.PERCENT_100);
public void setError(Throwable t) {
error = t;
+ LOG(t);
}
public void showRelevantToolbarButtons() {
@Override
public void onError(Throwable _t) {
- LOG(_t);
setError(_t);
if(_t instanceof RestException) {
displayError("Unable to create folder: " + ((RestException) _t).getHttpStatusText());