How to send a https request using jsf
hi
Can anybody tell a sample how to send a https request using JSF ...
thanks
Prefix the request URI with the https protocol.
The answer is too easy and straightforward that I guess that you mean something else. If you just want to know how to configure an SSL environment for your own webapplication, refer to the Java EE tutorial chapter 28: http://java.sun.com/javaee/5/docs/tutorial/doc/
Similar Messages
-
How to send a HTTP request to servlet in java application
I'm new in Java. I need to send a HTTP request with parameters to servlet in a java aplication. Here is my code. It can be compiled but always threw an exceptions when I ran it. Can anyone help?
package coreservlets;
import java.io.*;
import java.net.*;
public class PostHTTP
public static void main(String args[])
throws IOException, UnknownHostException {
try
// URL and servlet
URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
URLConnection c = myURL.openConnection();
c.setUseCaches(false);
c.setDoOutput(true);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
PrintWriter out = new PrintWriter(byteStream, true);
//parameters
String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
out.print(postData);
out.flush();
String lengthString = String.valueOf(byteStream.size());
c.setRequestProperty("Content-Length", lengthString);
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
byteStream.writeTo(c.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader
(c.getInputStream()));
String line;
//String linefeed = "\n";
//resultsArea.setText("");
while((line = in.readLine()) != null) {
System.out.println(line);
//resultsArea.append(linefeed);
catch(IOException ioe) {
// Print debug info in Java Console
System.out.println("IOException: " + ioe);here are some updates to your code I haven't tested it running
post again if you still have trouble
URL myURL = new URL("http://pc076/servlet/coreservlets.OffHold");
HttpURLConnection c = (HttpURLConnection)myURL.openConnection();
c.setDoInput(true);
c.setDoOutput(true);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream(512);
String lengthString = String.valueOf(byteStream.size());
c.setRequestProperty("Content-Length", lengthString);
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
PrintWriter out = new PrintWriter(byteStream, true);
//parameters
String postData = "REASON_CODE=3B&RSPCODE=JSmith&CASENUM=NA795401&REPLY=123&SOURCE=XYZ&REPLYLINK=http://pc076/servlet/coreservlets.ShowParameters";
out.print(postData);
out.flush();
byteStream.writeTo(c.getOutputStream());
// connect
c.connect();
BufferedReader in = new BufferedReader(new InputStreamReader
(c.getInputStream()));
String line;
while((line = in.readLine()) != null)
System.out.println(line); -
How to send a http request to a non java appln
I have one legacy web application running which can handle only http request . So I need to connect (using http request) and send my request and get the response, without opening that application in browser.
Any idea
1) How to connect to non - java appln from a java appln ?
2) How to use the Httprequest without displaying the page using browser?You can try one of three routes:
Open a socket and write the HTTP request and parse the HTTP response yourself
Use java.net.URLConnection
Use Jakarta Common's HttpClient at jakarta.apache.org- Saish -
How to send a http-request from abap?
I want to send a xml file through a http-request ,what should i do?
Welcome to SDN
you can use cl_http_client class to do that. search the abap general forum with key word cl_http_client and you will find lot of examples.
Regards
Raja -
How to post multiple http requests using a single http connection in java
I am using the httpurlconnection class and it allows only to post one request on a connection. I require to post multiple http requests by opening a single connection. Code examples please. Thanx in advance.
Hi
I found this article through Google. I hope it helps a little
http://www.developer.com/tech/article.php/761521
D -
How to send POST HTTP Request through PI .
Hi ,
I am trying to send a XML mesage at HTTP server from SAP PI 7.1 .
but not able to , reason is HTTP guy telling me is that ,i am sending a get request through SAP PI 7.1 and it should be POST.
Where to change this this thing , so that only post request should go.
There is one more thing , i am facing following request only in Quality . In Development request is going as Post and every thing running fine ...
Regards
PSIt was always HTTP from our end , some config was missing at HTTP guys end , which solve the problem ..
So there was no issue at PI end. -
How does Flash send outgoing HTTP request to server?
Hello everyone,
I would like to know how Flash sends outgoing HTTP requests.
I would like to know when from the inside of a Flash SWF file
request for another SWF or FLV file is made; how the Flash sends
this request to server.
Thank you very much and have a great day,
KhoramdinHello everyone,
I would like to know how Flash sends outgoing HTTP requests.
I would like to know when from the inside of a Flash SWF file
request for another SWF or FLV file is made; how the Flash sends
this request to server.
Thank you very much and have a great day,
Khoramdin -
How to send a Meeting Request to Exchange/Outlook using JavaMail
Hi,
Can any body help me "How to send a Meeting Request to Exchange/Outlook using JavaMail" which will be added to the calendar items.
If possible, please provide me with the sample code. Please send the sample code to the following mail id: "[email protected]".
Thanks in advance,
Ashok.I don't have a homework problem. I have a real business need for this, but haven't been able to get my code to work yet. There are at least two references out there, but either the sample code hasn't been posted or I don't know where to look. Can you help?
Thanks. -
Hi,
I want to send an http request with a string(this is an xml string)which will give me a response which contains an xml string again.Can anybody tell me how can i do it in java.Any sample code will be a great help
thanks in advance.This is a example, hope to be useful for you.
String xml = "<?xml version="1.0" encoding="GBK"?>"
+ "<operation_info>"
+ "<request_code>11000008</request_code>"
+ "<id_number>13148709165</id_number>"
+ "<id_type>2</id_type>"
+ "<session_id>100000002226</session_id>"
+ "<device_uid>100000000005</device_uid>"
+ "</operation_info>";
String http_url = "http://127.0.0.1:8888/protocol";
URL sendUrl = new URL(http_url);
URLConnection urlCon = sendUrl.openConnection();
urlCon.setDoOutput(true);
urlCon.setDoInput(true);
HttpURLConnection httpConnection = (HttpURLConnection) urlCon;
httpConnection.setRequestMethod("POST");
httpConnection.setRequestProperty("Content-Type", "text/xml;charset=GBK");
httpConnection.setRequestProperty("Content-Length", Integer.toString(xml.length()));
PrintStream ps=null;
try {
ps = new PrintStream(httpConnection.getOutputStream());
}catch(java.net.ConnectException e){
e.printStackTrace();
return "error"; ;
xml = URLEncoder.encode(xml);
try{
ps.write(xml.getBytes());
ps.flush();
//get response stream
String str = httpConnection.getResponseMessage();
InputStream is = httpConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
str = "";
StringBuffer sb = new StringBuffer();
while ((str = br.readLine())!=null) {
sb.append(str);
is.close();
return sb.toString();
}catch(Exception e){
e.printStackTrace();
return "error"; //exception
} -
HT4314 How to send a game request to my friends
How to send a game request to my friends
Hi,
How about your issue now? Is it fixed?
I think you will get progessional support from other network related forum. Because VC++ forum aims to discuss and ask questions about the Visual C++ IDE, libraries, samples, tools, setup, and Windows programming using MFC and ATL.
Hope you can understand.
May
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi,
How to send a multicast request to 239.255.255.253, seeking an SLP Directory Agent (DA) in C++?
Thanks in advance.Hi,
How about your issue now? Is it fixed?
I think you will get progessional support from other network related forum. Because VC++ forum aims to discuss and ask questions about the Visual C++ IDE, libraries, samples, tools, setup, and Windows programming using MFC and ATL.
Hope you can understand.
May
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to transfer the http request from applet to servlet/jsp
I use the JTree component to create a navigation of a website,but i don't
know how to connect the tree's nodes with the jsp/servlet.
I mean how to transfer the http request from the applet to a jsp.
I use the "<frameset>" mark which will divide the web browse into 2 blocks.
The left side is Applet,and the right side is the linked jsp page.
what I say is as the weblogic console layout.
who can help me!!!
Thank You!I use the JTree component to create a navigation of a website,but i don't
know how to connect the tree's nodes with the jsp/servlet.
I mean how to transfer the http request from the applet to a jsp.
I use the "<frameset>" mark which will divide the web browse into 2 blocks.
The left side is Applet,and the right side is the linked jsp page.
what I say is as the weblogic console layout.
who can help me!!!
Thank You! -
How to send images through PI using SOAP adapter
hi,
Can anybody tell me how to send images through PI using SOAP adapter.
Regards ,
LoveenaHi Loveena,
only as attachments of a SOAP message.
Regards,
Udo -
How to send Text HTTP Body in sender Http post to proxy .
Hi Exeperts,
I have a scenario http post to proxy scenario. where i need to send Text HTTP Body using http sender.receiver side i am having proxy.
Please let us know what are the configuration i need to take at sender side and receiver side .
Regards
Ravinder.sHi,
1.If you have any xsl code or java code please share .
You need Java (or ABAP), not parsing the input, creating xml.
2. my client is using dual stack abap/java.
Your desicion to use Java or ABAP. From my point of view ABAP is easier, but it depends or your experience.
3.please share the any udf for map the string to the target side?
An UDF is part of a Message Mapping. Does not work here.
4. i already developed the proxy code.
That s a good start
/Udo -
How to send HTML Format Mail using Java Mail in oracle 9i Forms
Dear All
could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
if it is possible, could you please send me the sample code? please very urgent
Thanks
P.SivaramanHello,
<p>Here is a Form sample.</p>
Francois
Maybe you are looking for
-
My computer has changed how it accepts photos from my phone. They used to post into a library by the month and year, e.g., "Feb 2014 photo stream," but now all of the photos from my phone for the past year or so are lumped together into the "Shared"
-
Floating previews in IE right but not in chrome
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>
-
How do I make a 2-color PDF?
An ad I've created uses black and a PMS color. How do I export the PDF so that only the two plates are used and no process colors? Thanks, Michele
-
Another call for CMYK and full Adobe format support
As a sometimes creative director, publisher, photographer, and graphic guy -- I'd like to see LR evolve into a complete tool to manage all of Adobe's "photo graphic' assets. I think it's fair to say that a "photo graphic" is now much more than a JPEG
-
CS5 6.3 RAW File not reopening with changes saved from .xmp file?
I recently upgraded from my D70 to a D7000, and downloaded the new plug-in for CS5 RAW (since the D7000's raw images weren't readable). I have no problem opening my photos in RAW 6.3, and tweaking them (just like before). When I'm done and want to