The judge to whom the application is made shall grant such writ without delay or issue an order directing the defendant named in the complaint to show cause why the writ should not be granted, unless it appears from the complaint or otherwise that the applicant or person confined or restrained is not entitled thereto.
The writ or order to show cause shall be directed to the person by whom such party is confined or restrained in his liberty. It shall be returned within 3 days unless for good cause additional time, not exceeding 20 days, is allowed.
If the judge shall have reason to believe that the person confined or restrained may be removed from the state, or otherwise suffer irreparable injury, he may direct that the writ be made returnable and the person, confined or restrained, produced before the court forthwith.
If the prisoner shall be in the custody of a public officer, the judge may require that a bond be given in such amount as the judge may fix with sufficient surety and conditioned that the prisoner will not escape either in going to or returning from the place to which he is to be taken pursuant to the writ.
Except in proceedings under subsection g. of section 2A:67-13, the writ shall require the defendant to produce, in court, the party detained either upon the return to the writ or at the hearing after notice of the time and place thereof, unless the applicant, in writing, waives such production, or the only questions presented are issues of law; and may require such production in any case.
N.J.S. § 2A:67-17