示例#1
0
 @Override
 public void init(final ServletConfig config) throws ServletException {
   super.init(config);
   try {
     HTTPContext.init(config.getServletContext());
     final Enumeration<String> en = config.getInitParameterNames();
     while (en.hasMoreElements()) {
       String key = en.nextElement().toLowerCase(Locale.ENGLISH);
       final String val = config.getInitParameter(key);
       if (key.startsWith(Prop.DBPREFIX)) key = key.substring(Prop.DBPREFIX.length());
       if (key.equalsIgnoreCase(MainProp.USER[0].toString())) {
         user = val;
       } else if (key.equalsIgnoreCase(MainProp.PASSWORD[0].toString())) {
         pass = val;
       }
     }
   } catch (final IOException ex) {
     throw new ServletException(ex);
   }
 }
示例#2
0
 @Override
 public void init(final ServletConfig config) throws ServletException {
   super.init(config);
   try {
     HTTPContext.init(config.getServletContext());
     final Enumeration<String> en = config.getInitParameterNames();
     while (en.hasMoreElements()) {
       String key = en.nextElement().toLowerCase(Locale.ENGLISH);
       final String val = config.getInitParameter(key);
       if (key.startsWith(Prop.DBPREFIX)) key = key.substring(Prop.DBPREFIX.length());
       if (key.equalsIgnoreCase(StaticOptions.USER.name())) {
         username = val;
       } else if (key.equalsIgnoreCase(StaticOptions.PASSWORD.name())) {
         password = val;
       } else if (key.equalsIgnoreCase(StaticOptions.AUTHMETHOD.name())) {
         auth = AuthMethod.valueOf(val);
       }
     }
   } catch (final IOException ex) {
     throw new ServletException(ex);
   }
 }