Browsing through java

Hello,
I am developing a simple browser in java.my problems are listed below.
1.when i connect to website using the url(Using a socket connection) i receive whole HTML code along the text in the console and no images.how can i display the web page on the JPanel in my frame with images and links.
2.how should i add caching feature in my browser.
3.what should be done in the event handling of the refresh button.
4.how to add text selection and copying feature in my browser using mouse.

1) Getting images requires interpreting the Html response. The images are included as Urls and should be fetched in separate requests.
2) You should look at the Http response and look for cache headers.

Similar Messages

  • Controlling Browser through Java

    Hi All,
    I have a question , is there any way we can controll browser(IE) through java(swing) application.
    In our application we need to launch two different IE browsers by clicking two buttons
    My question is if Button A is clicked browser with yahoo.com need to launch if button B is clicked msn.com should launch
    subsiquently if button A is clicked application should check weather yahoo.com is running if running then it should bring the browser with yahoo.com to front and if button B is clicked again the app. should bring msn.com to front
    if you can give me some example code that would be great

    Ok, I've got an answer for you, but its kind of lengthy. This code comes from Carnegie Mellon University, all thanks where due.
    import java.io.IOException
    public class BrowserControl
       public static void displayURL(String url)
         boolean windows = isWindowsPlatform();
         String cmd = null;
         try
            if (windows)
               cmd = WIN_PATH + " " + WIN_FLAG + " " + url;
               Process p = Runtime.getRuntime().exec(cmd);
            else
               cmd = UNIX_PATH + " " UNIX_FLAG + " (" + url + ")";
               Process p = Runtime.getRuntime().exec(cmd);
               try
                  int exitCode = p.waitFor();
                  if (exitCode != 0)
                     cmd = UNIX_PATH + " " + url;
                     p = Runtime.getRuntime().exec(cmd);
                catch (InterruptedException x)
                   System.err.println("Error bringing up browser");
                   System.err.println("Caught: " + x);
          catch(IOException x)
             System.err.println("Could not invoke browser");
             System.err.println("Caught: " + x);
       public static boolean isWindowsPlatform()
          String os = System.getProperty("os.name");
          if (os != null && startsWith(WIN_ID));
             return true;
          else
             return false;
       private static final String WIN_ID = "Windows";
       private static final String WIN_PATH = "rundll32";
       private static final String WIN_FLAG = "url.dll,FileProtocolHandler";
       private static final String UNIX_PATH = "netscape";
       private static final String UNIX_FLAG = "-remote openURL";
    }This is a real general class, it can be used in alot more specific instances (aka windows or UNIX specific) which might cut down on alot of the system checking codes. The important parts are the static Strings at the very end and putting some URL into the url variable via some textfield or other input method.
    As far as the technicalities of opening two different browser windows....I'm not sure on that. But I hope the above code helps.
    PS This code is from a hard copy printout, so there might be some minor syntax errors in my typing.

  • Need Help-How Store the input parameter through java bean

    Hello Sir,
    I have a simple Issue but It is not resolve by me i.e input parameter
    are not store in Ms-Access.
    I store the input parameter through Standard Action <jsp:useBean>.
    jsp:useBean call a property IssueData. this property exist in
    SimpleBean which create a connection from DB and insert the data.
    At run time servlet and server also show that loggging are saved in DB.
    But when I open the table in Access. Its empty.
    Ms-Access have two fields- User, Password both are text type.
    Please review these code:
    login.html:
    <html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="tmp" >
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>LoginServlet.java:
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException{
    try
    String user=request.getParameter("user");
    String pass=request.getParameter("pass");
    co.SimpleBean st = new co.SimpleBean();
    st.setUserName(user);
    st.setPassword(pass);
    request.setAttribute("user",st);
    request.setAttribute("pass",st);
    RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
    dispatcher1.forward(request,response);
    catch(Exception e)
    e.printStackTrace();
    }SimpleBean.java:
    package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean {
    private String user="";
    private String pass="";
    private String s="";
    public String getUserName() {
    return user;
    public void setUserName(String user) {
    this.user = user;
    public String getPassword() {
    return pass;
    public void setPassword(String pass) {
    this.pass = pass;
    public String getIssueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getUserName();
    getPassword();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:odbc:simple");
    System.out.println("Connected....");
    PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String User=getUserName();
    st.setString(1,User);
    String Password=getPassword();
    st.setString(2,Password);
    st.executeUpdate();
    System.out.println("Query Executed");
    con.close();
    s=  "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return(s);
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }submit.jsp:
    This is Submit page
    <html><body>
    Hello
    Student Name: <%= ((co.SimpleBean)request.getAttribute("user")).getUserName() %>
    <br>
    Password: <%= ((co.SimpleBean)request.getAttribute("pass")).getPassword() %>
    <br>
    <jsp:useBean id="st" class="co.SimpleBean" scope="request" />
    <jsp:getProperty name="st" property="IssueData" />
    </body></html>web.xml:<web-app>
    <servlet>
    <servlet-name>one</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>one</servlet-name>
    <url-pattern>/tmp</url-pattern>
    </servlet-mapping>
    <jsp-file>issue.jsp</jsp-file>
    <jsp-file>submit.jsp</jsp-file>
    <url-pattern>*.do</url-pattern>
    <welcome-file-list>
    <welcome-file>Login.html</welcome-file>
    </welcome-file-list>
    </web-app>Please Help me..Thanks.!!!
    --

    Dear Sir,
    Same issue is still persist. Input parameter are not store in database.
    After follow your suggestion when I run this program browser show that:i.e
    This is Submit page Hello Student Name: vijay
    Password: kumar
    <jsp:setProperty name="st" property="userName" value="userValue/> Your logging is saved in DB
    Please review my code.
    login.html:
    {code}<html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="tmp" >
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>{code}
    LoginServlet.java:
    {code}import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet{
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException{
    try
    String userValue=request.getParameter("user");
    String passValue=request.getParameter("pass");
    co.SimpleBean st = new co.SimpleBean();
    st.setuserName(userValue);
    st.setpassword(passValue);
    request.setAttribute("userValue",st);
    request.setAttribute("passValue",st);
    RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
    dispatcher1.forward(request,response);
    catch(Exception e)
    e.printStackTrace();
    }{code}
    SimpleBean.java:
    {code}package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean {
    private String userValue="";
    private String passValue="";
    private String s="";
    public String getuserName() {
    return userValue;
    public void setuserName(String userValue) {
    this.userValue = userValue;
    public String getpassword() {
    return passValue;
    public void setpassword(String passValue) {
    this.passValue= passValue ;
    public String getissueData() //method that create connection with database
    try
    System.out.println("Printed*************************************************************");
    getuserName();
    getpassword();
    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("Connection loaded");
    Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
    System.out.println("Connection created");
    PreparedStatement st=con.prepareStatement("insert into vij values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String userName=getuserName();
    st.setString(1,userName);
    String password=getpassword();
    st.setString(2,password);
    st.executeUpdate();
    System.out.println("Query Executed");
    con.close();
    s= "Your logging is saved in DB ";
    System.out.println("Your logging is saved in DB *****************");
    return(s);
    catch(Exception e)
    e.printStackTrace();
    return "failed";
    }{code}
    submit.jsp:
    {code}This is Submit page
    <html><body>
    Hello
    Student Name: <%= ((co.SimpleBean)request.getAttribute("userValue")).getuserName() %>
    <br>
    Password: <%= ((co.SimpleBean)request.getAttribute("passValue")).getpassword() %>
    <br>
    <jsp:useBean id="st" class="co.SimpleBean" scope="request" />
    <jsp:setProperty name="st" property="userName" value="userValue/>
    <jsp:setProperty name="st" property="password" value="passValue"/>
    <jsp:getProperty name="st" property="issueData" />
    </body></html>web.xml:<web-app>
    <servlet>
    <servlet-name>one</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>one</servlet-name>
    <url-pattern>/tmp</url-pattern>
    </servlet-mapping>
    <jsp-file>submit.jsp</jsp-file>
    <url-pattern>*.do</url-pattern>
    <welcome-file-list>
    <welcome-file>Login.html</welcome-file>
    </welcome-file-list>
    </web-app>Sir I can't use EL code in jsp because I use weblogic 8.1 Application Server.This version are not supported to EL.
    Please help me...How store th input parameter in Database through Java Bean                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Issue with passing parameters through Java-JSP in a report with cross tab

    Can anyone tell me, if there's a bug in Java SDK in passing the parameters to a report (rpt file) that has a cross tab in it ?
    I hava report that works perfectly fine
       with ODBC through IDE and also through browser (JSP page)
    (ii)    with JDBC in CR 2011 IDE
    the rpt file has a cross tab and accpts two parameters.
    When I run the JDBC report through JSP the parameters are never considered. The same report works fine when I remove the cross tab and make it a simple report.
    I have posted this to CR SDK forum and have not received any reply. This have become a blocker and because of this our delivery has been postponed. We are left with two choices,
       Re-Write the rpt files not to have cross-tabs - This would take significant effort
    OR
    (ii)  Abandon the crystal solution and try out any other java based solutions available.
    I have given the code here in this forum posting..
    CR 2011 - JDBC Report Issue in passing parameters
    TIA
    DRG
    TIA
    DRG

    Mr.James,
    Thank you for the reply.
    As I stated earlier, we have been using the latest service pack (12) when I generated the log file that is uploaded earlier.
    To confirm this further, I downloaded the complete eclipse bundle from sdn site and reran the rpt files. No change in the behaviour and the bug is reproducible.
    You are right about the parameters, we are using  {?@Direction} is: n(1.0)
    {?@BDate} is: dt(d(1973-01-01),t(00:00:00.453000000)) as parameters in JSP and we get 146 records when we directly execute the stored procedure. The date and the direction parameter values stored in design time are different. '1965-01-01' and Direction 1.
    When we run the JSP page, The parameter that is passed through the JSP page, is displayed correctly on the right top of the report view. But the data that is displayed in cross tab is not corresponding to the date and direction parameter. It corresponds to 1965-01-01 and direction 1 which are saved at design time.
    You can test this by modifying the parameter values in the JSP page that I sent earlier. You will see the displayed data will remain same irrespective of the parameter.
    Further to note, Before each trial run, I modify the parameters in JSP page, build them and redeploy so that caching does not affect the end result.
    This behaviour, we observe on all the reports that have cross-tabs. These reports work perfectly fine when rendered through ODBC-ActiveX viewer and the bug is observable only when ran through Java runtime library. We get this bug on view, export and print functionalities as well.
    Additionally we tested the same in
        With CR version 2008 instead of CR 2011.
    (ii)   Different browsers ranging from IE 7 through 9 and FF 7.
    The complete environment and various softwares that we used for this testing are,
    OS      : XP Latest updates as on Oct 2011.
    App Server: GlassFish Version 3 with Java version 1.6 and build 21
    Database server ; SQL Server 2005. SP 3 - Dev Ed.
    JTds JDBC type 4 driver version - 1.2.5  from source forge.
    Eclipse : Helios along with crystal libraries directly downloaded from SDN site.
    I am uploading the log file that is generated when rendering the rpt for view in IE 8
    Regards
    DRG

  • Want to access RESTful Services through Java Program

    We are trying to access RESTful Services exposed by Oracle database cloud through our Java code, with authentication enabled for a particular user.
    Till now, we have completed below steps:
    1) We have a working account with Oracle database cloud (Username – xxx.xxx)
    2) We log in using the credentials for above account, and navigate to Oracle Apex ? SQL Workshop ? RESTful Services
    3) We create a new “RESTful Service Module” by filling out the details as below:
         Name:                                  SampleTest 
         URI Prefix:                            test
         URI Template:                       /getallemp
         Pagination Size:                    25 (kept to default)
         Required Privilege:                 TestGroupPrivilege
         Resource Handler Details:
                    Method:              GET
                    Source Type:      Query
                    Format:               JSON
                    Source:               select * from emp
    After creating the above module and testing it, it works fine and the data is retrieved in JSON successfully.
    The resulting URL for above RESTful Service Module is: https://<HOST_URL>/apex/test/getallemp
    Note that “TestGroupPrivilege” is a privilege assigned to the user group “RESTful Services” and the user “xxx.xxx” is a member of “RESTful Services” user group.
    4) We are unable to call the RESTful services from Java program. We are passing username and password in request header as basic authentication. But, we are getting: Error 500--Internal Server Error
    5) If we change the “Required Privilege” to default i.e. no privileges present on the module, we can get the response through Java code and everything works perfectly fine.
    Please suggest us in: How to access RESTful Services through Java code by passing user credentials in HTTP header for authentication. Also let us know if we have to do any settings through Apex, in case we are missing any.
    Message was edited by: NeerajGirolkar
    - When we are logging in to Oracle cloud on browser and execute the Oracle cloud RESTful service in another tab of same browser, we are able to get the result. But when executed the same RESTful service from a different browser or java program we get internal server error.
    - After investigation, we found that when user logs in to oracle database cloud, a cookie is set in browser with name s “OAMAuthnCookie_cstest-domo.db.us1.oraclecloudapps.com:443” and value as some random token. This cookie is passed in the subsequent requests to the RESTful Service calls when using same browser and as a result, we are able to get the results
    - In the Java program, we copied the same cookie with random token in the HTTP Request header and we got the proper response from REST APIs.
    - It seems that this cookie is created by an Oracle Middleware tool/server called as OAM – Oracle Accounts Manager, which sends the authentication token after successful authentication and creates the cookie.
    - We found that the cookie that OAM creates on authentication is exactly in the same format i.e. ‘OAMAuthnCookie_cstest-domo.db.us1.oraclecloudapps.com:443’. So, we are guessing that Oracle cloud uses OAM for authentication. Please refer to following link for same : http://docs.oracle.com/cd/E14571_01/doc.1111/e15478/sso.htm
    Can anyone please suggest:
    1.     How to provide authentication to Oracle Cloud REST APIs from java program?
    2.     How to pass the username and password in Java code to OAM (or how to communicate with OAM using Java) so that we can receive the unique token from OAM. We can use the token in the further requests? 3.     Also in Oracle cloud white papers , it is mentioned that they support OAuth2.0. But we didn’t find any URLs for same. Can anyone please confirm?
    Thanks
    ~ Neeraj Girolkar

    Hi Nilesh,
    We tried to connect to Oracle Cloud Database using the way you suggested above, but unfortunately it is not working as well.
    Can you let us know the authentication process with Oracle Cloud Database? We found in documentation that it uses OAM (Oracle Access Manager) for authentication. Can you tell us a bit about that? That will be extremely helpful.
    Thanks,
    - Neeraj

  • How To Call HTML Page Through Java Swing Page  ???....

    Hi All ;
    Please Can You Tell Me How To Call HTML Page Through Java Swing Page ....
    Regards ;

    Hi,
    you can use HTML fragments on a panel.
    http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
    However, to integrate a browser you need 3rd party software like IceBrowser
    If you Google for: HTML Swing
    then you find many more hints
    Frank

  • Communicate with ICF services through java(servlet)

    hello,
    i'm trying to interrogate an ICF webservice through jsp , but it doesn't work .
    i can't interrogate the webservice through ajax (xml httprequest) since it's a not a cross-domain object.
    so i'm pushed to use a servlet as proxy to retreive de xml result from the ICF webservice .
    is there some kinda restriction when you call the icf webservice from a serverside language ..?
    or a special API ?
    looking forward to receiving help

    - When we are logging in to Oracle cloud on browser and execute the Oracle cloud RESTful service in another tab of same browser, we are able to get the result. But when executed the same RESTful service from a different browser or java program we get internal server error.
    - After investigation, we found that when user logs in to oracle database cloud, a cookie is set in browser with name s “OAMAuthnCookie_cstest-domo.db.us1.oraclecloudapps.com:443” and value as some random token. This cookie is passed in the subsequent requests to the RESTful Service calls when using same browser and as a result, we are able to get the results
    - In the Java program, we copied the same cookie with random token in the HTTP Request header and we got the proper response from REST APIs.
    - It seems that this cookie is created by an Oracle Middleware tool/server called as OAM – Oracle Accounts Manager, which sends the authentication token after successful authentication and creates the cookie.
    - We found that the cookie that OAM creates on authentication is exactly in the same format i.e. ‘OAMAuthnCookie_cstest-domo.db.us1.oraclecloudapps.com:443’. So, we are guessing that Oracle cloud uses OAM for authentication. Please refer to following link for same : http://docs.oracle.com/cd/E14571_01/doc.1111/e15478/sso.htm
    Can anyone please suggest:
    1.     How to provide authentication to Oracle Cloud REST APIs from java program?
    2.     How to pass the username and password in Java code to OAM (or how to communicate with OAM using Java) so that we can receive the unique token from OAM. We can use the token in the further requests? 3.     Also in Oracle cloud white papers , it is mentioned that they support OAuth2.0. But we didn’t find any URLs for same. Can anyone please confirm?
    Thanks
    ~ Neeraj Girolkar

  • BO Opendocument Url not giving pdf report when invoked through Java.

    Hi All,
    I'm trying to get pdf report by invoking the BO XI R3 server using the below url.
    <br>
    <br>
    <br>
    http://corpbo101d:41040/OpenDocument/opendoc/openDocument.jsp?sType=rpt&sDocName=BankAsAgentNA_1_au&sOutputFormat=P&lsS@model_code=BANKAGENT&lsS@user_id=sv66397&lsS@gen_no=1
    <br>
    <br>
    <B>This url gives the pdf report as expected when accessed through the browser.</B>
    <br>
    <br>
    But when accessing through Java it is not giving the pdf but its giving the content of the opendocument.jsp instead.
    <br>
    <B>Please let me what am I doing wrong.</B>
    <br>
    <br>
    Thanks in advance.
    Your code was breaking the forum thread so I removed it.
    Edited by: Jason Everly on Apr 19, 2010 10:17 AM

    Thanks for the response Jason,<br>
    <br>
    The java script were part of the output that I got when I invoked the url through Java. That is not the code that I'm using but the response which I'm getting after invoking the url.<br>
    <br>
    The url that I used is the one that I already pasted in the start of the thread.<br>
    <br>
    http://<server>:<port>/OpenDocument/opendoc/openDocument.jsp?sType=rpt&sDocName=BankAsAgentNA_1_au&sOutputFormat=P&lsS@model_code=BANKAGENT&lsS@user_id=sv66397&lsS@gen_no=1<br>
    <br>
    And yes I'm passing parameters along the url. <B>But it is with opendocument only and not viewrpt.*</B><br>
    <br>
    And this is already working through browser.<br>
    <br>
    But the problem occurs only during invocation through java, where I'm expecting a pdf byte stream. <br>
    <br>
    Instead i'm getting only html content. Which when I read through it, is nothing but the opendocument.jsp's source code.<br>
    <br>
    <B>Please find the java source code below.</B><br>
    <br>
              void readContent(String url) throws Exception, Exception{<br>
                   StringBuffer sb = new StringBuffer(url);
                   sb.append("&SM_USER=").append("USERID");<br>
    <br>               sb.append("&SM_SESSION=").append("fxdjmWRRN87gWfII3Bl//tUCgivgejevT29rnSInmXS05Hy8OZrVbzfxS7zLQbsceOX1NgPjBozft6GnYtLk7acHp6bom8pbgJrRXhlrB/okouB3LBoJl6oPf7eF/jj8CEYdsX5EhG/5MoK0YWrmIdWhjlmoixt0hHAdksm7S1rWlVSBhljv8KnjcFH7GA6QtP3TIPgSW1XaGhOiyUIMZL48av3f57KqXaAaw2dc32cJY28giWja2bGwQP/DcwMpuyHosZ1fKZVreoPHCKdvcYyV7jBZx0x68wacTBJgtBD1WdqdWmLwlA720xL8627LYNsbRtBPNHzCbjHQuA07iUVpwie8KuVfUL0bNloOejBX0idhkuRSKUEyWQOyvfXWaxL2rkZ/GRTsXzfTwUrUwqdoO6rDXGOPHFaLLdGd1VjBMZs5K6KAmpEs5lNf7CqBpCe5uG1J2QrxT5E7kqLRHBF1W2BN/AmqTpzvJoK5r7TXJZQVgGCcdnnZ9KLe5Zh8TED7VsU3DZCrXVOSol6dcbFQpqHozu0RVuOe5bQ4lfzgxtP0IdpjwAH4Sv6Bthf5/jujntxx6OjCl53GmtwN04e2ptf1UiBsN/MBClWXAMXW5WrtQEAyhp9Jcat2127AAkaEwFQEtPKoYa4Jg0GrzNZGHzj4UlqrWG9UeDAvGJ0GdZK4qrbkC6uPtn3ebMr/uHO90l4anrrSjWQYnKVjYNzCO4UUISYBy1aArFo73zEHz/ofdTCPk5FYSABGPTL2WnTEzOhvbHjI/y5ZZRAQVFgO38HhzhJvKr8TvF4sc/276UaMrjHf1UGL6ebB89UqKfLBrgzjvLLD3jZfX9R3N12fK0Z50rVFY/czb2Mui5s6VGnuEMcmoDAsUEjccmO4FhwswMW0KeBAPvc/2u6QJurxMPctBrDovV8FQSVhOLLGkzpeCUp4GlwDVEYYVRZY494xPi2hUmP4hsPafJ1s6HSTI/HmrH+I4oj90es4xjUBvTfALtWt5fSJbnF96Yes0vSGos4FuM908Bn/EK6CuOE8wAqLvmZvVVGZG12dvd");<br>
    <br>
               InputStream in = new BufferedInputStream(connection.getInputStream());<br>
    <br>
                   Reader r = new InputStreamReader(in);<br>
                   int c;<br>
                   while ((c = r.read()) != -1) {<br>
                     System.out.print((char) c);<br>
                   }<br>
         }<br>
    Edited by: Naaveen M on Apr 20, 2010 2:21 PM

  • Bypassing Proxy Server through java

    Hi !!
    I`m creating a web browser in JAVA for my college project.I`m using JEditorPane to display HTML in my browser.
    My project is running fine at my home where i`ve no proxy but in college, I have a requirement to display HTML pages through a Cyberoam Server running at port 3128.The authentication is done thru Cyberoam client software which is done by the user itself on logging into Windows, so my application has no role in that.
    Please help me in regards to how to move through this Cyberoam firewall.
    Waiting for a response,
    Amit Sharma

    remember Google is your friend. I got this off of a Google
    http://java.sun.com/developer/technicalArticles/DataTypes/proxy/
    Since this is for a college project and the instructor had imposed the requirement of using Cyberoam, I'd suggest you take better notes in class--I've never had a class where the instructor made something mandatory without a discussion on how to approach it and supply resources where nessisary to do so.

  • Modifing the browser through an applet.

    Is there any way to modify a browser through an applet. I'm trying to change a browers size to fit my applet better. I read somewhere that you could thorugh DOM, but I haven't had any success.
    Any help would be great.

    Can't do that through DOM, but you can call Javascript from Java (assuming the browser supports this, and the user has not disabled it). To do this look for documentation on JSObject on Netscape's DevEdge site (http://devedge.netscape.com/library/manuals/2000/javascript/1.4/reference/lcjsobj.html).

  • How to change system time through java program

    Hi
    I want to know, how to change system time through java program.
    give me a idia with example.
    Thanks

    There isn't any core Java API for this. Use JNI or call an external process with Runtime.exec().
    ~

  • Error while running executable file through java in WinNT

    I would like to run an executable file with Java.
    - If I try with notepad or paint, i.e. Windows Applications,
      I have no problem.
    - I also can run Non-Windows-Own Applications, except one.
      I get an error message, if I want to run this program through Java.
    I have tried following commands to run an executable file.
    Runtime.getRuntime().exec("cmd.exe /c "+command);
    Runtime.getRuntime().exec("cmd.exe /c start "+command);
    Runtime.getRuntime().exec("cmd.exe /c start /wait "+command);
    Runtime.getRuntime().exec("cmd.exe /k start "+command);
    command : the path to the executable file
    I can run the application directly, if I click the icon on desktop,
    but not through Java.
    here is the error message I get
    screenshot : http://www.aykut.de/error_message.jpg
    Text : "Security Check failure"
            The Logon System has been tampered with.
            The Administrator will need to re-install.
    my Idea :
    The application is "old".
    I think it was written for Win 3.1.
    Therefore I don't know if there is any other
    possibilty to run a "DOS Exe File" through Java.

    I have just figured out how it works,
    if somebody else here in forum have this problem,
    here is the solution :
    String path = "F:\...\...\Application.exe";
    String envDir = path.substring(0, path.lastIndexOf("\\"));
    String[] command = {"cmd.exe", "/c", "start", "/wait", "/D"+envDir, path};
    Process process = Runtime.getRuntime().exec(command);
    "start /Dpath" => path: environment directory F:\...\...\
    "start /wait" => wait until Application.exe terminates
    if you use Win95 or Win98 use command.com instead of cmd.exe
    Aykut

  • Error while trying to access BPEL process through java on localhost

    I have a service (CreditRatingService that comes along with install) running on the BPEL engine. Trying to invoke it through java. However, I get an exception. Below is more information. Appreciate any help.
    My method
        public String invokeBpel()
          Map payload;
          Hashtable jndi = null;
          try
           String ssn ="1234";
           String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
            Locator locator;
            locator = new Locator("default","welcome1",jndi);
             IDeliveryService deliveryService =
              (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
              NormalizedMessage nm = new NormalizedMessage( );
              nm.addPart("payload", xml );
                NormalizedMessage res =null;
                try
                 res = deliveryService.request("CreditRatingService","process", nm);
                catch(RemoteException oNameEx)
                    System.out.println(oNameEx.getMessage());
                payload = res.getPayload();
                System.out.println( "BPELProcess CreditRatingService executed!<br>" );
                System.out.println( "Credit Rating is " + payload.get("payload") );
          catch (Exception e)
            System.out.println("This is the exception" + e);
            System.out.println(e.getStackTrace());
          finally
              return "toPage3"; 
        }//end method
    Exception  text
    Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found
    Env
    ADF Business Components:10.1.3.39.84
    BPEL Designer      10.1.3.1.0 (Build 061009.0802)
    CVS Version     Internal to Oracle JDeveloper (client-only)
    Java™ Platform     1.5.0_06
    Oracle IDE     10.1.3.39.84
    Struts Modeler Version     10.1.3.39.84
    UML Modelers Version     10.1.3.39.84
    Versioning Support     10.1.3.39.84

    Hashtable jndi = null;
    try
    String ssn ="1234";
    String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
    Locator locator;
    locator = new Locator("default","welcome1",jndi);
    this implies to be in the same initial context then the bpel engine, whicuh you cannot be as long as you are not either part of the ejb code of orabpel or a child of it. and if you are you can use the Locator API without the jndi properties.
    hth clemens

  • Issue with sending mail through java stored procedure in Oracle

    Hello
    I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
    Error:
    javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
    Code for creating java stored procedure: (T1 is the table created for debugging)
    ==================================================
    create or replace and compile java source named "MailUtil1" AS
    import java.util.Enumeration;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class MailUtil1 {
    public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
    String from, //sender mail id
    String fromPwd,//sender mail pwd
    String port,//587
    String to,//recepient email ids
    String cc,
    String subject,
    String messageBody) {
    try{
    Properties props = System.getProperties();
    props.put("mail.smtp.starttls.enable", "True"); // added this line
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.user", from);
    props.put("mail.smtp.password", fromPwd);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.auth", "true");
    #sql { insert into t1 (c1) values ('1'||:host)};
    Session session = Session.getDefaultInstance(props, null);
    MimeMessage message = new MimeMessage(session);
    message.setFrom(new InternetAddress(from));
    #sql { insert into t1 (c1) values ('2')};
    InternetAddress[] toAddress = new InternetAddress[1];
    // To get the array of addresses
    for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
    toAddress[i] = new InternetAddress(to);
    //System.out.println(Message.RecipientType.TO);
    for( int i=0; i < toAddress.length; i++) { // changed from a while loop
    message.addRecipient(Message.RecipientType.TO, toAddress);
    if (cc!=null) {
    InternetAddress [] ccAddress = new InternetAddress[1];
    for(int j=0;j<ccAddress.length;j++){
    ccAddress[j] = new InternetAddress(cc);
    for (int j=0;j<ccAddress.length;j++){
    message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
    message.setSubject(subject);
    message.setText(messageBody);
    message.saveChanges();
    #sql { insert into t1 (c1) values ('3')};
    Enumeration en = message.getAllHeaderLines();
    String token;
    while(en.hasMoreElements()){
    token ="E:"+en.nextElement().toString();
    #sql { insert into t1 (c1) values (:token)};
    token ="ConTyp:"+message.getContentType();
    #sql { insert into t1 (c1) values (:token)};
    token = "Encod:"+message.getEncoding();
    #sql { insert into t1 (c1) values (:token)};
    token = "Con:"+message.getContent();
    #sql { insert into t1 (c1) values (:token)};
    Transport transport = session.getTransport("smtp");
    #sql { insert into t1 (c1) values ('3.1')};
    transport.connect(host, from, fromPwd);
    #sql { insert into t1 (c1) values ('3.2')};
    transport.sendMessage(message, message.getAllRecipients());
    #sql { insert into t1 (c1) values ('3.3')};
    transport.close();
    #sql { insert into t1 (c1) values ('4')};
    catch(Exception e){
    e.printStackTrace();
    String ex= e.toString();
    try{
    #sql { insert into t1 (c1) values (:ex)};
    catch(Exception e1)
    Edited by: user12050615 on Jan 16, 2012 12:18 AM

    Hello,
    Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
    So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
    Thanks
    Srikanth
    Edited by: user12050615 on Jan 16, 2012 12:17 AM

  • How to create and install a toolbar to a browser using java

    Hi all,
    Can any one guide me about how to create and install toolbar to a browser using java ??
    please any one help me about this,i am not getting any idea about this..
    Thanks and Regards
    Sandesh S

    I doubt you can. Those browser toolbars are done by implementing to an API provided by the browser. That API, I don't believe, is provided via Java. But of course, that would be entirely up to the browser, not Java.

Maybe you are looking for

  • How do I save my laptop that was rained on?

    About three days ago, I left my windows open and rain fell through it onto my laptop. The laptop was on and connected to a wall charger but after the rain, it went off. I tried turning it on after sucking the water out bit it does not come. Also when

  • Passing -Xms -Xmx argument when launching a Jar file

    Hi My Java app is memory hungry and, so far, I have to start it with java -Xmx256m -jar myApp.jar I'm wondering if it's possible to embed "-Xms256m" into this .jar file so that I can simply start it by double-clicking on the myApp.jar file. Thanks Hu

  • Podcasts Sort Order

    I don't know where else to suggest this to the Apple Podcasts people, but one of the biggest annoyances with this app for me is that the sort order for each Podcast and the Unplayed Podcasts lists is newest to oldest, this is exactly opposite of what

  • Why are videos... photos?

    Is there anything in the works to change this? iPhoto and iTunes both see 3GS videos as photos. Even the prefix, "IMG," stands for "image." This is kind of a "duh" moment that I'm surprised Apple missed.

  • Blue screen with itunes 9

    Alright so I get the blue screen of death everytime i hook up my ipod into my computer. Ive un-installed and re-installed itunes 9 several times, and ive had no luck. any ideas of whats going on or what I can do to fix it? i have an empty ipod and it