Different url-patterns for same servlet running in 2 different environments
Hi All,
I have a question about url mappings in my web.xml file and I hope somebody can help. The situation is that I�m putting together a web app using a combination of JSPs and servlets. I can�t develop on the machine that it will be hosted on, so I�m working and testing on my own machine and will transfer to the host machine when finished. However, the host machine is set up to map serlvets to http://�/servlet/MyServlet but the copy of tomcat I have installed locally maps to http://�/MySerlvet. My question is, when I get ready to transfer my application do I have to go through all my code and find serlvet references and insert the �servlet/� path info required by the hosting service, or can I just change the url patterns for the servlet mappings of the web.xml file on the host machine ? In other words:
Local install of Tomcat where servlets are accessed at http://�/MyServlet
<servlet-mapping>
<servlet-name> MyServlet </servlet-name>
<url-pattern>/MyServlet </url-pattern>
</servlet-mapping>
Host machine install of Tomcat where servlets are accessed at http://�/servlet/MyServlet
<servlet-mapping>
<servlet-name> MyServlet </servlet-name>
<url-pattern>/servlet/MyServlet </url-pattern>
</servlet-mapping>
I guess my thinking is that it would be better/easier to have a remote and local version of the web.xml file that reflects the environment each one resides in and have only one codebase rather than 2 codebases and 1 web.xml file. Am I thinking about this in the right way, or have I misunderstood something?
Thanks,
Peter
What you�re suggesting is logical, but won�t that
effect all the other stuff I�ve got running on my
local Tomcat install that expects servlets to be
accessed at http://.../ServletName ?
in web.xml, you decide of your mapping, so you could use the /servlet/ServletName pattern for your application that needs to be remote, and /ServletName for the rest of your stuff. You can even define more than one mapping for a servlet...
In fact, you should probably put your whole application that is going to be on a remote server in it's own context, and to be ahead of dufymo :-) , learn to put it a war file for deployment.
Similar Messages
-
Passing different values to the same servlet
Hi,
Is there a way to pass different values to the same servlet?
Background:
I have a database that I query to acquire a list of customers, then I show each customer as a link, that when clicked will show details of that customer. (The customer table is dynamic so I can't create a new page for each customer)
When using JSP what I do is
//Do query database
while (rst.next())
String cust = rst.getString ("cust");
out.write("<a href = \"cust2.jsp?cust=" + cust + " \" >" + cust + "</a> ");
}Then on the cust2.jsp. I will use
String str = request.getParameter ("cust");to acquire the customer to get details of.
Is there a way to do the same using servlets?
I could swap to JSP when creating this particular part of the project but it won't look good and it would help me learn a few things when there is another way.I want to know if there is a way to pass a variable from a webpage link like in my JSP example using servlets.
Here is what I wanted to do:
I have a webpage that contains customer names and each name has a link to the same servlet (let's say the link is famia/servb). I want servb to show detailed information about the customer my visitor clicked in the webpage.
The logic I was thinking is to pass a variable to this servlet, then I can use that variable to know which customer should I query in my database. So that I can show the details to my users.
Here lies my problem, I don't know how I can pass this variable, or even know which customer my visitor clicked. I can't use a new servlet for each client since the customer is in a database and if my customer base grows then I would need to create a lot more web page that does the same thing.
The JSP example I gave is how I will be coding it if I am using JSP, but now I am using servlets. So I was wodnering if there is a way to do this using servlet. Or should I stay with using JSP for this particular logic and just call servb after the JSP page acquired the variable.
I'm trying not to use "<original URL> + ? + <variable> = <value>" (eg: http://www.famia.net/customer?cust=famia) as the means for passing the variable. (or in the example as a means of passing variable cust with value famia) -
Can two urls map to same servlet in web.xml
Hello All,
I need to map the two urls in my web application with the same servlet.
I tried as follows:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee">
<description>Empty web.xml file for Web Application</description>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>fileredirectsolution.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/testservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/filerepository/*</url-pattern>
</servlet-mapping>
</web-app>
However, I am getting an error while accessing the TestServlet.
When I remove the second servlet-mapping tag..it is working fine.
How can I map the two urls with the same servlet.
Thanks
Saikrishnait is not ur requirement. but
i think it will help 2 u.
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4"; xmlns="http://java.sun.com/xml/ns/j2ee">
<description>Empty web.xml file for Web Application</description>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>fileredirectsolution.TestServlet<;/servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>*.xxx</url-pattern>
</servlet-mapping>
</web-app>
if ur configure web.xml like above.
any request that ends with .xxx call the TestServlet.
ex:
1)http://ip:port/contextpath/abc.xxx
2) http://ip:port/contextpath/xyz.xxx
here both urls calls the same servlet.
-lakshman.
save a life by sending information.
www.help2patients.wordpress.com. -
Different logon pages for same server.
hi Expert,
I have created two different logon pages with different URL's for the same server, now i can use both the pages to logon in to the system.
what i need to do now is :-
URL "A" users set ="A"
URL "B" users set ="B"
If we have the above two different URL and respective users for those URLs.
Now if i am User from the User set "A" and try to Login by using URL "B".
I am able to login, but i want to restrict.
ie.
users from set ="A" login only by the link URL "A"
users from set ="B" login only by the link URL "B"
Points would be given to helpful answers.
Regards,
Sanjyoti.Hi Sanjyoti,
I am not sure if this would work, but if time permits then do try this.
User A -- URL A
User B -- URL B
Now make User A a part of Group A, and set conditions in code that Group A can logon only through URL A and User B can logon through URL B.
Then in code check the association user - group and group - url and accordingly allow / disallow the user to go ahead.
This is just a thought.....do tell me if this works.....or if it doesnt then do post the solution you use....
Thanks,
GLM
P.S: PLEASE CLOSE THE THREAD IF THE ISSUE HAS BEEN RESOLVED
Edited by: GLM on Aug 27, 2008 2:08 PM -
Quality info records: different pack configurations for same raw material
how can i differentiate different pack configuration for same raw material in quality info records, as one might approved and the other not? that is, besides creating different material master for each packaging?
thanks
AlisaYou need to use the MPN profile functionality that is a standard part of SAP.
In Config under the purchasing define the MPN profile. There are several options you can turn on/off including info records.
You assign the MPN profile to your material. It now is considered by SAP to be an internal material number.
You then create a HERS material type for each separate manufacturer material number you have. You only need the purchasing view for these materials. You can also create purchasing text views, classification and some others if you wish.
In the SAP approved vendors list (AVL), you then assign each manufacturer vendor(s) with the HERS material created.
You create a Q-info record for each manufacturer/HERS material combination.
Now, when you specify the internal material number in a PO, the system will tell you to order the MPN material. When you do the drop down for the material now, it will show you the approved manufacturers allowed in the AVL for the ordering plant.
When the 01 inspection lot is created you will have a vendor number as well as a manufacturer's number in the inspection lot. The DMR can be done by the manufacturer or the vendor depending on how you set up the inspection plan. Q-info record will be used accordingly.
Take a look at it and research it. It's not hard to set up.
FF -
Can we have different output types for same document?
Hi,
Can we have different output types for same doucument.if yes plz describe the steps to perform it
ThanksHi,
Generally you can use same out put type for the different document types of PO. You can create different out put types for the same PO, in case you need different layouts that is different forms like MEDRUCK. Please refer below link to create out types . If you want that PO as fax or e-mail can use same out put type .Thanking you.
http://www.sap-img.com/materials/purchasing-tips.htm -
Obtaining url patterns for a user Role/Group
I am looking for a way to find out how to obtain a the list of accessible urls (url
patterns) for a role/group defined in weblogic.
I have gotton as far as if checking if a user is in a group using: javax.ejb.SessionContext
isCallerInRole(java.lang.String roleName)
After checking if a user is in a role/group I want to access the url pattern authorised
for a particular role under weblogic.
Can this be done.I am looking for a way to find out how to obtain a the list of accessible urls (url
patterns) for a role/group defined in weblogic.
I have gotton as far as if checking if a user is in a group using: javax.ejb.SessionContext
isCallerInRole(java.lang.String roleName)
After checking if a user is in a role/group I want to access the url pattern authorised
for a particular role under weblogic.
Can this be done. -
Why is the price difference of apple products in different countries? For example in UAE price is different as compared to Germany?
MacBook Pro with retina price in US is USD1299 and same product price in Germany is 1299 Euro. Why???Obviously all the answers up here are true.. but I think that was not the real meaning behind the question.
Every country has different currencies that not only convert differently to others but have a different and relative value for the inhabitants. For example although Forex says 1,3$ = 1€ for the average European and American 1$=1€.. that means that roughly inside your country what you buy inUS for 1$ you get in Europe for 1€ (ex: McDonalds hamburger).
Also each country has it's own taxes, different renting prices (for apple store), different VAT, etc...
But the real question is. Is Apple NEUTRAL to market conditions?
This means... does Apple adapt their margin on products to local conditions or not?
To make it simple... Let's say Apple ... everything considered... gets 100$ for an iPhone sold in US... Will Apple fix their price in other countries so that, after paying local taxes, local costs, etc... still.. for each iPhone they earn 100$ ??
Or they have different market strategies such as rising the prices in countries where people are richer and more likely to buy iPhones even if "overcharged"? Or on the other side.. do they lower prices in poor countries (obviously not under production cost) to help locals buy in Iphone?
I think that Apple is doing their best to stay neutral to the market.. that is... We want 100$ at the end of the day.. whatever...
So we have paradoxes because in some countries iPhone costs more while in these countries people earn less (and I think this is not random.. but happens because.. usually.. countries with more regulations and taxes are also countries with lower wages... but that's politics!)
Here is a small comparison of iPhone 6 (16 Gb version) prices:
USA 550€........................ Average GDP per person 51.704 $ (calculated with California sales tax)
Switzerland 629 €............ Average GDP per person 44.864$
United Kingdom 687€....... Average GDP per person 36.569 $
Gerany 699€.................... Average GDP per person 38.666 $
France 709€................... Average GDP per person 35.295 $
Italy 729€........................Average GDP per person 29.812 $
As you can see Apple seems not to care about living conditions in the country or about average wages etc.. they just have their price adjusted to local regulations and taxes. Europe has 2years warranty service for items sold in Apple Stores (and 1 for items sold in other stores where Apple is responsible only for the first year). We also have some other taxes... For example, here in Italy, we have a tax on hard drives (goes by the Gbyte) that affects any multimedia product. Tax is meant to finance artists whom you are supposedly "stealing" by having unauthorised copies on your portable device... (I know.. is ridiculous). Etc... -
Mapping an url-pattern to a servlet in a hosted environment
This may not be exactly the right place for this, but I thought someone may have had similar experiences and be able to suggest something...
My JSP/Servlet application runs fine in a Tomcat -standalone environment, however there are certain mappings (hrefs and what-not) that do not function when I upload it to the hosted environment I am using. For example, the index page contains a link to something like /xyz. /xyz is an url-pattern specified in my web.xml that is then mapped to a servlet. The hosted application gets an Apache 404 when following such a link, because (the hosting help desk tell me) by default the only requests that Apache forwards to Tomcat are /*.jsp, /*.xml and /servlet/*, as defined in their httpd.conf.
Are any of the following possible?
1. They introduce somes line into the Tomcat section of their httpd.conf forwarding requests like myHostedSite/xyz to my instance of Tomcat (and so not forwarding theirOtherHostedSites/xyz).
2. (My preferred shot-in-the-dark) They introduce a line into their httpd.conf that, for my site, then references another configuration file (on my part of the system), in which I could maintain a list of mappings that Apache should forward to Tomcat.
Otherwise, I guess, I am left to change all refences in my code and pages from /xyz to /servlet/xyz which is ugly and feels like a kludge.
Any hints, tips, help or advice (or even directions to a better place to post this) gratefully received.For Point 2, surely they are using a Virtual Host for your app on tomcat? this means they should be able to configure ALL requests to Tomcat based on your Virtual Host. Unless of course your using thier host name and utilising only the context path???
The httpd.conf should have something like:<VirtualHost your.domainName.com:80>
ServerAdmin [email protected]
DocumentRoot /path/to/your/app
ServerName your.domainName.org
ErrorLog /path/to/error/log
CustomLog /path/to/custom/log
JkMount /*.jsp worker1 //your worker.properties file
JkMount /*.html worker1 //your worker.properties file
</VirtualHost>With the DocumentRoot set it should default all your gifs, jpegs etc but route htmls, jsps and servlets through to your tomcat instance as configured with your worker.properties file.
I have to admit, Apache to Tomcat integration can be a nightmare and the Apache httpd.conf file is a monster but the above code should work provided you have yout own domain name.
Regards,
Anthony -
Different query plans for same query on same DB
Hi,
HP-Ux
Oracle Database 10.2.0.4
We are experiencing a strange issue. One of our night batch process is taking invariably more time to execute. The process does not consume time at 1 particular query. Everyday we find a new query taking more time than previous execution.
Now, when we see the explain plan while the query is executing, we see NESTED LOOP SEMI (with improper index being used). At the same time if we take the query and see the explain plan seperately, we get HASH JOIN SEMI (with proper index being used). Also, if we execute this query with the values as in procedure, it finishes within mili seconds (as it should).
The tables and indexes are analyzed everyday before the process starts.
Can anybody explain, why the same query shows two different plans at the same time ?
Thanks a lot in advance :)Aalap Sharma wrote:
HP-Ux
Oracle Database 10.2.0.4
We are experiencing a strange issue. One of our night batch process is taking invariably more time to execute. The process does not consume time at 1 particular query. Everyday we find a new query taking more time than previous execution.
Now, when we see the explain plan while the query is executing, we see NESTED LOOP SEMI (with improper index being used). At the same time if we take the query and see the explain plan seperately, we get HASH JOIN SEMI (with proper index being used). Also, if we execute this query with the values as in procedure, it finishes within mili seconds (as it should).
The tables and indexes are analyzed everyday before the process starts.
Can anybody explain, why the same query shows two different plans at the same time ?As already mentioned, you might hit typical issues in 10.2: The column workload based SIZE AUTO statistics gathering feature and/or bind variable peeking.
How do you analyze the tables and indexes before the process starts? Can you share the exact call with parameters?
Some ideas:
1. If your process is "new", then the column workload monitoring of the database might recognize the column usage pattern and generate histograms on some of your columns. It might take a while until the workload has been established so that all columns got histograms according to the workload (It needs a certain number of usages/executions before the workload is registered as relevant). Until then you might get different execution plans each time the statistics are refreshed due to new histograms being added.
2. If the default 10g statistics gathering job is active, it might gather different statistics during the night than your individual job that runs prior to the processing. This could be one possible explanation why you get different plans on the next day.
3. "Bind Variable Peeking" is possibly another issue you might run into. How do you test the query so that you get a different, well performing plan? Does your original statement use bind variables? Do you use literals to reproduce? Note that using EXPLAIN PLAN on statements involving bind variables can lie, since it doesn't perform bind variable peeking by default.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Servlet Accessibility on browser with servlet running on a different folder
Hello everybody,
I have all these executed on Tomcat Server 4.1 version.
I have a servlet, say HelloServlet. I put it under the examples directory and execute it from the browser there is no problem.
the path : http://localhost:8080/examples/servlet/HelloServlet.
However, if I copy the same servlet to a different folder and try to execute it, I get a HTTP 404 error.
Can I have an idea as to how the servlet that is available in a different folder be executed.
here the url is
http://localhost:8080/docprime/servlet/HelloServlet, wherein docprime refers to my folder where I have the servlet.
Is there anything I should do with the web.xml file or properties file to do anykind of mapping.....etc..
I have been struggling with this since yesterday, but not making any kind or progress..
Kindly help..
Thanks n regards,
Sajiv
Chennai, India.You would have add the vitual path in your server.xml. You could find this file under toplink config folder. Search for it in the toplink installation folder.
Add a <context> tag with proper inofrmation such as the path etc. Check out the document http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/context.html.
HTH. -
url-pattern for extension mapping in security-constraint not working
I'm trying to use extension mapping in a <security-constraint> configuration,
According to:
http://download.oracle.com/otn-pub/jcp/servlet-3_1-fr-eval-spec/servlet-3_1-final.pdf?AuthParam=1429824454_de04222eab1b8…
Section 12.2:
A string beginning with a ‘*.’ prefix is used as an extension mapping.
But WebLogic does not take in consideration my configuration. If I use path mapping exact mapping it work.
My configuration is:
<security-constraint>
<web-resource-collection>
<web-resource-name>Unsecured</web-resource-name>
<url-pattern>*.wsdl</url-pattern>
<url-pattern>*.xsd</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>HttpAuth</web-resource-name>
<url-pattern>/ws/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>ws-user</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>INTEGRAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Test1</realm-name>
</login-config>
<security-role>
<role-name>ws-user</role-name>
</security-role>
WebLogic Server 12c (12.1.3)
Has anybody used extension mapping with security-constraint? Is that a WebLogic issue?Hi nikita,
I have delt with the same problem before. As you say, most JSF actions all get posted back to the original page, and the faces servlet internally redirects according to the navigation rules and actions. This can mean the URL seen by the browser does not always correspond to the actual JSP (wrapped by JSF) that produced the content.
Generally adding the "<redirect/>" tag to all your navigation rules (in faces-config.xml) remedies this, so the actions are still posted back to the original page, but then the JSF servlet sends an http-redirect to the browser before invoking the new page. This way, the URL is always in sync, and the security constraints defined in your web descriptor always get invoked properly.
regards,
tony -
Different variable values for same query inserted 6 times in One workbook.
Hi,
We have one workbook with the same query inserted on 6 different tabs (sheets in excel), a variable on Business Unit that is different for each tab.
How can we control the variable input in BW2004s such that the different BU values are processed for each tab.
At present the BU value input in the "variable pop-up screen" over rides all the fixed variables on the different tabs.
Generous points will be awarded for useful solution.
Thanks,
JasmineHi,
I am trying to use filters for executing 2 queries in a Web App. I have 2 dataproviders (one for each query), and I am trying to use filters for say Version.
The URL is
/sap/bw/BEx?cmd=ldoc&TEMPLATE_ID=ZTW_XXX&DATA_PROVIDER_1= DP1&FILTER_IOBJNM_1=0VERSION&FILTER_VALUE_1=F01&DATA_PROVIDER_2= DP2&FILTER_IOBJNM_2=0VERSION&FILTER_VALUE_2=F02.
This doesnot work. Both queries get filtered on both 'F01' and 'F02'.
I am trying to filter DP1 by F01 and DP2 by F02.
Any help is appreciated.
Thanks,
NS -
Why two different URLS lead to same thread?
My action engine nugget here
http://forums.ni.com/ni/board/message?board.id=170&message.id=240328#M240328
showed up at the botom of the LV page as one ot the most Kudoed and when I hit that link it takes me to here
http://forums.ni.com/ni/board/message?message.uid=503801#U503801
THey both seem to be the same thread but different URLs. Why?
Just curious*,
Ben
* Don't expect me stop asking question now. It is way to late for that to help.
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction
Solved!
Go to Solution.Ben wrote:
http://forums.ni.com/ni/board/message?board.id=170&message.id=240328#M240328
http://forums.ni.com/ni/board/message?message.uid=503801#U503801
THey both seem to be the same thread but different URLs. Why?
I would think that the forum is just a huge database of posts with a front end that formats the pages dynamically.
Apparently, a post can be addressed either from a global ID (URL#2) or from a board/boardID (URL#1). Same difference.
LabVIEW Champion . Do more with less code and in less time . -
Two different tax calculation for same material/plant/vendor key combination
Hi all,
My requirement is that in PO client needs two different percentages of calculation of VAT for same plant/vendor/material.
How can this be incorporated?
regards,
vinsHi Vinda,
Can't you use Tax Code in Purchase order and enter as the case may be
If not, please ellaborate with example
Thanks
Nishu
Maybe you are looking for
-
Help with RFKPYL00_MASS program/payment run transaction
program RFKPYL00_MASS is for payment run transaction. transactional record is t_payh / i_payh with structure PAYH. In this program i see the statement GET PAYH. I need to know from which table the data is populated to this structure/t_payh especi
-
I've been emailed large photos that need to be resized into a smaller form no larger than 10MB. How do I do this?
-
My sidebar has changed.
On my desktop, I keep my finder open. I just noticed today that my home folder has disappeared from the sidebar. How did that happen, and how can I restore the finder and sidebar to its original configuration? I have backed up to Time Machine, but do
-
What is the second, third, etc. next-hop address in the route-map set command for? route-map TEST_PBR permit 10 match match ip address 101 router(config-route-map)#set ip next-hop 1.1.1.1 ? A.B.C.D IP address of next hop
-
I have Mac OS X Yosemite, and trying out the PH CC. When I click on small areas with magic eraser, nothing happens. I never had this issue before, with my PS CS 3. I could click on the smallest spot, and it would work fine. The tolerance setting