Calling JNLP file via Servlet

Hi Folks,
I need to pass runtime parameters to my jnlp file from URL param, like ?requestNum=12345&mergeId=1.
So I created a Servlet to process the request and add the requestParams at runtime in the JNLP file,
In the doGet Method I have teh following piece of code,
String[] args = new String[]{"requsetNum",request.getParameter("requestNum"),"mergeId",request.getParameter("mergeId")};
response.setContentType("application/x-java-jnlp-file");
PrintWriter out = response.getWriter();
//It writes the jnlp content prperly in console,          System.out.println(JnlpFileContentBase.readBeforeArgElementsContent()+JnlpFileContentBase.populateArguments(args)+JnlpFileContentBase.readAfterArgElementsContent());
//I split the jnlp file content before and after the argument area out.println(JnlpFileContentBase.readBeforeArgElementsContent()+JnlpFileContentBase.populateArguments(args)+JnlpFileContentBase.readAfterArgElementsContent());
out.close();
But when i run on server the above the jnlp is not starting up,
Am i missing something in the doGet method? is the PrintWriter out object is enough to write back the content?
Please help me to find out what am missing out here.
Thanks
Subash

Hi Andrew,
Thanks for notifying that, but that due to my testings with several combinations, I copied the file and kept direcly under WEB-INF and under the webapps/ElemFinder and several places to see it could be retried or not. And hence copied one of the errors. Nothing worked btw.
I suspected initially it could be because of calling another jnlp file, but now i have my consolidated single jnlp file, but still have the FileNotFoundException for the jar file I have,
sb.append("<jar href=\"WEB-INF/org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar\"/>\n"); // code from Servlet
This is the firs jar resource under the resource elements
Where I get the Exception,
java.io.FileNotFoundException: http://localhost:8080/ElemFinder/ElemFinderEngineInvoker/WEB-INF/org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar
I think its basically issues with reading the resource files,
I tried with several options for this file either, placing under WEB-INF, under webapps/ElemFinder ... etc. Nothing seems to be working,
Any entries to be put in web.xml for this?
Pls help me to get rid of this....
Thanks
Subash
PS: BTW i dint try in teh util u gave sice the jnlp already is downloading from my App, do you think still needed to check in the util?

