Displaying keyword search results 111 - 120
Created by voodoo on July 30, 2010 14:53:33 Last update: July 30, 2010 14:54:52
The -d switch for cURL sends HTTP POST with data from the command line. To verify the data being posted, this is a CGI script that echos the data back:
#!C:/perl/bin/perl.exe ## ## echo -- echos ...Examples: POST data from command line:
C:\>curl -d input1=value1^&input1=value2 http://lo...POST data from stdin (with @ before the - symbol):
C:\>curl -d @- http://localhost/cgi-bin/echo.pl ...POST data from a file (with @ before the - symbol and input redirect):
C:\tmp>cat data.txt abcd 1234 xyz ...For some reason, @ with file name didn't work as expected:
C:\tmp>curl -d @data.txt http://localhost/cgi-bin/...One thing to notice is that cURL removes the new line characters when posting (thus the echo back is only one line instead of three). This can...
Created by voodoo on July 11, 2009 15:14:55 Last update: July 29, 2010 22:45:48
cURL is a command line tool for transferring files with URL syntax. The main purpose and use for cURL is to automate unattended file transfers or sequences of operations. It's really easy to see HTTP headers with curl:
C:\>curl --head http://www.google.com HTTP/1.0 ...or, headers and page together (dump headers to stdout):
$ curl --dump-header - http://www.google.com HTTP/...Download openssl from openssl.org:
C:\>curl --help Usage: curl [options...] <url> ...
Created by Dr. Xi on July 19, 2010 21:58:34 Last update: July 23, 2010 21:37:23
Parsing XML in Java is really simple:
import java.io.*; import javax.xml.parsers.Docu...The parser implementation details are hidden behind the JAXP API. In case you want to know which parser implementation is used, this is what the JavaDoc for DocumentBuilderFactory.newInstance says: Use the javax.xml.parsers.DocumentBuilderFactory system property. Use the properties file " lib/jaxp.properties " in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to...
Created by James on June 29, 2010 19:11:54 Last update: July 23, 2010 21:23:24
import java.util.Random; public class Gener...
Created by Dr. Xi on July 21, 2010 22:14:53 Last update: July 21, 2010 22:14:53
This is a Java program to test XPATH expressions with namespace option. It's been tested with JDK1.6.
import java.io.FileInputStream; import java.uti...Following Getting Started with XML Security , these are the test files: Without namespace (patient.xml).
<PatientRecord> <Name>John Doe</Nam...With namespace (patient_ns.xml).
<med:PatientRecord xmlns:med="http://www.medic...Test results:
C:\>java XPathExample patient.xml /PatientRecord/V...
Created by voodoo on July 21, 2010 16:10:47 Last update: July 21, 2010 16:10:47
Google news RSS does not like curl:
C:\> curl --dump-header - -o NUL http://news.googl...Switch the agent to HotJava with the -A option:
C:\> curl -A "HotJava/1.1.2 FCS" --dump-header - -...
Created by Dr. Xi on June 20, 2010 14:35:17 Last update: June 20, 2010 14:35:17
This XML signature validator comes from the Apache XML Security project. It validates the signature according to the core validation processing rules . It does not verify that the key used to generate the signature is a trusted key. You can override the KeySelector class to make sure that the signing key is from a trusted store.
import javax.xml.crypto.*; import javax.xml.cry...
Created by Dr. Xi on June 03, 2010 22:43:43 Last update: June 20, 2010 14:13:05
Using the Sun BASE64Encoder :
import java.io.*; import sun.misc.BASE64Encoder...However, the Sun encoder is awfully slow. The Apache encoder is a lot faster. Here's the code with Apache encoder:
import java.io.*; import org.apache.commons.cod...Performance comparisons between Apache and Sun:
C:\>bash bash-3.2$ time java EncodeFileWithBase...
Created by Dr. Xi on June 19, 2010 04:34:01 Last update: June 19, 2010 04:39:13
Java SE 6 contains built-in utilities to generate XML signatures. This is an example that generates XML signatures using a Java keystore. It has options to generate signature for the whole document, for an element with a specific ID, or for elements matched by an XPATH expression. The XML document used to test is taken from Getting Started with XML Security :
<?xml version="1.0"?> <PatientRecord> ...This is the Java code:
import java.io.FileInputStream; import java.io....However, it looks like the XPATH transform is not working. The digest generated with XPATH filter is exactly the same as that without it (i.e., the whole document)! Another reference: Programming With the Java XML Digital Signature API
Created by Dr. Xi on November 24, 2007 02:28:40 Last update: June 15, 2010 21:32:13
1. Put the array in request scope:
request.setAttribute("myArray", anArray);2. In jsp:
<%@ taglib prefix="fn" uri="http://java.sun.co...