Package org.ribax.parameters

Examples of org.ribax.parameters.FileParameter


        StringPart p = new StringPart(pair.getName(),pair.getValue());
       
        out.write(p.toString().getBytes());
       
      } else if (o instanceof FileParameter) {
        FileParameter fp = (FileParameter)o;
        pair = fp.getNameValuePair();
       
        if (pair == null || pair.getName() == null || pair.getValue() == null) {
          nullParameterWarning(pair);
          continue;
        }
       
          File f = new File(pair.getValue());
         
          if (f == null) {
            LOG.warn(Messages.getString("SocketDataSource.8")+pair.getValue()); //$NON-NLS-1$
            continue;
          }
         
          byte[] b = new byte[1024];
         
          //send the file
          FileInputStream fin = new FileInputStream(f);
         
          while(fin.available() > 0) {
            fin.read(b);
            out.write(b);
          }
      } else if (o instanceof FileDataItem) {
        FileDataItem fp = (FileDataItem)o;
        pair = fp.getNameValuePair();
       
        if (pair == null || pair.getName() == null || pair.getValue() == null) {
          nullParameterWarning(pair);
          continue;
        }

          File f = new File(pair.getValue());
         
          if (f == null){
            LOG.warn(Messages.getString("SocketDataSource.9")+pair.getValue()); //$NON-NLS-1$
            continue;
          }

          //send the file
          byte[] b = new byte[1024];
         
          //send the file
          FileInputStream fin = new FileInputStream(f);
         
          while(fin.available() > 0) {
            fin.read(b);
            out.write(b);
          }

      } else if (o instanceof DataItem) {
        DataItem fp = (DataItem)o;
        pair = fp.getNameValuePair();
       
        if (pair == null || pair.getName() == null || pair.getValue() == null) {
          nullParameterWarning(pair);
          continue;
        }
View Full Code Here


                        }
                        StringPart part = new StringPart(pair.getName(),pair.getValue());
                        content.add(part);
                        length += mp.getContentLength(part);
                    } else if (o instanceof FileParameter) {
                        FileParameter fp = (FileParameter)o;
                        pair = fp.getNameValuePair();

                        if (pair == null || pair.getName() == null || pair.getValue() == null) {
                            nullParameterWarning(pair);
                            continue;
                        }

                        File f = new File(pair.getValue());

                        if (f == null) {
                            requestLog.warn(Messages.getString("WebDataSource.19")+pair.getValue()); //$NON-NLS-1$
                            continue;
                        }
                        FilePart part = new FilePart(pair.getName(),f);
                        content.add(part);
                        length += mp.getContentLength(part);
                    } else if (o instanceof FileDataItem) {
                        FileDataItem fp = (FileDataItem)o;
                        pair = fp.getNameValuePair();

                        if (pair == null || pair.getName() == null || pair.getValue() == null) {
                            nullParameterWarning(pair);
                            continue;
                        }

                        File f = new File(pair.getValue());

                        if (f == null){
                            requestLog.warn(Messages.getString("WebDataSource.20")+pair.getValue()); //$NON-NLS-1$
                            continue;
                        }

                        FilePart part = new FilePart(pair.getName(),f);
                        content.add(part);
                        length += mp.getContentLength(part);
                    } else if (o instanceof DataItem) {
                        DataItem fp = (DataItem)o;
                        pair = fp.getNameValuePair();

                        if (pair == null || pair.getName() == null || pair.getValue() == null) {
                            nullParameterWarning(pair);
                            continue;
                        }
View Full Code Here

TOP

Related Classes of org.ribax.parameters.FileParameter

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.