Similar Messages

  • Keeping contact with controlling applet while u/l XML file via servlet

    Hello everybody,
    if I am thinking too complicated, please send me other suggestions. Here's the situation:
    I already have a working applet for a metadata application, that is sending the contents of the client's textfields to a remote database via servlet communication. Now I want to implement the following:
    -The users have some attribute data in form of an XML file
    -I want them to upload this file to the server (I already have that functionality using the fileUpload libraries of Apache Commons) by calling the servlet from a pop-up html page (is there any other possibility to do the communication, i.e. getting files from the file system?)
    -the XML file should be parsed on the server and the content should be sent back to the calling applet for previewing reasons.
    -when the user gives his/her O.K. the data should be transferred to the database.
    Now there are some obstacles to overcome: When I upload the XML file to the server, I loose "contact" with the applet, i.e. the file is not connected with the applet code in any way. This is not a problem, when there is only one user at the time, but with many users loading up their data at the same time, things could get tricky.
    What I thought was to copy the XML file to a temp directory with a unique name, the name of which would be transferred back to the applet by another servlet that is called when the (upload)pop-up window closes. The name of the temp directory could be the ID of the applet thread (is there such an ID, if yes, how can it be retrieved?)
    Any suggestions (or just shaking heads concerning my complicated construction ;-) )
    Cheers and many thanks in advance
    Jan

    You may be able to read a file from the file system with the applet, but it may require you to sign the applet. If you can, then use an HttpURLConnection to the servlet and send the file that way.
    On the server side, you could create a session object (wether you actually need a session or not), and use the session's id as the key id for the directory name for the uploaded file. Session IDs are unique per client, and if the client handles cookies, then the same session will be used from one request to the next.
      session = request.getSession();
      String sessionID = session.getId();The response from the servlet would be a link to the server-side file. If you are using the Applet to send the request, you could get the response and automatically view the new file. Otherwise, you could send a page to the popup window saying: "Click This Link To See Your File" type of thing.

  • Call batch file from Servlet.

    Hi all,
    can anybody tell me how to call or run batch file
    from Servlet.
    Please do hurry.

    class RuntimeClass
    public static void main(String str[]){
    Runtime JVM = Runtime.getRuntime();
              try
                   JVM.exec("abc.bat");
              catch(Exception e)
                   System.out.println("hello");
    Hi,
    i hope the above program will help.

  • Generating JNLP file with servlet?

    Hi all,
    I want to pass in paramters from a hyperlink into a webstart application. Now I know this can be done with webstart 1.5, but using this is not an option for us. What I would like to do is to create a servlet that generates a JNLP file from any parameters passed into it on the hyperlink.
    Has anybody done this? Is this possible? would there be any problems with this?
    thanks,
    J

    That's running fine with us. That has been the way for us to transmit authentication information to pass inside the JNLP world.
    Be very careful with your output, there's no validation at the client and errors created by wrong JNLPs can be really unpredictable. Do use the DTD to at build time to check the output!
    The JNLP file will be downloaded every-time if you output correct headers...
    paul

  • Capturing IE file dialog event when downloading file via servlet outstream?

    Hi, I've got a situation that it seems many people have run into, but none have solved. Or, at least, no one has posted a solution yet...
    I'm writing a file to a client's machine via an output stream retrieved from the HttpServletResponse. Once I begin writing the file, IE pops up a dialog box with Open/Save/Cancel buttons.
    I need to be able to capture the event that occurs when a user presses a button on this dialog. (Specifically, the "Cancel" event.) I know that the IE browser is interacting with the servlet output stream, because it blocks until a button is pushed.
    I would assume that pressing "Cancel" breaks the connection with the output stream, and therefore cause an IOException if the output stream is referenced again. But that doesn't appear to be the case.
    If anyone has ANY solution for this, please let me know. I've been beating my head against this for 2 days now.
    Thanks in advance!
    Don

    There is no way to do this. The data is sent to the client and the connection is closed. Only time you would receive a IOException is if the network connection went down, or the OutputStream.close() was called while you were writing.
    You might think about using a Signed Applet and have it do file IO to the client. You could design the UI to have a cancel button also. At lest then you can ensure when and if the file was transfered.
    I hope this helps.
    -Richard Burton

  • Error while running Java program which call a file upload servlet

    Hi all,
    I have a java program which calls a servlet and sends the file to be uploaded by the servlet. I used Jbuilder to create java program and servlet program. I compiled both the programs and compilation suceeded and my class files are avaialbe in
    WEB-INF/classes/content directory. But now I am trying to run the Java program(this contains main method) from the command prompt, which should inturn call my servlet.(I have web.xml file inside WEB-INF dir). But I receive the following error
    C:\tomcat5.5.15\apache-tomcat-5.5.16\webapps\content\WEB-INF\classes\content>java MultiContentSender
    Exception in thread "main" java.lang.NoClassDefFoundError: MultiContentSender (w
    rong name: content/MultiContentSender)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    My dir strcture is as below
    TOMCAT_HOME/webapps/content/WEB-INF/classes/content/*.class
    I am not able to figure out the error, can anyone throw some light on this issue.

    You are trying to invoke the class from the command prompt. My guess is that MultiContentSender contains a package, which means that you'll need to add your WEB-INF\classes directory to the classpath before it will work. Classes stored in this directory are expected to be invoked through tomcat, which builds it's own classpath.

  • Calling HTML file from servlet and vice versa...

    i have got few questions..
    1- if a site is made in HTML then what should be used to put user login functionality in it, servlets or jsp or other option(specify)?
    2- im trying to do with servlets, so when im calling doPost method from HTML page and sending data, everything working fine but because of this the page refreshes and the HTML coding get lost, so how can i stop that from happening if possible, like showing the same page with messege = "Logged in".
    3- how can i call an HTML page from servlet?
    4- how can i send data from servlet to HTML page?

    that i m aware of, but when a servlet is called then the page will refresh n it will display the things that you have mentioned in the servlet file n not the things that u have mentioned in HTML file, n the page will be blank if u have not mentioned any HTML coding in servlet file.
    so i need to knw how to call back that prev HTML file so that the things i want to display can be displayed, i knw the same can be done by adding the HTML code in servlet file but i would like to know if there is any way to call back the HTML file.

  • Jnlp file called multiple times

    We're trying to pass HTTP parameters to our JNLP file (which is created by a .jsp file). When we run webstart from the command line (or a a web page), it seems like the JNLP file gets called multiple times. The first time our parameters are there, after that they are not. Why does webstart call the JNLP file multiple times? Has anyone else seen this.
    We're running Tomcat 4.x on Linux.
    From the command line we typed:
    javaws "http://localhost/helloWorld.jsp?hello=1&world=2"
    Tomcat Output:
    DEBUG: hello=1&world=2
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    DEBUG: null
    JSP File:
    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ page contentType="application/x-java-jnlp-file" %>
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp
    spec="1.0+"
    codebase="http://localhost"
    href="http://localhost/helloWorld.jsp">
    <information>
    <title>Hello World</title>
    <vendor>Nobody</vendor>
    <application-desc>Hello World Application</application-desc>
    </information>
    <resources>
    <j2se version="1.3+"/>
    <jar href="lib/helloWorld.jar" main="true"/>
    </resources>
    <application-desc main-class="test.HelloWorldApp"/>
    </jnlp>
    <% System.out.println("DEBUG: " + request.getQueryString()); %>
    Hello World Source:
    package test;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class HelloWorldApp {
    public static void main(String[] args) {
    JFrame frame = new JFrame("Hello World");
    frame.getContentPane().add(new JLabel("Hello World", JLabel.CENTER), BorderLayout.CENTER);
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    frame.setSize(200,150);
    frame.setVisible(true);
    }

    I am seeing this exact same problem, also creating the JNLP via a JSP. Any input would be greatly appreciated.

  • Calling EJB with HTML via SERVLET

    Hi,
    I used a writen example that calls EJB from HTML via SERVLET. Example name is Bonus. The problem I have is that the HTML throw error while calling SERVLET. I dont figure out what seams to be a problem. Someone know?
    I wonder if the problem is in servlet? The EJB is fine!
    christian
    HTML CODE:(bonus.html)
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1250"/>
    <TITLE>untitled1</TITLE>
    </HEAD>
    <BODY BGCOLOR = "WHITE">
    <BLOCKQUOTE>
    <H3>Bonus Calculation</H3>
    <FORM METHOD="GET" ACTION="BonusAlias">
    <P>Enter social security Number:<P>
    <INPUT TYPE="TEXT" NAME="SOCSEC"></INPUT>
    </P>
    Enter Multiplier:
    <P>
    <INPUT TYPE="TEXT" NAME="MULTIPLIER"></INPUT>
    </P>
    <INPUT TYPE="SUBMIT" VALUE="Submit">
    <INPUT TYPE="RESET">
    </FORM>
    </BLOCKQUOTE>
    </BODY>
    </HTML>
    SERVLET CODE:(BonusServlet.java)
    package mypackage5;
    import mypackage5.Calc;
    import mypackage5.CalcHome;
    import mypackage5.impl.CalcBean;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import java.beans.*;
    public class BonusServlet extends HttpServlet {
    CalcHome homecalc;
    public void init(ServletConfig config) throws ServletException{
    //Look up home interface
    try{
    //InitialContext ctx = new InitialContext();
    //Object objref = ctx.lookup("Calc");
    //homecalc = (CalcHome)PortableRemoteObject.narrow(objref, CalcHome.class);
    Context context = new InitialContext();
    CalcHome calcHome = (CalcHome)PortableRemoteObject.narrow(context.lookup("Calc"), CalcHome.class);
    Calc calc;
    catch (Exception NamingException) {
    NamingException.printStackTrace();
    public void doGet (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    String socsec = null;
    int multiplier = 0;
    double calc = 0.0;
    PrintWriter out;
    response.setContentType("text/html");
    String title = "EJB Example";
    out = response.getWriter();
    out.println("<HTML><HEAD><TITLE>");
    out.println(title);
    out.println("</TITLE></HEAD><BODY>");
    try{
    Calc theCalculation;
    //Get Multiplier and Social Security Information
    String strMult = request.getParameter("MULTIPLIER");
    Integer integerMult = new Integer(strMult);
    multiplier = integerMult.intValue();
    socsec = request.getParameter("SOCSEC");
    //Calculate bonus
    double bonus = 100.00;
    theCalculation = homecalc.create();
    calc = theCalculation.calcBonus(multiplier, bonus);
    catch (Exception CreateException){
    CreateException.printStackTrace();
    //Display Data
    out.println("<H1>Bonus Calculation</H1>");
    out.println("<P>Soc Sec: " + socsec + "<P>");
    out.println("<P>Multiplier: " +
    multiplier + "<P>");
    out.println("<P>Bonus Amount: " + calc + "<P>");
    out.println("</BODY></HTML>");
    out.close();
    public void destroy() {
    System.out.println("Destroy");

    The error is that page cannot be found! When I run only the servlet it works, when I run the HTML page and enter the field throws eror that the page cannot be found!
    thanks
    Christian

  • How to send a pdf file via http call

    Hi Experts,
    Please try to think on how you would send a file like a pdf file via the http call. You might need to convert the pdf in a character string which can be sent via http. The character string then might need to  get converted back into a pdf and saved in a file. Read through the Archive Link API guide to see how they send the body of a file.
    Please it is urgent......
    Thanks
    Basu

    so you want to push the PDF file over http to external system.
    where is pdf file stored.
    for examle if its in the clients desktop, you can use gui_upload to upload to internal tabble (type BIN) then use FM SCMS_BINARY_TO_XSTRING to conver the binary table to type string.
    then use cl_http_client class to push the file to the destination.

  • Problems with creating XML file via Call Transformation

    Hi,
    When creating a XML file via Call transformation an extra character '#'is placed at the beginning of the file.
    This problems occurs since the upgrade to ECC6.0 and the Unicode conversion.
    When opening the XML file the following error message appears:
    Invalid at the top level of the document. Error processing resource 'file ....
    Has anybody an idea why this extra character is placed at the beginning of the file. Has it something to do with the unicode conversion and how can we solve the problem?
    thanks for your help
    kind regards,
    Maarten van IJzendoorn

    Hello Marteen,
    Can you please share the solution to this issue and let me know.
    Our Issue:
    1) We are executing a report which generates an XML file on FTP.
    2) The FTP file is always in Error when executed thorugh JAPANESE login but not thorugh EN login.
    3) The XML files generated have always an extra character in the end ( which can be space,#,$%^&, etc.) when this extra character is removed from XML file with opening it in NOTEPAD then XML works OK in JA login as well.
    4) In the PROGRAM everything has been checked with respect to OPEN dataset statement , XML ports UNICODE etc.
    5) THIS issue has been reported only after upgrading to ECC 6.0 from 4.6C.( in older version it works fine).
    Various OPEN dataset statments are :
    OPEN DATASET path_fil
    FOR OUTPUT
    Thanks to reply.

  • How to call any .tmpl file from servlet by sending some parameters ?

    Hi,
    I am new to Java Servlet and HTML template language ( anyfile.tmpl).
    I have created simple login authentication with user registration for new user.
    If user already exists, after successful login, he should be navigated to INBOX page (that inbox page is some inbox.tmpl file) from SERVLET itself using following BOLD statements given in code below. But its not working.. :-( Please do the needful.
    Thank you.
    if (session == null) {
         try {
              userName = request.getParameter("login");
              pwd = request.getParameter("password");
              if (!userName.equals("") && !pwd.equals("")) {
              try {
    //Database connection, data fetching, query execution etc.
    // code will go here
                   while (rs.next()) {
                   if (userName.equals(rs.getString("username")) & pwd.equals(rs.getString("pwd"))) {
                        String u_name = userName;
                        String ph_no = (new Integer(rs.getInt("ph_no"))).toString();
                        String address = rs.getString("address");
                        session = request.getSession();
                        session.setAttribute("user", userName);
                        String inbox = context.getInitParameter(INBOX);
                        Template inboxTmpl = new Template(inbox);
    *                    inboxTmpl.setParam("userName", u_name);*
    *                    inboxTmpl.setParam("ph_no", ph_no);*
    *                    inboxTmpl.setParam("address", address);*
    *                    out.println(inboxTmpl.output());*
                        System.out.println("Login successful..");
                        break;
                   rs.close();
         pstmt.close();
    con.close();
    (P.S - I am forced to use HTML.TEMPLATE(i.e. .tmpl file) instead of JSP)}

    Where does Template come from?
    But its not working.The other day I called the car repair shop. I told them my car did not work and I wanted them to fix it. They asked what was wrong, whether it did not start, whether suspicious sounds were heard, whether the car did not want to brake any longer, whether it gave a smoke from the exhaustion, whether the wind shield was broken, whether the oil was leaking etc. But I insisted just telling them "it doesn't work".

  • JNLP File Generated By A Servlet

    Based on configuration issues with our system build, I have created a servlet that generates the JNLP file for an app we have created. Once the file is written and contains all the dynamically generated info, it is never written by the servlet again.
    I noticed in creating the servlet, initially, that I actually HAD to write the JNLP file. Returning the JNLP file and setting the mime type in the HTTP response was not enough. When Web Start is invoked by the browser, it goes back to the stored JNLP file on the server.
    Can anyone explain why this is necessary?? Its seems redundant. If I can create the JNLP dynamically and pass it back to the browser, why must Web Start retrieve the JNLP file AGAIN from the web server after it launches??
    John Turner
    Software Engineer
    Context Media, Inc
    [email protected]

    There is a limit to what you can do with dynamically generated JNLP files. The combination of codebase and href must exactly specify the JNLP resource that you are retrieving. If you're using a servlet with parameters in a query string to generate the file, it should look like this:
    <jnlp spec="1.0+" codebase="http://app.datadevelopment.com/app" href="MyServlet?param1=value1&param2=value2">
    As long as the MIME type returned by the servlet is "application/x-java-jnlp-file", JWS will start just fine. Unfortunately, JWS will then bomb badly because it tries to use the href attribute as part of the file name for saving the file, and Windows at least doesn't like question marks in a file name.
    A workaround is to replace the query string with path values:
    <jnlp spec="1.0+" codebase="http://app.datadevelopment.com/app" href="MyServlet/param1=value1/param2=value2">
    I'm not 100% sure that this will work with the '=' sign as my application needed only one parameter so I dispensed with the paramN=valueN and replaced the directory with valueN only. The point is, though, that each and every time the application is launched JWS will go to the web server to get the latest copy of the JNLP and the only way I have found to dynamically generate the content is to append the necessary parameters as path names after the script (JSP in my case, servlet in your case).
    If you have multiple parameters and the '=' sign is a problem, strip out the parameter name and require that the parameters be specified in the same order each time. Use one directory delimiter per parameter.
    You can use request.getPathInfo() to retrieve the path after your servlet.

  • Servlet for reading lotus notes nsf-file via corba-interface

    Hello,
    we have written a servlet for reading lotus notes nsf-file via corba-interface.
    So we can read lotus notes-files in a portal url-iview.
    Are you interested?
    Best regards
    Oliver Prodinger

    If you check out the thread from my question (524480), we found
    that we had to enable the IIOP task on the domino server as we
    were not running it, this cured the problem I think you are
    encountering.
    This has not solved all our problems as I only see Notes data in
    the Inbox Portlet Preview mode, this problem is refered by other
    contributors as the collapsing Portlet problem (496625) and I do
    not know whether there is a solution to this problem yet.
    Hope this helps.

  • How to call/Execute a dos batch file via LAN

    Hello,
    Can i execute remotely dos batch files?
    I have to execute bat file via LAN ex
    IP\dir\batfile.bat from abap code, is that possible?
    thanks in advance,
    Michal

    Hi,
    Use CL_GUI_FRONTEND_SERVICES=>EXECUTE method to run any application in your case batch file..
    The batch file you are trying to run should be accessible on presentation system i.e. user's machine.
    Regards,
    Vishal

Maybe you are looking for