Solved

find  REST like pattern with parameters to determin WS Operation

Posted on 2007-11-13
2
207 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
  • 2
2 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 250 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now