Brian M Smith

Ranch Hand
+ Follow
since Aug 13, 2009
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 Brian M Smith

Again guys. Not to sound like an ass here, but this isn't a class that I created. This is a project that is working in production, but when I pull it down to a local environment it won't deploy. The class that is causing the exception is a class that is automatically generated via the wsgen command. This isn't a class that I created. Again, this is a project that will actually deploy but won't work locally for me. I'm very certain that this is a JRE or configuration issue.

Again, thanks for the responses but has anyone encountered issues where wsgen is creating "incorrect" classes?
10 years ago
Ivan,

Thanks for the response. I did not have Metro installed, but I don't think that is the problem. I installed Metro, but I'm still getting the same error. I think this has to do with JAXB or some component that is out of sync with the other servers. Does anyone know if JAXB or JAXWS components significantly differ from JRE6 to JRE7, or has anyone found issues where automatically generated classes via wsgen would not generate correctly?

-Brian
10 years ago
So I'm attempting to deploy a web service project into a tomcat server and getting the following error.



Now as I understand it, the problem is in com.gcc.openconnect.jaxws.ExceptionBean. As I can tell this class is generated from a wsgen command when I build my application, so I can't really go in and edit it. From what I can tell ExceptionBean is being generated because some of my endpoints are throwing java.lang.Exception. This code base works on various other tomcat instances but will not work on mine.

So I'm curious what the issue could be. I don't think it's a coding problem since this code base works elsewhere. I'm wondering if this sort of problem could happen because of differences between the JRE, wsgen command, or some other environmental difference.

Sorry if this isn't very detailed, but I'm not sure what information would be relevant to answer my question.
10 years ago
I'm attempting to drive all traffic from a particular URL into one action for processing.

Here is a snippet of code where I'm attempting to grab anything that is /go/* and pass it to an action AAA


The problem that I'm having is that struts is returning a 404 error, furthermore when debugging the AAA action it appears that the code in that action never gets executed. Any ideas?
10 years ago
I'm faced with a problem that I'm not sure how to get around. I'm hoping that I can accomplish this with struts and not have to write any additional Java code.

Problem: I need to render different messages in a JSP from properties files based on struts module.

Example: http://localhost:8080/mod1/test.do and http://localhost:8080/mod2/test.do load the same JSP after performing some actions.

The JSP has a properties key in it catalog.tab.product

There are 2 struts config files defined in web.xml mod1_config.xml and mod2_config.xml which are mapped to the mod1 and mod2 struts modules.

mod1_config.xml contains a message-resource entry mapping to resources_mod1.properties.
mod2_config.xml contains a message-resource entry mapping to resources.properties.

resources_mod1.properties contains an entry catalog.tab.product=Product mod1
resources.properties contains an entry catalog.tab.product=Product default.

Now what I would expect to happen is when I visit http://localhost:8080/mod1/test.do I should see the text "Product mod1" and when I visit http://localhost:8080/mod2/test.do I should see "Product default". The problem is that no matter which URL/struts module I use I always end up seeing "Product default".

Is this behavior something that struts should support without customization?

Thanks in advance!

-Brian

11 years ago
Hello there. I'm attempting to open up a http connection to a legacy web server. My particular problem is that when I open this request, I need to pass in a couple of cookies to the web server to duplicate a very particular request.

Here is the code I have written



The problem that I'm getting is that an IllegalStateException is being thrown due to the connection already being open. I have attempt to call the disconnect method on the connection variable but I'm getting the same results. If anyone could give me any advice on how to set cookies to the request, I would really appreciate it.
11 years ago

Ireneusz Kordal wrote:I am not absolutely sure if I correctly get your requirements, but this is probably what you want.

