Examples of URLDecoder


Examples of java.net.URLDecoder

    @Test
    public void testPost() throws Exception {
        JsonObject jsonResponse = new JsonObject();
        jsonResponse.addProperty("id", 101);
        assertEquals(jsonResponse.toString(), WS.url("http://localhost:9003/ressource/%s", Rest.filterString("名字")).params(params).post().getJson().toString());
        File fileToSend = new File(new URLDecoder().decode(getClass().getResource("/kiki.txt").getFile(), "UTF-8"));
        assertTrue(fileToSend.exists());
        assertEquals("POSTED!", WS.url("http://localhost:9003/ressource/file/%s", Rest.filterString("名字")).files(new FileParam(fileToSend, "file")).post().getString());
        assertEquals("FILE AND PARAMS POSTED!", WS.url("http://localhost:9003/ressource/fileAndParams/%s", Rest.filterString("名字")).files(new FileParam(fileToSend, "file")).params(params).post().getString());

    }
View Full Code Here

Examples of java.net.URLDecoder

    @Test
    public void testPut() throws Exception {
        JsonObject jsonResponse = new JsonObject();
        jsonResponse.addProperty("id", 101);
        assertEquals(jsonResponse.toString(), WS.url("http://localhost:9003/ressource/%s", Rest.filterString("名字")).params(params).put().getJson().toString());
        File fileToSend = new File(new URLDecoder().decode(getClass().getResource("/kiki.txt").getFile(), "UTF-8"));
        assertTrue(fileToSend.exists());
        assertEquals("POSTED!", WS.url("http://localhost:9003/ressource/file/%s", Rest.filterString("名字")).files(new FileParam(fileToSend, "file")).put().getString());
        assertEquals("FILE AND PARAMS POSTED!", WS.url("http://localhost:9003/ressource/fileAndParams/%s", Rest.filterString("名字")).files(new FileParam(fileToSend, "file")).params(params).put().getString());
    }
View Full Code Here

Examples of java.net.URLDecoder

public class DataBindingUnitTest extends UnitTest {
   
   
    @Test
    public void testByteBinding() throws Exception{
        File fileToSend = new File(new URLDecoder().decode(getClass().getResource("/kiki.txt").getFile(), "UTF-8"));
        assertEquals("b.ba.length=749", WS.url("http://localhost:9003/DataBinding/bindBeanWithByteArray").files(new FileParam(fileToSend, "b.ba")).post().getString());
       
    }
View Full Code Here

Examples of java.net.URLDecoder

public class B6463990 {
    public static void main(String[] args) {
        boolean except = false;
        try {
            URLDecoder ud = new java.net.URLDecoder();
            String s = ud.decode("%-1", "iso-8859-1");
            System.out.println((int) s.charAt(0));
        } catch (Exception e) {
            except = true;
        }
        if (!except)
View Full Code Here

Examples of org.w3c.jigsaw.forms.URLDecoder

    {
  String      query = request.getQueryString() ;
  if (query == null)
      return "unknown";
  InputStream in    = new StringBufferInputStream(query) ;
  URLDecoder  d     = new URLDecoder (in, getOverrideFlag()) ;
  try {
      d.parse () ;
  } catch (URLDecoderException e) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent("Invalid request:unable to decode form data.");
      throw new HTTPException (error) ;
  } catch (IOException e) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent("Invalid request: unable to read form data.");
      throw new HTTPException (error) ;
  }

  String action = d.getValue("action") ;
  return (action == null ? "unknown" : action);
    }
View Full Code Here

Examples of org.w3c.jigsaw.forms.URLDecoder

  {
      String      query = request.getQueryString() ;
      if (query == null)
    return null;
      InputStream in    = new StringBufferInputStream(query) ;
      URLDecoder  d     = new URLDecoder (in, getOverrideFlag()) ;
      try {
    d.parse () ;
      } catch (URLDecoderException e) {
    Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
    error.setContent("Invalid request: "+
         "unable to decode form data.");
    throw new HTTPException (error) ;
      } catch (IOException e) {
    Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
    error.setContent("Invalid request: unable to read form data.");
    throw new HTTPException (error) ;
      }
      return d.getValue("editlog") ;
  }
View Full Code Here

Examples of org.w3c.jigsaw.forms.URLDecoder

  throws ProtocolException, ResourceException
    {
  if (getConvertGetFlag() && request.hasState("query")) {
      String      query = request.getQueryString() ;
      InputStream in    = new StringBufferInputStream(query) ;
      URLDecoder  d     = new URLDecoder (in, getOverrideFlag()) ;
      try {
    d.parse () ;
      } catch (URLDecoderException e) {
    Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
    error.setContent("Invalid request: "+
         "unable to decode form data.");
    throw new HTTPException (error) ;
View Full Code Here

Examples of org.w3c.jigsaw.forms.URLDecoder

      if ((! request.hasContentType())
    || (type.match(request.getContentType()) < 0) )
    return;
      postParameters = new Hashtable(2);
      // Get and decode the request entity:
      URLDecoder dec = null;
      try {
    Reader in = getReader() ;
    // Notify the client that we are willing to continue
    String exp = request.getExpect();
    if (exp != null && (exp.equalsIgnoreCase("100-continue"))) {
        Client client = request.getClient();
        if ( client != null ) {
      client.sendContinue();
        }
    }
    String encoding = getCharacterEncoding();
    if (encoding == null) {
        dec = new URLDecoder (in, false, "8859_1");
    } else {
        dec = new URLDecoder (in, false, getCharacterEncoding());
    }
    postParameters = dec.parse() ;
      } catch (URLDecoderException e) {
    postParameters = null;
      } catch (IOException ex) {
    postParameters = null;
      }
  }
  // URL encoded parameters:
  String query = getQueryString();
  if (query != null) {
      Reader qis = null;
      qis = new StringReader(query);
      try {
    URLDecoder dec;
    String encoding = getCharacterEncoding();
    if (encoding == null) {
        dec = new URLDecoder (qis, false, "8859_1");
    } else {
        dec = new URLDecoder (qis, false, getCharacterEncoding());
    }
    queryParameters = dec.parse();
      } catch (Exception ex) {
    throw new RuntimeException("Java implementation bug.");
      }
  }
  queryParameters = mergeParameters(postParameters, queryParameters);
View Full Code Here

Examples of org.w3c.jigsaw.forms.URLDecoder

  if (query != null) {
      Reader qis = new StringReader(query);
      try {
    String encoding = getCharacterEncoding();
    if (encoding == null) {
        urlParameters = new URLDecoder(qis,false,"8859_1").parse();
    } else {
        urlParameters = new URLDecoder(qis,false,encoding).parse();
    }
    return (String) urlParameters.get(name);
      } catch (Exception ex) {
    throw new RuntimeException("Java implementation bug.");
      }
View Full Code Here

Examples of org.w3c.jigsaw.forms.URLDecoder

  if ((! getConvertGetFlag()) || ( ! request.hasState("query")))
      return super.get (request) ;
  // Get the request entity, and decode it:
  String      query = request.getQueryString() ;
  InputStream in    = new StringBufferInputStream(query) ;
  URLDecoder  d     = new URLDecoder (in, getOverrideFlag()) ;
  try {
      d.parse () ;
  } catch (URLDecoderException e) {
      Reply error = request.makeReply(HTTP.BAD_REQUEST) ;
      error.setContent("Invalid request:unable to decode form data.");
      throw new HTTPException (error) ;
  } catch (IOException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.