Package jeeves.server.sources.http

Examples of jeeves.server.sources.http.HttpServiceRequest


          info(" -> forwarding to : " + forward);

                    // Use servlet redirect for user.login and user.logout services.
                    // TODO: Make redirect configurable for services in jeeves
                    if (srvName.equals("metadata.quiet.delete") || srvName.equals("user.login") || srvName.equals("user.logout")) {
                        HttpServiceRequest req2 = (HttpServiceRequest) req;

                        req2.getHttpServletResponse().setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
                        req2.getHttpServletResponse().setHeader("Location", baseUrl + "/" + context.getApplicationContext().getBean
                                (NodeInfo.class).getId() + "/" + req.getLanguage() + "/" + forward);

                        return;
                    } else {
          Element elForward = new Element(Jeeves.Elem.FORWARD);
View Full Code Here


      }
    }

    //--- extract basic info

    HttpServiceRequest srvReq = new HttpServiceRequest(res);

    srvReq.setDebug       (extractDebug(url));
    srvReq.setLanguage    (extractLanguage(url));
    srvReq.setService     (extractService(url));
        srvReq.setJSONOutput  (extractJSONFlag(req.getQueryString()));
    String ip = req.getRemoteAddr();
    String forwardedFor = req.getHeader("x-forwarded-for");
    if (forwardedFor != null) ip = forwardedFor;
    srvReq.setAddress     (ip);
    srvReq.setOutputStream(res.getOutputStream());

    //--- discover the input/output methods

    String accept = req.getHeader("Accept");

    if (accept != null)
    {
      int soapNDX = accept.indexOf("application/soap+xml");
      int xmlNDX  = accept.indexOf("application/xml");
      int htmlNDX = accept.indexOf("html");

      if (soapNDX != -1)
        srvReq.setOutputMethod(OutputMethod.SOAP);

      else if (xmlNDX != -1 && htmlNDX == -1)
        srvReq.setOutputMethod(OutputMethod.XML);
    }

    if ("POST".equals(req.getMethod()))
    {
      srvReq.setInputMethod(InputMethod.POST);

      String contType = req.getContentType();

      if (contType != null)
      {
        if (contType.indexOf("application/soap+xml") != -1)
        {
          srvReq.setInputMethod (InputMethod.SOAP);
          srvReq.setOutputMethod(OutputMethod.SOAP);
        }

        else if (contType.indexOf("application/xml") != -1 || contType.indexOf("text/xml") != -1)
          srvReq.setInputMethod(InputMethod.XML);
      }
    }

    //--- retrieve input parameters

    InputMethod input = srvReq.getInputMethod();

    if ((input == InputMethod.XML) || (input == InputMethod.SOAP))
    {
      if (req.getMethod().equals("GET"))
        srvReq.setParams(extractParameters(req, uploadDir, maxUploadSize));
      else
        srvReq.setParams(extractXmlParameters(req));
    }
    else
    {
      //--- GET or POST
      srvReq.setParams(extractParameters(req, uploadDir, maxUploadSize));
    }

    srvReq.setHeaders(extractHeaders(req));
   
    return srvReq;
  }
View Full Code Here

TOP

Related Classes of jeeves.server.sources.http.HttpServiceRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.