Package com.zaranux.os.server.core

Examples of com.zaranux.os.server.core.Response


        logger.finest("SC_UNAUTHORIZED");
        return;
      }

      logger.finest("GET: ZaranuxServlet.kernel.execute ->  " +  path +" , " +   requester.getID());
      Response output;
      try
      {
        output = kernel.execute("read", path, "0,-1", request.getInputStream(), false , requester);
        //if(output.isStream())
        writeStream(output.getInputStream(), response.getOutputStream(), output.getSize()); //output.getSize() -> -1 read all
        return;
      }catch(UnauthorizedAccessException e)
      {
        output = new Response(e);
        response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
      }catch(InvalidParameter e)
      {
        output = new Response(e);
        response.sendError(HttpServletResponse.SC_BAD_REQUEST);
      }catch(SystemCallNotSupported e)
      {
        output = new Response(e);
        response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
      }catch(ResourceNotFound e)
      {
        output = new Response(e);
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
      }catch(ResourceAccessFailed e)
      {
        output = new Response(e);
        response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
      }catch(NotDirectory e)
      {
        output = new Response(e);
        response.sendError(HttpServletResponse.SC_NOT_FOUND);
      }catch(NotFile e)
      {
        //try
        //{
          //output = explorerScript(Kernel.normalize(path, requester));
        String server = request.getServerName()  + ":" + request.getServerPort();
        if(server.startsWith("localhost"))
        {
          server = server + "/zaranux";
          path = path + "&gwt.codesvr=127.0.0.1:9997";
        }
       
        String site = "http://" +  server;
        if(path.startsWith("/")) path = path.substring(1);
        response.sendRedirect(site+ "?" +path);
        return;
        //}catch(InvalidParameter e2)
        //{
        //  output = new Response(e2);
        //  response.sendError(HttpServletResponse.SC_BAD_REQUEST);
        //}
      }
      // print error message
      response.getWriter().write(output.toString());
    }
    catch(IOException e)
    {
      logger.severe("ZaranuxServlet: GET : " + e);
    }
View Full Code Here


        return;
      }
     
      logger.finest("ZaranuxServlet.kernel.execute -> " + systemcall + " , " +  path +" , " + parameterList + ","  +  isBase64 + "," +  requester.getID() + "," + requester.getIDAssertion());

      Response output = null;
      InputStream is = null;
      if("fileupload".equals(systemcall))
      {
        is = new FileUploadInputStream(request);
      }
      else
      {
        is =request.getInputStream();       
      }
     
      try
      {
        output = kernel.execute(systemcall, path, parameterList, is, isBase64, requester);

      }catch(UnauthorizedAccessException e)
      {
        output = new Response(e);
        //response.getWriter().write(output.toString());
        //response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
      }catch(InvalidParameter e)
      {
        output = new Response(e);
        //response.getWriter().write(output.toString());
        //response.sendError(HttpServletResponse.SC_BAD_REQUEST);
      }catch(SystemCallNotSupported e)
      {
        output = new Response(e);
        //response.getWriter().write(output.toString());
        //response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
      }catch(ResourceNotFound e)
      {
        output = new Response(e);
        //response.getWriter().write(output.toString());
        //response.sendError(HttpServletResponse.SC_NOT_FOUND);
      }catch(ResourceAccessFailed e)
      {
        output = new Response(e);
        //response.getWriter().write(output.toString());
        //response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
      }catch(NotDirectory e)
      {
        output = new Response(e);
        //response.getWriter().write(output.toString());
        //response.sendError(HttpServletResponse.SC_NOT_FOUND);
      }catch(NotFile e)
      {
        output = new Response(e);
        //response.getWriter().write(output.toString());
        //response.sendError(HttpServletResponse.SC_NOT_FOUND);
      }
      if(output.isStream())
        writeStream(output.getInputStream(), response.getOutputStream(), output.getSize());
      else
        response.getWriter().write(output.toString())
    }
    catch(IOException e)
    {
      logger.severe("ZaranuxServlet: " + e);
    }
View Full Code Here

                    String data = (BASE64data == null) ? "" : BASE64data;
          
                    Identity requester = new Identity(id, identityAssertion, "");

                    logger.finest("Zaranuxlet.kernel.execute -> " + systemcall + " , " +  path +" , " + parameterList + ","  +  isBase64 + "," +  requester.getID());
                    Response output;
                  try
                  {
                    output = ( new Kernel()).execute(systemcall, path, parameterList, new ByteArrayInputStream(data.getBytes()), isBase64, requester);
                }catch(UnauthorizedAccessException e)
                {
                  output = new Response(e);
                  //response.getWriter().write(output.toString());
                  //response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
                }catch(InvalidParameter e)
                {
                  output = new Response(e);
                  //response.getWriter().write(output.toString());
                  //response.sendError(HttpServletResponse.SC_BAD_REQUEST);
                }catch(SystemCallNotSupported e)
                {
                  output = new Response(e);
                  //response.getWriter().write(output.toString());
                  //response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED);
                }catch(ResourceNotFound e)
                {
                  output = new Response(e);
                  //response.getWriter().write(output.toString());
                  //response.sendError(HttpServletResponse.SC_NOT_FOUND);
                }catch(ResourceAccessFailed e)
                {
                  output = new Response(e);
                  //response.getWriter().write(output.toString());
                  //response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                }catch(NotDirectory e)
                {
                  output = new Response(e);
                  //response.getWriter().write(output.toString());
                  //response.sendError(HttpServletResponse.SC_NOT_FOUND);
                }catch(NotFile e)
                {
                  output = new Response(e);
                  //response.getWriter().write(output.toString());
                  //response.sendError(HttpServletResponse.SC_NOT_FOUND);
                }
                   
                      try
                      {
                      final String jsCommand = "window['SUCCESS_CALLBACK']('" + callbackID + "' , '" + URLEncoder.encode(output.toString(),"UTF-8") + "')";
                        final JSObject win = JSObject.getWindow(Zaranuxlet.this);
                          win.eval(jsCommand);
                      }catch(JSException e)
                      {
                        logger.severe("callbackOnSuccess(): Unable to do window.eval : " + e.getMessage());
View Full Code Here

TOP

Related Classes of com.zaranux.os.server.core.Response

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.