Exemplo n.º 1
0
  protected Request setupRequest(String serviceURI, HttpServletRequest httpRequest, String opType)
      throws IOException {
    // No reader.  Done by standard servlet form processing.
    Request request = new Request(serviceURI, null);
    // params => request items
    @SuppressWarnings("unchecked")
    Enumeration<String> en = httpRequest.getParameterNames();

    for (; en.hasMoreElements(); ) {
      String k = en.nextElement();
      String[] x = httpRequest.getParameterValues(k);

      for (int i = 0; i < x.length; i++) {
        String s = x[i];
        request.setParam(k, s);
      }
    }
    request.setParam(Joseki.OPERATION, opType);
    return request;
  }
Exemplo n.º 2
0
  private void servletEnv() {
    if (!log.isDebugEnabled()) return;

    try {
      java.net.URL url = servletContext.getResource("/");
      log.trace("Joseki base directory: " + url);
    } catch (Exception ex) {
    }

    if (servletConfig != null) {
      String tmp = servletConfig.getServletName();
      log.trace("Servlet = " + (tmp != null ? tmp : "<null>"));
      @SuppressWarnings("unchecked")
      Enumeration<String> en = servletConfig.getInitParameterNames();

      for (; en.hasMoreElements(); ) {
        String s = en.nextElement();
        log.trace("Servlet parameter: " + s + " = " + servletConfig.getInitParameter(s));
      }
    }
    if (servletContext != null) {
      // Name of webapp
      String tmp = servletContext.getServletContextName();
      // msg(Level.FINE, "Webapp = " + (tmp != null ? tmp : "<null>"));
      log.debug("Webapp = " + (tmp != null ? tmp : "<null>"));

      // NB This servlet may not have been loaded as part of a web app
      @SuppressWarnings("unchecked")
      Enumeration<String> en = servletContext.getInitParameterNames();
      for (; en.hasMoreElements(); ) {
        String s = en.nextElement();
        log.debug("Webapp parameter: " + s + " = " + servletContext.getInitParameter(s));
      }
    }
    /*
    for ( Enumeration enum = servletContext.getAttributeNames() ;  enum.hasMoreElements() ; )
    {
        String s = (String)enum.nextElement() ;
        logger.log(LEVEL, "Webapp attribute: "+s+" = "+context.getAttribute(s)) ;
    }
     */
  }