href=[\"|\']((?![^?|\"|\']+?\.do).+?)[?|\"|\']

Please let me know if this fits your needs.

Regards.


Edit:
And a little explanation:
(?!regexp) - is a construct known as 'negative lookahead'.
Here you fine nice explanation how regexp lokaheads work: http://www.regular-expressions.info/lookaround.html

\
Ireneusz,

Thank you for the response. This didn't seem to do what I needed it to do. Sorry if I wasn't clear in explaining what I'm trying to accomplish with regex. I'll take a look at that link you provided to see if I can make any headway.
11 years ago

Rob Prime wrote:Because ! is not a valid regex operator in Java except in negative lookaheads / negative lookbehinds. In your example you are looking for the literal !



Rob thanks for the response. I took a look at negative lookaheads, but I'm still struggling with the syntax and how regex is put together. Here is my new statement.

href=[\"|\'](.+?)(?!\.do)[?|\"|\']

I think that I can probably figure this out if someone could validate what I think is going on. In trying to break this down into sections, I read this statement as so.

href=[\"|\'] - Look for href= followed by a " or ' character
(.+?) - Match at least one or more instance of any character.
(?!\.do) - Read ahead, but do not match strings that contain the characters .do
[?|\"|\'] - Match the ?, ", or ' character

I guess I don't understand how the read ahead special characters work.
11 years ago
I'm rather close to a solution, but I'm struggling with some RegEx.

I'm attempting to read a text file and parse the contents of that file. The file contains HTML. The objective is that I want to find all href attributes on an anchor tag and do processing(find/replace) on those values. I wrote up some quick RegEx to accomplish that.

href=[\"|\'](.+?)[?|\"|\']

The problem that I'm faced with is that I need to make sure that I exclude href attributes that contain the string ".do" in them. I have experimenting with the following regex pattern and it will find all href attributes that contain ".do", but when I attempt to use the not operator I do not get any returns.

href=[\"|\'](.+?)\.do[?|\"|\']

Here is the text that I'm testing with

<a href="blahdo">This is the en-us version of this spot<br /><br />aaa This would represent a content spot pull from a file.<br /><br /> <a href="/about">About US</a><br /> <a href="/about.do?id=1a">blah</a><br /><br ><a href="something?id=1111">asdfasdf</a> <b>Testing</b> <table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td colspan="2"> . . 3 </td> </tr> </table> <br /><br /> <a href="custom-cable"></a>


I have been using this testing tool which will allow you guys to see the groups that the regex returns http://www.regexplanet.com/simple/index.html

I'm interested to know why the pattern href=[\"|\'](.+?)!(\.do)[?|\"|\'] will not return the results I'm expected where href=[\"|\'](.+?)\.do[?|\"|\'] does.

Looking to be taught how to fish here, so please don't just give me an answer without an explanation!

11 years ago
Frits,

Thank you for the reply. That is what I thought was going on. I will just come up with another solution.

-Brian
12 years ago
I'm not sure if I'm going to be able to do this, but figured I would ask.

I need to create a servlet to handle multiple URL patterns. My servlet needs to be able to handle a pattern that looks like this /*/leftNav/*

I'm not a I little confused by what the servlet 2.4 spec means by "A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping." Does this mean multiple wildcard characters may not be used when defining a url-pattern? When I attempt to load the url http://localhost:8080/test/leftNav/somethinghere.js, I'm getting a blank page returned to me. This shouldn't be happen as the servlet will output a test string on the page.

Any ideas?
12 years ago
I have corrected this problem. I was some bad logic elsewhere in the code. Thanks for verifying that this code was working correctly guys!
12 years ago
Objective: I'm using JavaMail to send emails to customer. I'm using File IO to read in text files, and potentially html files, from disk.

This is an example of what content is stored in the file.



A few things about this file. After reading the contents out, I'm replacing the <firstname> and <lastname> "tags" with the customers first and last name. The problem is that when I read each line from the file those "tags" are not being read. Here is the code I have for reading the files.



You guys can rest assure that the file and file path are correct as I have debug code not shown that will show that I'm able to read certain parts out of the file.

Any ideas?
12 years ago
I'm trying to write a filter that will look to see if a javascript/css file has been requested. If one has, I want to minify that file and then sent it to the user. The problem is that if I get a 500 or 404 status it's attempting to minify the page being returned. The idea is that I want to check the status to make sure that 500 and 404 conditions don't exist.

Basically I'm trying to do on the fly file minification.

12 years ago
Bill,

Thanks for the reply. What I'm looking for is something that is standard for Java, I can't use anything provided by apache other than struts.

Any ideas?
12 years ago