Whats the use of doget and dopost

hi
whats the use of doget and dopoast when same work can be done by sevice alone?
Message was edited by:
pooja_k_online

Try looking at the Tomcat implementation of HttpServlet.service() method. I have pasted it below, if you look at the service() method all it does is to check for the method and call the appropriate method. It is not recommended to override the service method. It is a good practice to only override the getXXX() methods.
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
String method = req.getMethod();
if(method.equals("GET"))
long lastModified = getLastModified(req);
if(lastModified == -1L)
doGet(req, resp);
} else
long ifModifiedSince = req.getDateHeader("If-Modified-Since");
if(ifModifiedSince < (lastModified / 1000L) * 1000L)
maybeSetLastModified(resp, lastModified);
doGet(req, resp);
} else
resp.setStatus(304);
} else
if(method.equals("HEAD"))
long lastModified = getLastModified(req);
maybeSetLastModified(resp, lastModified);
doHead(req, resp);
} else
if(method.equals("POST"))
doPost(req, resp);
else
if(method.equals("PUT"))
doPut(req, resp);
else
if(method.equals("DELETE"))
doDelete(req, resp);
else
if(method.equals("OPTIONS"))
doOptions(req, resp);
else
if(method.equals("TRACE"))
doTrace(req, resp);
} else
String errMsg = lStrings.getString("http.method_not_implemented");
Object errArgs[] = new Object[1];
errArgs[0] = method;
errMsg = MessageFormat.format(errMsg, errArgs);
resp.sendError(501, errMsg);
}

