Is it possible in java

hey could any one tell me whether the task given below is possible
if so what i hve to study plz suggest
Sends a HTTP Post message with the specified parameters and then verifies the return value is a 200 series return

Sends a HTTP Post message with the specified
parameters and then verifies the return value is a
200 series returnYes. Look at the java.net package.

Similar Messages

  • Is down casting possible in Java objects(reference variables)?

    I hope, Java up casting and down casting is possible in Java primitive variables like int float and so on.
    My doubt is,Does in object of Java(reference variables) support down casting?

    makpandian wrote:
    the ques i asked here is popped from my mind.We know that.
    But i did not get answer .Because you didn't do any research.
    Than s why i ask this here..That's the wrong approach. Do some research first. Use google, a textbook, a tutorial, the JLS, write some code, etc. etc.
    After spending time and effort doing that, if you still have questions, indicate clearly what you read and what part you didn't understand. The way you're doing it is NOT an effective way to learn, and it's a waste of everyone's time.

  • Is it possible in java to pass reference of object in Java?

    Hello,
    I'm relativily new to Java but I have "solid" knowledge in C+ and C# .NET+.
    Is it possible in java to pass reference of object in Java? I read some articles about weakreferences, softreferences, etc. but it seems that it's not what I'm looking for.
    Here is a little piece of code I wrote:
    package Software;
    import java.util.Random;
    * @author Rodrigue
    public class RandomText
        private Random rand = new Random();
        private Thread t;
        private String rText = "Rodrigue";
        public RandomText()
            t = new Thread()
                @Override
                public void run()
                    try
                        while(true)
                            UpdateText();
                            sleep(100);
                    catch(InterruptedException ex)
            t.start();
        private void UpdateText()
            int i = rand.nextInt();
            synchronized (rText)
                rText = String.valueOf(i);
        public String GetText()
            return rText;
    }It's just a class which start a thread. This class updates a text with a random integer 10 times per second.
    I would like to get a reference on the String rText (like in C++ ;) yes I know, I must think in Java :D). So, like that, I could get one time the reference, thanks to the GetText function, and update the text when my application will repaint. Otherwise, I always have to call the GetText method ... which is slow, no?
    Are objects passed by reference in java? Or, my string is duplicated each time?
    Thank you very much in advance!
    Rodrigue

    disturbedRod wrote:
    Ok, "Everything in Java is passed by value. Objects, however, are never passed at all.". Reference of object is passed by value too.
    But, how to solve my problem in Java_? I have an object which is continually modified in a thread. From an another side, this object is continually repainted in a form.I'm not sure I totally understand your problem. If you pass a reference to an object, then both the caller and the method point to the same object. Changing the internal state of the object (e.g. by calling a setter method) through one reference will be observed through both references, since they both point to the same object.
    No, calling a method is not particularly slow. Especially if it's just a simple getter method that returns the value of a member variable.
    If this is happening in a multithreaded context, you'll have to use proper synchronization to ensure that each thread sees the others' changes.

  • Is it possible in java 5 to generate a XML document from object?

    Hi all ,
    Is it possible in java 5 to generate a XML document from object?if yes, how do I implement this?
    ~Regards

    : /\ P:^P would look better. ;)
    0 0
      >
      U

  • N:1 Mapping Possible using Java Mapping?

    All,
    Is it possible to do a N:1 mapping using Java Mapping?
    If yes , how?
    Reason for this question is that the execute() of the Java Mapping is going to take the source / request message as the InputStream . In the case of N:1 mapping , as we have multiple messages , how will they be send to the InputStream? Will both the messages be sent combined into the InputStream? Will the MESSAGES tag be embedded into the input stream?
    Regards,
    Bhavesh

    Hi @ll;
    i try the same.
    to conduct a java mapping with 2 input structures that fills one target structure.
    This mapping is part of a Integrationprocess.
    I tested the mapping at the Integration Repository (Interface mapping) with the structure given by henrique and it works fine without any error.
    At runtime this structure looks like this (different prefix)
    <?xml version="1.0" encoding="UTF-8"?>
    <sxi:Messages xmlns:sxi="http://sap.com/xi/XI/SplitAndMerge">
         <sxi:Message1>
              <YOURXML1>...</YOURXML1>
         </sxi:Message1>
         <sxi:Message2>
              <YOURXML2>...</YOURXML2>
         </sxi:Message2>
    </sxi:Messages>
    As I put it in the Integrationprocess unfortunately a strange error arises.
    The trace Workflow-Protocoll shows following error.
    <Trace level="2" type="T">Call method execute of the application Java mapping com.endress.infoserve.xi.mapping.MergeConfigStore_IdocOrder </Trace>
    <Trace level="2" type="T">Java mapping com/endress/infoserve/xi/mapping/MergeConfigStore_IdocOrder completed. (executeStep() of com.endress.infoserve.xi.mapping.MergeConfigStore_IdocOrder </Trace>
    <Trace level="1" type="T">Parsing error after multi mapping.Expected Message<i> instead of IDOC </Trace>
    I can't make head nor tail of it.
    what´s the mistake?
    can anybody please help me?
    Thanks in advance
    Kind regards

  • Is this possible: SAP Java Connector - XI - R3 with XI RFC Adapter?

    Hi,
    I try to call a RFC on a remote R/3 System over the XI Server in a Java Application with SAP Java Connector.
    I have configured a RFC Sender Adapter in XI. I get the
    following Exception:
    "lookup of alternativeServiceIdentifier via CPA-cache failed for channel 'SenderChannel_RFC"!
    Is this scenario possible? Or do the connection from
    a SAP Java Connector App to the XI RFC Adapter not work?
    You can't set the Client and System ID of a Third-Party or
    Standalone Java system in the SLD.
    Thanks for any help!
    Regards
    Wolfgang

    Hi,
    We use a JCO for directly connecting to sap systems.
    In that case we need not use any XI also.
    But if you want to use RFC adapter and java application the best way is to use java proxies as sender and reciever as RFC adapter.
    I donot think there is any  architectural significance in using rfc adapter of XI while using JCO.
    Let me know if I mis-understood the context.

  • Fast file system search not possible in java?

    hi,
    I'd like to find all xml files on a disk as quickly as possible. The simple implementation takes far too long (e.g. over 30 seconds for a disk with 10,000 files and 1000 folders).
    This is a network drive, but the reason I think 30 seconds is slow is that the equivalent C code does it in much less time (over the same network conditions)
    I've seen it run on a drive with 200000 files and 30000 folders, and this takes between 10-15 minutes, while C code takes around 1-2 minutes.
    I'm not sure what the C code does exactly, and it may have access to much better OS calls than java can assume.
    The only three things I can think of are
    1) try to use fewer file objects (can't see a way of doing this)
    2) try threading (i've done small tests before and not got any gain)
    3) try using FileFilters (i've done small tests here too and not got any gain - I think they just implement what you'd do without them anyway..)
    the other option is JNI but this is very bad since I need to run any many platforms..
    profiling shows that most time is spent in the native code
    17.0% 0 + 287 java.io.WinNTFileSystem.list
    10.7% 0 + 181 java.io.WinNTFileSystem.getBooleanAttributes
    but I've heard that switching between java/native is very expensive? so there may be benefits from doing it all in one go somehow?
    any help would be really appreciated,
    thanks,
    asjf
    ps. caching the file list is not really an option since it needs to run fast on new targets

    heres some code that is much faster when I/O blocking is the main problem (seems to work much better on network drives..)
    it uses a slightly bizarre (?) thread pool of workers that process a list of Invocations.
    (this is one big file Pool.java)
    asjf
    ps. I don't normally write code like this :)
    import java.util.*;
    import java.lang.reflect.*;
    import java.io.*;
    public class Pool {
    List invocations;
    public void invoke(Invocation a){
    invocations.add(a);
    synchronized(invocations) {
    invocations.notify();
    //System.out.println("Added an invokation");
    ThreadGroup threads;
    Set pool;
    Pool(int noThreads){
    pool = new HashSet();
    threads = new ThreadGroup("Pool of "+noThreads);
    invocations = Collections.synchronizedList(new LinkedList());
    for(int i=0; i<noThreads; i++){
    Worker w = new Worker(i+" of "+noThreads);
    Thread t = new Thread(threads, w);
    pool.add(w);
    t.start();
    new Thread(new Runnable() {
    public void run(){
    try{
    while(poolActive) {
    int active = 0;
    for(Iterator i = pool.iterator(); i.hasNext(); ){
    Worker w = (Worker) i.next();
    if(w.working) active++;
    Thread.sleep(3000);
    System.out.println(invocations.size() + " : " + active);
    }catch(Exception e){
    e.printStackTrace();
    }).start();
    volatile boolean poolActive=true;
    public void join() {
    try {
    boolean alldone = false;
    while(!alldone) {
    alldone=true;
    for(Iterator i = pool.iterator(); i.hasNext(); ){
    Worker w = (Worker) i.next();
    if(w.working)
    alldone=false;
    if(invocations.size()>0)
    alldone=false;
    Thread.sleep(2000);
    }catch(Exception e){
    e.printStackTrace();
    //System.out.println("--------------------------> all done");
    poolActive=false;
    synchronized(invocations) {
    invocations.notifyAll();
    public void status() {
    threads.list();
    public static void main(String [] arg) throws Exception {
    long time=-System.currentTimeMillis();
    Pool pool = new Pool(200);
    Enumerater e = new Enumerater(pool);
    Invocation in = new Invocation(null,Enumerater.getXML, new Object [] {new File(arg[0]),e.result});
    pool.invoke(in);
    //pool.status();
    pool.join();
    time+=System.currentTimeMillis();
    System.out.println("Time taken "+time+"\nFound "+e.result.size());
    class Worker implements Runnable {
    String name;
    volatile boolean working;
    public Worker(String name) {
    this.name = name;
    public void run() {
    try {
    working=false;
    while(poolActive) {
    Invocation i = null;
    synchronized(invocations) {
    while(poolActive && invocations.size()==0){
    invocations.wait();
    //System.out.println("Hello from "+name);
    if(invocations.size()!=0) {
    working=true;
    i = (Invocation) invocations.remove(0);
    //System.out.println(name+" processed: "+i);
    if(i!=null)
    i.result=i.method.invoke(i.o,i.arg);
    working=false;
    }catch(Exception e){
    e.printStackTrace();
    class Invocation {
    Object o;
    Method method;
    Object [] arg;
    Object result;
    public String toString(){
    return o+" "+method+" "+arg;
    public Invocation(Object o, Method method, Object [] arg) {
    this.o=o;
    this.method=method;
    this.arg=arg;
    this.result=null;
    class Enumerater {
    Set result;
    static Pool pool;
    static Method getXML;
    static {
    try {
    getXML = Enumerater.class.getDeclaredMethod("getXML",new Class [] {File.class,Set.class});
    }catch(Exception e){
    e.printStackTrace();
    Enumerater(Pool p){
    pool = p;
    result = Collections.synchronizedSet(new HashSet());
    public static void getXML(File file, Set result) {
    File [] children = file.listFiles();
    if(children==null)
    System.out.println(file.getAbsolutePath()+" has null children");
    else
    for(int j=0; j<children.length; j++)
    if(children[j].isDirectory()) {
    Invocation in = new Invocation(null,getXML, new Object [] {children[j],result});
    pool.invoke(in);
    else
    if(children[j].getName().toUpperCase().endsWith(".XML"))
    result.add(children[j]);

  • JAVA, JAVA WEB dynpro and possibility of JAVA workflow

    Hi all
    Just a take here -- I'm just getting some feelers on the way WF SHOULD be going in future.
    Since starting to use the JAVA WD system and netweaver developer studio it seems that having to encapsulate a lot of NEW Workflows as ABAP objects is going "Backwards". (Note I said NEW not EXISTING applications)
    I understand that some compatability with existing systems needs to be maintained but if your user is doing all his applications from a Portal you really need the WF's to be triggered from the portal via say WEB SERVICES.
    I find I'm actually using the older ERP / ECC 6.0 R/3 systems these days purely as DATA repositories and from a JAVA program can often retrieve the data via standard BAPI's and RFC calls in a JAVA or Portal application.
    Isn't it about time that the workflow system as a whole was made much more JAVA and PORTAL friendly --since this is where more and more people are doing their developments from.
    Since switching more or less full time over to JAVA WEB DYNPRO developments the whole development time is completed MUCH QUICKER and with many many less mistakes.
    ABAP Web dynpro is also OK but it's still a little bit of a nightmare compared with JAVA when you need a lot of WEB SERVICES.
    Some WF's obviously will need to remain ABAP based but newer custom WF's IMO should be WEB DYNPRO and WEB SERVICE based.
    I can't think of too many large organisations who aren't making more and more use of Portals these days -- so C'mon SAP -- provide some proper Web hooks into WF's instead of us having to go through hoops and rings of writing LAST CENTURY's code to get stuff to work through a Portal.
    Cheers
    jimbo

    Hi,
    Have you checked the new BPM tool that SAP is offering? I think that it is definately a big step into to the drection that you are describing. I haven't really checked all its features and the technology that is is based on, so I am not the biggest expert of this matter.
    Check for example this article to get an overview: http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b06c49b2-ac63-2c10-3d8d-d17b817ba4ca?quicklink=nw-bpm&overridelayout=true
    Of course it will be a long road before this new tool will (if it will ever) replace the old ABAP based workflow engine.
    I wouldn't totally agree with all the points that you presented (ABAP WD being a nighmare, etc.). Actually I think that the direction (at least in some parts) is the opposite. For example SAP seem to have replaced their "old" travel management applications (Java WD) with new ABAP WD applications, so I see that they believe more in ABAP than Java (of course there might be some financial & other reasons behind this also.). In my opinion WDA has so many advantages compared to WDJ, that I would consider carefully the options when choosing the technology (the possible better(?) compatibilitly with web services might be one of the reasons).
    Regards,
    Karri

  • Is restoration possible from java export and offline db backup

    Hi,
    We patched our sandbox from sps9 to sps11, but unfortunately we did not
    success doing it in prodcution. We have production servers CI export
    and offline backup ( we do not have DB export ) of SPS9, Please suggest
    can we reproduce our production system in to sandbox using CI export
    and offlinebackup of SPS9.
    If it is, then please suggest the way through which we proceed and get
    it as early as possible.
    Thanking your for your eraliest help and response.
    Regards,
    Nizam

    edit:  ok, I was confused by what you said before.  I think you are asking "how to create a sandbox from backup of production".
    First, I'm not sure if SAP has a tool to simpily change the SID, server names, system number, etc.
    To do this, you'll have a lot of fun (sarcastic):
    1. Restore offline backup from production to sandbox.
    2. Make sure your database permission fro SAP<sandboxSID>DB is set right.  Manually copy the permissions from the production database server just to be sure.
    3. Change all objects in the database from SAP<productionSID>DB schema to SAP<sandboxSID>DB.
    4. If the user SAP<productionSID>DB exists in the database, you can drop it at this time.  All object schemas should've been converted to SAP<sandboxSID>DB
    5. Run the config tool, click no when asked to use default DB credentials.  In the DB login information page, change the server from production to sandbox.  Change the user from SAP<productionSID>DB to SAP<sandboxSID>DB.
    4. Close config tool and open again, try to connect.  This is the first step, you MUST be able to connect successfully.
    5.  You now need to go through ALL entries in Java Administrator and Config Tool, to ...
      - Change all references to the production application server name to the sandbox server name.
      - Change all references to the production database server name to sandbox server name.
      - Change all reference to SAP<prodcutionSID>DB schema to SAP<sandboxSID>DB schema.
      - If the system number is different, you must locate all port, system number, etc. and change them too.
    6.  Lastly, there are some .config and .properties file in the cluster folder in the kernel directories.  You must ...
      - Change all references to the production application server name to the sandbox server name.
      - Change all references to the production database server name to sandbox server name.
      - Change all reference to SAP<prodcutionSID>DB schema to SAP<sandboxSID>DB schema.
      - If the system number is different, you must locate all port, system number, etc. and change them too.
    Gripe to SAP:  What the H guys ... ABAP = 4 places where I have to change when I shuffle systems around.  JAVA = like 4 million places.  Why why why why why why!!!!! Bang head on table
    Edited by: Kevin Lin on Aug 26, 2008 10:33 AM

  • Captcha on BSP using java is possible? Java allowed in BSP?

    Hello to all,
    My client ask for a captcha on a BSP page of autoregister of SRM module. I have found the posts using PHP
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4e539c30-0501-0010-3291-a4c4193a6414|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4e539c30-0501-0010-3291-a4c4193a6414]
    [/people/eddy.declercq/blog/2005/09/13/die-mensch-maschine|/people/eddy.declercq/blog/2005/09/13/die-mensch-maschine]
    but now the client wants to be made with Java. Is possible to introduce a java call into BSP? i dont think so but you can confirm.
    Thanks for all,
    Nacho

    Hello to all,
    My client ask for a captcha on a BSP page of autoregister of SRM module. I have found the posts using PHP
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4e539c30-0501-0010-3291-a4c4193a6414|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4e539c30-0501-0010-3291-a4c4193a6414]
    [/people/eddy.declercq/blog/2005/09/13/die-mensch-maschine|/people/eddy.declercq/blog/2005/09/13/die-mensch-maschine]
    but now the client wants to be made with Java. Is possible to introduce a java call into BSP? i dont think so but you can confirm.
    Thanks for all,
    Nacho

  • Is it possible with Java web start to ?

    I have a question regarding jre 1.3 and jre 1.4 coexisting on the same client PC (Windows NT).
    Our traders environment currently has jre 1.3 installed. I want to deploy apps that use 1.4.
    In a perfect world I would like to download JRE 1.4 and the jars for my app into memory (from a server) and run my app without installing anything on the clients. This would be of benefit because there should be no risk of disturbing apps already on the client PC which currently use jre 1.3.
    Is this possible to do using Java webstart ?
    Am I barking up on the wrong tree, is there a better way to allow jre 1.3 and jre 1.4 apps coexist on the same PC ?
    info/discussion appreciated,
    Tom

    It is possible in some way. JWS is still in its early stage. You find lots of road blocks on the way. Making JWS to choose different JRE based on the application is not a easy task.
    If you install the JWS1.0.1_02, their lastest formal release, and then install JRE1.4.0. Basically, your JWS has no idea to find the JRE1.4.
    Ideally, JWS works perfect in the situation you described.

  • NT Authentication Impersonation possible in Java?

    New to these forums, but I'm sure I won't be a stranger here with my new job!
    My first question:
    I have been assigned the task of impersonating another user such that NT Authentication will work. I have said code in C++, but as I understand it, Java can not perform impersonation at an OS level, but merely at a Java level. Ideally, I am not to use C++ components.
    Initially I investigated using Subjects and the .doAs() function, but there are many sources telling me that NT authentication authenticates deeper than this level, and it would not succeed.
    Does anyone know how this could be performed? Even pointing me in the right direction would be helpful.
    Thanks,
    Matthew

    It turns out I am not allowed to use/look at the code... damn!
    I have more details on my task:
    My java application (not a web application, this is all client-side) must be able to take a user's username and password, and impersonate his credentials/etc to access data sources through JDBC, etc.
    This impersonation mechanism is proving to be difficult for me to figure out. I am not sure if it requires the use of a LoginContext / Subject, or if it is something else. I know in theory how this is supposed to work, but code-wise it is baffling me. Somehow I am to make these things (Samba should work too, as a test) believe that I am a different user, by means of an 'authentication token' or something of that nature.
    Any one have any experience with this?
    Thanks a lot to anyone who can guide me... It's a shame I can't get into open source projects. :(

  • 'Join' two different field types together into a String - possible in Java?

    Not entirely certain whether this is a straightforward Java or more of a JDBC question:
    I have two fields, one is a String and one an integer. I need to concatenate these fields together to form one String, prior to performing an insert on a table. ie:
    String s = dbRS.getString("partition_name");    //get full string
    String partstr = s.substring(0, 14);      // get first 14 (alpha) characters
    int new_partition_number = max_partition_number + 1;      //create new unique partition number, incremented by 1Now I have
    - a String (partstr - i.e. "TN1234567890_")
    - an integer (i.e. 50)
    (NB. The number has to be an integer because it is subject to calculation elsewhere.)
    I wish to join these together into a String ("TN1234567890_50") and use the field in an inserted row. I've tried using
    String partition_string = new StringBuffer(partstr).append(new_partition_number ).toString();... but this doesn't work.
    I read on a forum that it's impossible to cast an integer to a String in this way in Java, which sounds pretty incredulous from where I am! However my Osborne Java 2 Complete Reference doesn't mention it at all.
    Any assistance will be very gratefully received!
    Thanks.

    wonder why he thinks you can't append an int to a StringBuilder.
    Works fine. Might of course not yield the expected result depending on expectations, but it works just fine.
    But then, the coding conventions reminiscent of C don't bode well.

  • Is it possible in java to send a excel file (.xls) as a parameter ???????

    hey guyz iam new to java technology
    please tell me whether i ca send a EXCEL file(.xls) extention as a parameter to a method (later i have to create a backup file for that excel sheet) if any one know this method please give me suggestions !!!
    posting some code would be helpful
    thankyou
    bye n cheers
    harsha

    lol
    If all you want is to create a backup of some file you can do:public class Foo
        public static void main(String[] args) {
            Foo f = new Foo();
            f.createBackup("something.xls");
        public void createBackup(String inFile) {
            FileInputStream in = null;
            FileOutputStream out = null;
            try {
                in = new FileInputStream(inFile);
                out = new FileOutputStream(inFile + ".bak");
                int read;
                while ((read = in.read()) > -1) {
                    out.write(read);
                out.flush();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                if (out != null) {
                    try {
                        out.close();
                    } catch (IOException e) {
                        e.printStackTrace();
    }

  • Is it possible in Java to ...

    to open the program when the user clicks on a link to a certain file type. I'm trying to create a bit torrent program using Java and i need it so that if the user clicks on a link to a .torrent file on the internet, the file needs to download to a temporary folder and the program needs to launch and read the .torrent file that was just downloaded. Can anyone tell me how I can go about to accomplish this?

    the torrent type needs to be registered with the browser, so the browser knows what to invoke when the file is downloaded and opened. I have no idea how to do this, but I'm betting it has something to do with the windows register (on windows based machines, I really have no idea how to do it on Linux or Mac).

Maybe you are looking for