Package nexj.core.rpc

Examples of nexj.core.rpc.CharacterStreamServer


      final Lookup paramMap = (isMultipart()) ? getMultipartParameters(null, 0) : null;

      m_bURLEncoded = (getParameter("url-encoded") != null || paramMap != null && paramMap.get("url-encoded") != null);
      m_response.setContentType((m_bURLEncoded) ? "text/plain; charset=UTF-8" : m_sContentType);

      CharacterStreamServer server = (CharacterStreamServer)m_server.getInstance(m_context);

      if (server instanceof HTTPServer)
      {
         ((HTTPServer)server).invoke(m_servlet, m_request, m_response);
      }

      if (paramMap != null)
      {
         Object req = paramMap.get("request");

         if (!(req instanceof String[]) || ((String[])req).length != 1)
         {
            throw new RequestException("err.rpc.attachment");
         }

         req = ((String[])req)[0];

         if (m_bURLEncoded)
         {
            req = URLDecoder.decode((String)req, m_request.getCharacterEncoding());
         }

         // Enhance the request with data from parameters "file-<argIndex>-<dataAttr>-<fileNameAttr>"
         server.invoke(new StringReader((String)req), getWriter(), new Preprocessor()
         {
            public void preprocess(Request request)
            {
               addMultipartData(request, paramMap);
            }
         });
      }
      else
      {
         server.invoke(getReader(), getWriter(), null);
      }
   }
View Full Code Here

TOP

Related Classes of nexj.core.rpc.CharacterStreamServer

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.