Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

find  REST like pattern with parameters to determin WS Operation

Posted on 2007-11-13
2
Medium Priority
?
214 Views
Last Modified: 2012-08-13
Using Java (preferred solution)

built some SOAP services but providing a REST interface (just servlets) and need a way to use regex to parse out the urls.  the basic pattern is

get all things:
http://blahblah/things
get all things with some criteria
http://blahblah/things?id=value1&type=value2

getcertain things by name
http://blahblah/things/name

the regex pattern i was using seems to always give me the things/name and i really want an easy way to say
things
things?...
things/

but not things/something
which may or may not have parameters

I am looking to validate parameters once i know which operation i want to deal with.  the idea of the above url pattern was that some parameters are required or not allowed for some of the patterns so i don't want the regex to care about the parameter but can't use $ (end of line) b/c parameters might be presenent

i kept trying "things[/]?" and other permutations
0
Comment
Question by:jonasmit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 1000 total points
ID: 20275776
jonasmit,

Maybe I am oversimplifying this or misunderstanding something but what about ...

things$|things\?|things/

To use it in Java you will probably need to add some slashes.  Let me know if you have a question using it.  That expression will give you what you want if I understood you correctly.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 20275948
Great!  I'm glad it did what you needed and I could help.  Thanks for the fun question, the grade and the points.

bol
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question