Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!

sridhar vedhanabatla

Greenhorn
+ Follow
since Feb 21, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sridhar vedhanabatla

Hi,


I am trying to use a simple xsl string replace function. I am trying to test my code by opening the xml in Mozilla/IE browser.

XML code:

<?xml version="2.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="replace.xsl"?>
<response>
<claim claimNumber="063544577" claimDescription="Costco Claims">
</claim>
</response>



XSL code:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>

<xsl:template match="response">
<xsl:apply-templates select="claim"/>
</xsl:template>

<xsl:template match="claim">
<xsl:value-of select="replace(@claimDescription,"Costco","Walmart")"/>
</xsl:template>

</xsl:stylesheet>




Both browsers are showing same following error

XML Parsing Error: not well-formed
Location: file:///C:/replace.xsl
Line Number 9, Column 51:


Let me know if there is anything that Im missing.


Thanks,
Thanks SF for your reply.


I understand that classpath spec needs to have file-path and not file. It was my mistake to write it that way in forum post.


Actually the second file too is "resources.properties". I mistakenly gave the different name. Infact I want to use a new value from new file instead of old value from config file in the agent.jar file. Thats the reason the filenames in the C:\agent\config folder and C:\agent2\config is same.


Sorry for the confusion.

Thanks,
9 years ago
Using regular expressions might help you in long term.

But for quick getting quick results without spending too much resources in writing good regexes you can alternatively try Apache string util api at http://commons.apache.org/lang/apidocs/org/apache/commons/lang/StringUtils.html for several string processing functions.

9 years ago
Hi,


I have a classpath issue. My app folder is C:/agent I have src packages that start with com.abc and also few config files under my app folder. I have archived them as agent.jar so that compiled classes in com.abc package and files under config folder are archived into agent.jar.

Therefore the folder structure is something like following:-

C:\agent
|
| -> src -> com -> abc -> A.java
|
| -> config -> resources.properties


my jvm parameters are like

java -Xms800m -Xmx800m -XX:MaxPermSize=256m -XX:+UseParNewGC -classpath C:\agent2\config\res2.properties agent.jar



I want the jvm to pick res2.properties from C:\agent2\config folder instead of the one present in agent.jar file.

Currently jvm is still picking and using resources.properties from C:\agent\config\ only and not from C:\agent2\config folder.

I guess jvm should pick the first file that comes in the classpath and that should override the subsequent files of same name.




Is there anything wrong in above setup? If yes, then where and why?


Advance thanks,
9 years ago
Hi,

I am trying to access a file from the file-system under valid path, but tomcat is giving message "HTTP STATUS 404".

The file was being acessed properly previously but suddenly something went wrong. When i checked log file it says

GET "filename" 404 1141 "url"

I tried finding what is error code 1141 but failed to get valid explanation.

Please tell me what is this 404 1141 status code. Im using jakarta-tomcat 5.0 under red hat linux 7 and also using mod_jk to connect apache to tomcat.

Thanks in advance.
9 years ago
Hi,

I am using apache digester to parse the following string

<auto>
<account name="a001">
<division name="A1" lastDate="08/03/2008"/>
<division name="A2" lastDate="07/29/2008"/>
<division name="A3" lastDate="06/26/2008"/>
<division name="A4" lastDate="12/06/2008"/>
<division name="A5" lastDate="11/26/2008"/>
<division name="A6" lastDate="09/16/2008"/>
<division name="A7" lastDate="11/06/2008"/>
</account>
<account name="b0045">
<division name="Macy's A1 Store" lastDate="08/03/2008"/>
<division name="B1" lastDate="07/29/2008"/>
<division name="C3 Store" lastDate="06/26/2008"/>
<division name="D4 Store" lastDate="12/06/2008"/>
<division name="E5 Store" lastDate="11/26/2008"/>
<division name="F6 Store" lastDate="09/16/2008"/>
<division name="G7 Store" lastDate="11/06/2008"/>
</account>
</auto>


but then i am encountering the following error

java.net.MalformedURLException: no protocol:



I have prefixed the xmlstring with header

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

still it didnt work. I guess there is some metadata I might need to specify, maybe protocol or version or charset. not sure.


I wish somebody help me..


Thanks in advance.
9 years ago
I need to restrict access to urls having .pdf and .doc file at end. I need to block access to folders. Actually the folder nesting is like A/B/C. Folder C is having .doc and .pdf files. Right now tomcat is allowing access to url http://localhost:8080/A/B and it is showing all files in B folder. url http://localhost:8080/A/B/C is showing all files in folder C. I need to allow url of type http://localhost:8080/A/B/C/*.pdf or http://localhost:8080/A/B/C/*.doc

Thanks in advance.
9 years ago
hi,

I am using apache HttpClient. When the url has - char and get navigation is made, then the HttpClient is throwing IOException


java.io.IOException: chunked stream ended unexpectedly
at org.apache.commons.httpclient.ChunkedInputStream.getChunkSizeFromInputStream(ChunkedInputStream.java:251)
at org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStream.java:220)
at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:175)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:126)
at org.apache.commons.httpclient.HttpMethodBase.getResponseBody(HttpMethodBase.java:685)
at com.web.MyBrowser.get(MyBrowser.java:95)



Please let me know if I have to change nay encoding or settings.


Thanks,
10 years ago
hi,

I am using apache HttpClient. When the url has - char and get navigation is made, then the HttpClient is throwing IOException


java.io.IOException: chunked stream ended unexpectedly
at org.apache.commons.httpclient.ChunkedInputStream.getChunkSizeFromInputStream(ChunkedInputStream.java:251)
at org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStream.java:220)
at org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:175)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:107)
at java.io.FilterInputStream.read(Unknown Source)
at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:126)
at org.apache.commons.httpclient.HttpMethodBase.getResponseBody(HttpMethodBase.java:685)
at com.web.MyBrowser.get(MyBrowser.java:95)



Please let me know if I have to change nay encoding or settings.


Thanks,
10 years ago
hi,

I have a string "Tracking Number|Carrier" in which im looking for regex "|".

On windows platform with java 1.5.0_11 im able to successfully match using regex-string as "\\|".

But the same regexstirng on same datastring is not working on Linux with java 1.5.0_08

Let me know if this really due to java version and platform mismatch or internally there is some other issue.
10 years ago
U hav specified vague info. Infact the way query can be written lot depends on the nature of the data, how database has been designed etc.

Normally data that is spread across many tables can n retrieved using joins. You may have to use joins and some stored procedures to filter data.

In either case you will have to decide based on the what data out of large set do you want?

So the next time you post give specific details of the nature of data and the datbase design so that one can help you specific to issue.
Im using a java program that basically gets data using UrlConection. One website requires a certificate to logon to it. Ive got the PFX certificate and installed in my IE browser.

Ive read somewhere that for java uses cacerts file to store certificate so that java programs can be sued to login into such websites which certificates for browsing. Ive exported the certificate from IE in DER export X.509 format and imported that certificate int cacerts successfully.

When the java program is run, it says "The page requires a client certificate".

As the certificate import into cacerts was successfull, is there any other place where Ive to confgure?

Can anybody tell me how to make java trust certificates of .PFX format?

thanks in advance.
11 years ago