Similar Messages

  • The Differrence between doget and dopost

    doget and dopost are urally used in the same class, but the function which afford seem the same. Except that doget resposes get, dopost responses post, what are the other or real difference between them?
    Can E-Mail:[email protected]

    difrent is between send param option in HTTP protocol
    if you use GET method param send in URL You can see http://something?param=1&param2=1
    if you use POST method param send in body You can't see param in URL
    if you want use doGet for both method (GET,POST) you have to write
    public void doPost(...){
    doGet(...);
    public void doGet(...){
    your code
    Siplo

  • Whats the use of read_text  and save_text in sapscript

    in the sap script we have standard texts so10 by using this we can use large texts then wats the use of those function modules.
    how to change the standard sap script bu using subroutine.can any one give brief idea where to pass parameters in subroutine in program or else in form.

    hi sarath,
    read_text  and save_text
    check this thread..
    Re: Read_text and save_text
    how to change the standard sap script bu using subroutine.can any one give brief idea where to pass parameters in subroutine in program or else in form.
    : PERFORM MY_FORM IN PROGRAM ZPROGRAM
    /: USING &VAR1&
    /: USING &VAR2&
    /: USING &VAR3&
    /: USING &VARN&
    /: CHANGING &VAR_OUT1&
    /: CHANGING &VAR_OUTN&
    in program zprogram.
    FORM MY_FORM tables in_tab structure itcsy
    out_tab structure itcsy.
    data: varn like ....
    read table in_tab with key name = 'VARN'.
    if sy-subrc = 0.
    move in_tab-value to varn.
    endif.
    read table out_tab with key name = 'VAR_OUTN'.
    if sy-subrc = 0.
    move <value> to ot_tab-value.
    modify out_tab index sy-tabix.
    endif.
    ENDFORM.
    http://help.sap.com/saphelp_erp2005/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm
    Message was edited by: Priya

  • Difference Between doGet() and doPost

    Hi Everyone !!!
    I'm very new to servlets.I dont know what is the difference between doGet() and doPost() Method.
    Can anyone explain me .
    Can any give me details and differences between these two
    thanks in advance

    As you mention Why developer will use GET, if POST have all the advantages. Please look into, it may clear you doubts
    GET
    the GET type request is normally used for simple HTML page requests. The types of events that generate this type of request are clicking on a hyperlink, changing the address directly by typing in the address textbox on a browser or application that has HTML functionality, and submitting an HTML form where the method header is set to get as in method=get. Also, a GET request is triggered when selecting a favorite from the Favorites list and using JavaScript to change location.href. Usually the browser is configured to send a GET request even if no method is set explicitly by the HTML.
    The benefits of the GET method are
    1. It retrieves information such as a simple HTML page or the results of a database query.
    2. It supports query strings (name-value pairs appended to URL). Servers usually limit query strings to about      
         1024 characters.
    3. It allows bookmarks.
    POST
    This occurs when a browser or application submits an HTML form with the method attribute set to post as in method=post.
    The benefits of the POST method are
    1. It sends information to the server such as form fields, large text bodies, and key-value pairs.
    2. It hides form data because it isn't passed as a query string, but in the message body.
    3. It sends unlimited length data as part of its HTTP request body.
    4. It disallows bookmarks.
    Conclusion, always prefer to use GET, except mentioned in the following reason:
    1. If data is sensitive
    2. It is greater than 1024 characters
    3. If your application don't need bookmarks
    As because GET is more faster than POST.
    Both are used to send the request to the server, if you analyze than you may make the differnces like
    In the case of GET means send the request to get the simple HTML page from server whereas, in the case of POST means send the request to post the data to server.
    By Ausaf Ahmad
    Message was edited by:
    Genius_Brainware

  • How to Submit doGet and doPost request using javascript ?

    Hi,
    My requirement is:
    Need to submit form to two different methods doGet and doPost.
    doGet will authenticate the request by asking to enter username and password.
    After successful authentication we need to call doPost to submit the data of form.
    I tried using Get(url); and Post(url,data,type); methods of FormCalc but i am not able to retrive the attribute and its value using Post.
    my FormCalc script is
    Get("https://server:port/servlet"); //I am able to call doGet method successfully
    Post("https://server:port/servler","user=abcd&password=123456"); //I am able to call doPost method but I am not able to retrive the attribute user and password in doPost method.
    i tried request.getAttribute("user"); and also i tried request.getParameter("user");
    both are coming as null. How to submit form data to doPost method of servlet.
    Also I would like to know is there any javascript for the same.

    Why do you want to use javascript..? Why not action listener..? You can check whether its an empty string by checking
    if(str != null && !str.equals("")) {..}
    where str is the variable for inputText value.
    If this is not helpful, do provide more details on which version of JDev you are using and what are you trying (your usecase).
    regards,
    ~Krithika

  • Is it possible to use doGet() and doPost method in one jsp

    i am having a jsp form which will perform upload as well as download.There is a seperate servlet for download and upload.For downloading i use doGet method and doPost for the upload.how can i change the method dynamically for the above cases.

    Hi,
    in your jsp, if you call:
    request.getMethod();
    it should the string "GET" or "POST" depending on the HTTP method used, so you could do something like
    <%
    String httpMethod = request.getMethod();
    if ( "GET".equals(httpMethod) ) {
    // code to handle get requests
    else if ( "POST".equals(httpMethod) ) {
    // code to handle post requests
    %>
    I probably would of done it in a servlet(override doGet and doPost), or 2 seperate jsps
    Hope this helps
    Dominic

  • HOw to create a Batch file for java application and whats the use of this ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    First of all, you're OT.
    Second, you can find this everywhere in the net.
    If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
    javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
    Otherwise use:
    javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
    Don't specify the .class extension.
    Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
    The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
    This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
    Finally add dukes and give 'hem away.
    Bye.

  • What is the use of EIN_FEDERAL and EIN_STATE_LOCAL fields in Voucher header record (PeopleSoft AP) ?

    What is the use of EIN_FEDERAL and EIN_STATE_LOCAL fields in Voucher header record (PeopleSoft AP) ? And where can we check record field related information in PeopleBooks ?

    Hi User,
    The best place to search for questions like this one is OTN, Oracle Technology Network. If you have any question about CLOUD and partnering with Oracle we will be more than glad to help! Thanks.

  • What is the use of inherit and push in FR

    Hi Gurus
    1. what is the use of inherit and push option while providing report permission in Financial Reporting?
    regards
    Sarilla

    Yes, but you have no way of knowing whether what you find on Google is right or not.We can say its right as long google places oracle docs at the top when you type some thing related to oracle.
    I aways see something else on the top. I dont believe people stopped hitting or reading or searching oracle docs.
    Regards,
    G.

  • What is the use of command and alternate in flowlogic

    what is the use of command and alternate in flowlogic in SMARTFORMS?

    Yes, but you have no way of knowing whether what you find on Google is right or not.We can say its right as long google places oracle docs at the top when you type some thing related to oracle.
    I aways see something else on the top. I dont believe people stopped hitting or reading or searching oracle docs.
    Regards,
    G.

  • WHATS THE USE OF TABLE STRIP CONTROL AND TABLE VIEW CONTROL

    WHATS THE USE OF TABLE STRIP CONTROL AND TABLE VIEW CONTROL

    Subhash,
    You create and distribute a model in BD64. The details of that are stored in this tables.
    A model gives you the details of the sender / receiving systems and what are the message types that are getting transferred between these systems.
    Regarding the IDOC segments issue, can you explaing how are you triggering the IDOC and which message / idoc type you are dealing with.
    Regards,
    Ravi
    Note :Please mark the helpful answers
    Message was edited by: Ravikumar Allampallam

  • What is the use of with and without marker update?

    what is the use of with and without marker update?

    Hi,
    Marker Update Updates the stock values and NO Marker does not.
    Generally BX upload has to be compressed with MU and BF(and UM) delta init has to be compressed with NO MU because Stock was updated with BX. And delta loads of BF and UM has to be compressed with MU  because these brings new Material movements which will has to give effect to stock.
    With rgds,
    Anil Kumar Sharma .P

  • Jave servlets- doget() and dopost() methods.

    Iam trying to learn servlets but got confused on these doget() and dopost() methods usage. I just want to know generally what does these methods do in general (like the doget() sets the header..but what about dopost()?). I saw some example code where doget() is called within a dopost()method so Iam not clear about their purposes.
    I'd appreciate any help possible. Thank you.

    The doPost() and doGet() (also doHead() etc.) methods are all designed to handle specific HTTP request types. eg: doGet() handles HTTP GET requests (requests caused by common HTML links or typing a URL in your browser's address bar) while POST handles HTTP POST requests (commonly generated by HTML form submissions).
    When you see an example of a serlvet's doGet() being called within it's doPost(), it is because, at least for part of the processing, the servlet will be treating the two request types the same way.

  • Whats the difference between list and lov ?

    Whats the difference between list and lov ?
    i can do the same things with a list what an lov can do .
    infact a list is more better. cause the list doesnt hold/show a range of values, and only has the items value iteself.
    while the lov can get all the values of items depending on the query.
    like
    select ename, job, sal from emp
    will show all the three items values in lov?

    Also, if you're looking in the US store, the prices are:
    - Airport Express (small, no ac) $99 - Has audio out for speaker connection using Airplay. Can share a USB printer only.
    - Airport Extreme (larger, ac) $199 - No audio out, can share a USB printer or hard drive.
    - Time Capsules (2TB, 3TB at $299, $399) - have ac wireless and a backup hard drive for Time Machine which the other Airports do not have.
    Matt

  • I have a issue with my mac book pro. For some reason it won't stay powered on. I can't get past the apple loading logo. The battery is fully charged so it is not the problem. Can anyone tell me what the problem may be and how can i get it resolved?

    I have a issue with my mac book pro. For some reason it won't stay powered on. I can't get past the apple loading logo. The battery is fully charged so it is not the problem. Can anyone tell me what the problem may be and how can i get it resolved?

    The battery is fully charged so it is not the problem.
    What happens when you use the MagSafe?

Maybe you are looking for

  • Q10 buggy stuff with text entry making me sad

    I impulsively replaced my 9700 with a Q10 instead of the S4 i wanted, and now i regret it.  I am hoping these are just user errors as I want to love the Q10 and it's lovely keyboard. Two major issues: 1. Autofill -- how the heck do you turn off text

  • Cant fix - "select a certificate or enter a name and password for network"

    iMac 27 - inch, Mid 2010 Software OS X 10.8.2 (12C60) I cant seem to fix this message when going online, nore have I managed to find any help with it. everytime my imac27 2010 sleeps it goes offline then this message appears... "select a certificate

  • Disk Fix via FW to another Mac

    I haven't been able to boot my PB since trying to upgrade from Panther to Leopard. I access the PB hard drive as a FW drive on a Mac Pro, and I've run disk utility on the drive numerous times. It says the drive is OK, but I still can't boot. Here's m

  • How to enlarge Pen Tool?

    When using the pen tool to make a path I can't always tell when the little circle or caret or minus sign is activated so I can close the path, expecially when it's over a color that is similar. I work from 1280 resolution and that may be part of it.

  • Vertical Partitioning in Oracle

    Hi, Can any body please give me idea how can a table be partitioned vertically in oracle. Is vertical partitioning possible in oracle? If it is possible then, please give an example of it. Regards, Koushik