Servlets :: Accessing Parameters Where They Are Encrypted
Jan 24, 2015
I need to implement a URL which looks something like below one. The Notable thing is that its only one parameter i need to access and the value that's supposed to be held by the parameter is encrypted which may contains characters like & and =.
Example 1.
www.abc.com/disp?v=qww78agd=
The parameter v in above url contains value qww78agd=.
Supposing the encryption turns out the following way.
Example 2.
www.abc.com/disp?v=qww7&f=iuy68=
www.abc.com/disp?v=qww7&f==iuy68=
Then servlet will take v and f as two separate parameters, whereas i want to obatain qww7&f==iuy68= from parameter.I thought of taking up all key value pairs from request HashMap and concatenating the joints via & and =. But the problem is that two consecutive = signs as in second case of example 2, its treated as only one equal to in request key,value map. Hence, my other = sign(s) are lost.Is there any way such that i can get query string part as it is on my servlet and parse it using string processing on my own?
View Replies
ADVERTISEMENT
May 12, 2014
I am trying a simple program to access ServletConfig initialization parameter in a jsp. But I am not clear how its working. This is web.xml
<web-app>
<servlet>
<servlet-name>Myservlet</servlet-name>
<jsp-file>/JjspInit.jsp</jsp-file>
<init-param>
<param-name>para</param-name>
<param-value>valu</param-value>
[Code] ....
Now If I hit /Allen it sets init parameter for both servlet MyServlet and jsp JjspInit. I don`t have any servlet all I have is a web.xml and a jsp page. But accessing JjspInit.jsp directly gives null.
How hiting the url /Allen prints valu. This code is on JjspInit.jsp .
So does that mean that in web.xml I have registered this jsp as the target for /Allen. And one more question directly accessing the jsp page shows null it means init parameter haven`t been set.
View Replies
View Related
Jul 30, 2006
What is the difference between Attributes and Parameters.that is difference between two methods request.getAttribute() and request.getParameter() and why we have this two methods?
View Replies
View Related
Jan 29, 2015
We are starting to deploy virtual desktops in our factory.I have a file upload form that works on conventional desktops but fails on the virtual machines. Notice the lifecycle parameter is not being passed to servlet on these virtual machines but does get passed when ran from standard desktop machine.
This is my form code
<form action="/QMSWebApp/AttachmentListController?lifecycle=attachafileuploadfile" enctype="multipart/form-data">
<div class="hide">
<input type="text" name="docindexno" size="20" value="${attachmentObj.fileindex1}">
<input type="text" name="doctype" size="20" value="${attachmentObj.filetype}">
<input type="text" id="fileuploadformsource" name="fileuploadformsource" size="20" value="${attachmentObj.fileUploadFormSource}">
</div>
<input type="file" id="fileName" name="fileName" size="40" onchange="testFileName()">
<input type="submit" value="Upload File">
</form>
<div id="uploadresult"></div>
this is the servlet error:
AttachmentListController: userName: STEVE DYKE File Attachment Source: SI
AttachmentListController: userName: STEVE DYKE e: java.lang.NullPointerException
AttachmentListController: Parameter List: doctype
AttachmentListController: Parameter List: docindexno
AttachmentListController: Parameter List: fileName
AttachmentListController: Parameter List: fileuploadformsource
AttachmentListController: Parameter Name: doctype
[code]....
View Replies
View Related
Feb 10, 2014
I developed some servlet to get unicode parameters via post request. It worked perfectly fine since I set the encoding as below:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
request.setCharacterEncoding("UTF-8");
String fileContent = request.getParameter("fileContent");
}
Now that I have set up my dev environment on a new machine with new eclipse, it does not work.
It displays Ï instead of π.
I've already tried adding URIEncoding="UTF-8" to server.xml which did not work since it only affect get not post. I figured out how to get the parameter with correct encoding on the new system:
String[] parameters = URLDecoder.decode(request.getQueryString(), "UTF-8").split("&");
But I cannot believe that this is the solution because then what's the point of having request.getParameter. I already know that:
String sss = new String(fileContent.getBytes(),"UTF-8");
would not work.
View Replies
View Related
Aug 30, 2010
In our web application we are using servlets,jsp and spring technologies.Here we are also maintaining session mechanism in our application.But now i need to count number of users accessing our web application at a time. How can i implement this mechanism...
View Replies
View Related
Sep 12, 2014
I have a webform on JSP page which has several parameters(strings and integers) values and a file to be uploaded to the server through a servlet. It is strange to see that i'm able to upload the file on to the server but not able to get the rest of the parameters in the servlet using request.getParameter("someString") .
<form method="POST" enctype="multipart/form-data" action="/cassino/uploadFile" >
<fieldset>
<div class="form-group">
<label >*ID riparazione</label>
<input type="text" name="idRiparazione" />
[Code] ....
View Replies
View Related
Jun 22, 2015
I'm trying to play an encrypted HLS video using MediaView and MediaPlayer is throwing a "can't create player" exception. Searching for a solution all I found was this post from january last year, saying it is not supported and to add a feature request. I looked in the JDK bug system for HLS/live streaming and didn't saw anything related. Is this still not working on the latest JavaFX?
View Replies
View Related
Oct 23, 2014
I am trying to make an encrypted video chat program using JMF. I have successfully written the "video chat" part - which includes getting data from webcam and transmitting it using RTP, but how to get raw data video to encrypt it before it stream between the webcam and the network.
For RTP I am using RTPManager, and for reading from the webcam I am using this code:
DataSource ds;
CaptureDeviceInfo di = null;
StateHelper sh = null;System.out.println("Started Video");
String str1 = "vfw:Logitech USB Video Camera:0";
String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
String str3 = "vfw:Microsoft WDM Image Capture (Win32):0 : vfw://0";
[Code] .....
I plan on using a stream cipher for encryption, maybe RC4.
View Replies
View Related
May 8, 2015
I have an program with an encryption and a decryption method, it works fine when i specify a name for the encrypted file, but i want the name for the encrypted file to be in cipher text, how do i do this and specify the path? i have marked out the "encryptionPath" specifically for specifying the location of the encrypted file which will have a cipher text name.
Here is my code so far
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
[Code] ......
View Replies
View Related
Aug 4, 2014
I have an encrypted MSCONS.txt file as Outlook item. I also have a Digital Certificate file (Certificate.pfx) with a password.
How I can read the actual MSCONS.txt file in my java application? Any sample code snippet ...
View Replies
View Related
Nov 4, 2014
I've written most of the code (along with another classmate) to get this to work, but I can't seem to return the encrypted value. I'm also trying to figure out how to separate the digits (or if I'm supposed to) to make the numbers encrypted. The main kicker is that we have to be using methods to return the final values. Everything compiles, (It compiles, but no results really.)
A company wants to transmit data over the telephone, but they are concerned that their phones may be tapped. All of their data is transmitted as four-digit integers. They have asked you to write a program that will encrypt their data so that it may be transmitted more securely. Your program should read a four-digit integer number and encrypt it as follows: Replace each digit by the remainder after (the sum of that digit plus 7) is divided by 10. Then, swap the first digit with the third, and swap the second digit with the fourth. Then print the encrypted integer. Do the encryption in a method and send the encrypted number back to main.
Here are the method headers: public static int encrypt(int num) // Takes num as a parameter and returns the encrypted value public static int getnum() // gets one number from the user Example: If the user enters 1234 they should see: 0189
import java.util.Scanner; //Needed for Scanner class
public class LNFI_LNFI_program2
{
public static void main(String[] args)
{
getnum(); //Calls for getnum() method
[Code] ....
View Replies
View Related
Aug 25, 2014
i would like from my bean to redirect after an operation is completed to the page faces/test.xhtml?id=2? Is there a way to do this?
View Replies
View Related
Dec 7, 2014
I have GameConsole class with gamePlay(). There are two objects in this class that I want to access from a class in another package.
package blackjackControls;
public class GameConsole {
Player dealer; //both of these objects I am trying to bring over into the blackjackGUI package
Deck playingDeck;
public void gamePlay(){
[code].....
The dealer and playingDeck objects are giving me an error of unresolved. the way it is written I also get a static error on line 37. I know that I have not yet written in the actionEvent statement in the button constructor.
View Replies
View Related
Oct 19, 2014
What I want to do is this, this is my first class:
public class Footballer {
int goals;
String surname= "";
String team="";
private static int counter=0;
private int dres;
}
(this is just the header of the class... And this is my second class, which contains an ArrayList of the first class:
public class FootballTeam{
String teamname="";
String league="";
ArrayList<Footballer> f;
}
And this is my third class which contains an ArrayList of the second class:
public class FootballLeague{
String leaguename="";
ArrayList<FootballTeam> ft;
}
What I want to do is, know how many of footballers are there in the league? Meaning how many of "f"s are in the "ft"... I remember from C++ it was easy, you just did it something like this: ft.f[i]; (where i is a position), then you'd go through each of them, if you wanted to do something with them, or just ask for it's length, if you needed to know how much footballers are there.
I'm trying this method to get the size of the array in the 2nd class, from the 3rd class (containing an ArrayList of classes of 2nd class, but no luck:
int counter=0;
for(int i=0;i<this.ft.size();i++) {
counter+=this.ft[i].f.size();
}
I'm getting this: Array required, but ArrayList<FootballTeam> found ---
View Replies
View Related
Feb 18, 2015
I've created a method to calculate the ratio of one vowel to another, but I was hoping to get some feedback on another way I could approach the problem. The first bit of code is to find the vowels and assign them to an array ( for me, it seemed the easier thing to do in order to easily access the data). In the other bit of code, I have a method with two arguments (the vowels) to calculate the ratio.
public void findVowels(StringBuilder message, String delimiter) {
subString = message.toString().toLowerCase().split(delimiter);
vowelCounter = new int[5][subString.length];
// Remove all whitespace
for (int index = 0; index < subString.length; index++) {
subString[index] = subString[index].replaceAll("s", "");
[code]....
View Replies
View Related
May 14, 2014
I do not think this is possible, but I'd like to confirm. If I have an HTML page that has an embedded Java applet, and that applet in turn renders an HTML document (within the applet window), is the HTML *within* the applet part of / accessible through the DOM for the parent page?
View Replies
View Related
Sep 19, 2014
Given the class MyExample below:
public class MyExample extends GCompound {
//instance variables
public GRect R1 = new GRect(0, 0, 20, 20);
public GRect R2 = new GRect(0, 0, 5, 5); //R2 is in front of R1, but its coordinates are all "inside" of R1's coordinates
//constructor
public MyExample() {
add(R1);
add(R2);
}
}
1) Suppose I'm in a GraphicsProgram and declare:
MyExample myex = new MyExample();
Suppose I have coordinates (x1, y1), and want to find out whether this is the myex object defined in the previous line. I would use:
obj = getElementAt(x, y);
if (obj == myex) (...and so on)
Now suppose I want to test whether the object is the GRect object R1 within myex. Why doesn't the following work?
if(obj ==myex.R1) (...and so on);
Here is the full code that shows my question; it outputs "myex", none of the other outputs come out...
public void run() {
GObject obj1, obj2;
MyExample myex = new MyExample();
add(myex);
obj1 = getElementAt(1, 1);
obj2 = getElementAt(19, 19);
if (obj1 == myex) System.out.println("myex");
if(obj1 == myex.R1) System.out.println("R1");
if(obj1 == myex.R2) System.out.println("R2");
if(obj2 == myex.R1) System.out.println("R11");
if(obj2 == myex.R2) System.out.println("R22");
}
View Replies
View Related
Nov 27, 2014
I'm a total newbie to Java, and until now all I've done was draw some shapes and flags. I'm struggling to understand the code I've been given. I need to access values stored in an ArrayList within another class. Here are the two classes Seat and Mandate:
package wtf2;
import java.util.*;
public class Seat {
public int index;
public String place;
public int electorate;
[Code] ....
The main class contains code that feeds data from 2 text files into Seat and Mandate. From there I managed to access the date in Seat (at the end):
package wtf2;
import java.io.*;
import java.util.*;
public class CW2 {
public static void main(String[] args)throws Exception {
[Code] ....
Now,instead of getting just the mp for Edinburgh South I need to get the vote values, compare them to each other, take the second biggest and display the associate party value. How to access data from that Array to get started at least.
View Replies
View Related
Apr 1, 2014
I have an admin class that needs to access a method of another class and I'm unsure how to do it.
One of the methods in the admin class (DancerAdmin) accesses a .txt file with information in and each line is to be extracted and is to be created as an object of the Dancer class. The information in each line is to then be used to set the variables in the Dancer class.
To set the values the Dancer class has setter methods which I need to access each time a new object is created while cycling through the .txt file. I'm struggling to access these methods from the DancerAdmin class when I run the relevant method.
The snippet of code I have from the method in DancerAdmin is
while (bufferedScanner.hasNextLine()) {
currentLine = bufferedScanner.nextLine();
lineScanner = new Scanner(currentLine);
lineScanner.useDelimiter(",");
dancer.add(new Dancer());
Dancer.setName(lineScanner.next()); mh_sh_highlight_all('java');
I get an error saying non static method setName cannot be referenced from a static content?
View Replies
View Related
Dec 18, 2014
I currently have some code using a JFrame. I am trying to access the items in a JList to save them in a TXT file. For this, I am using a "for" loop. The problem is, is that when I try to access the list items, I can't access them. The way I am trying to access the items is by using:
Java Code: listRight.getModel().getSize(); mh_sh_highlight_all('java');
BUT, I can't seem to get this to work. I tried to place this for loop everywhere and I can't access it. I tried accessing it under "public class Window", "private JFrame frmPcPartBuilder", "public static void main(String[] args)", "public void Initialize()" and I can't seem to access the JList. I basically have a save button that saves the list to a text file and the code I am trying to write is called by this button.
Java Code: package com.cooksys.assessment;
import java.awt.EventQueue;
import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JButton;
[code]....
View Replies
View Related
Aug 18, 2014
I have a HashMap returned from the server. There are two conditions
1. HashMap returned with only one set of key value pair or
2. HashMap with multiple set of data key value pairs.
Now in UI I have to display either text box or drop down box depending upon the size of map for that I am using length method
Java Code:
<c:choose>
<c:when test="${fn:length(myDto.mayMapInDto) eq 1}">
display text box
</c:when>
<c:otherwise>
display drop box
</c:otherwise>
</c:choose> mh_sh_highlight_all('java');
I can display drop box by looping but not sure how I can get only one element for text box. Tricky is I can't use key value to access since UI don't know what key will be returned.
View Replies
View Related
Mar 23, 2014
I start my thread, it's for a real basic game I'm learning. Everything was working fine, until I got to recognizing keys. It runs, and I can close using the mouse on the close command, but the keys aren't being generated from the keyboard. I copied it to a working sample, and here are the two files.
package testkeys;
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
import javax.swing.JFrame;
[Code] ....
The idea was to set the return value to true if any key is pressed, thus quitting, for this short sample program. Problem, it never recognizes any keys pressed on the keyboard. New to java and threading.
View Replies
View Related
Apr 2, 2014
I'm trying to access the toolkit for an assignment I'm writing and I keep getting the same compiler message. What am I doing wrong?
import java.text.DecimalFormat;
import java.io.*;
import java.util.Scanner;
public class Robert_Gardner_6_07
{
public static void main(String[] args) throws IOException
[code]....
View Replies
View Related
Oct 19, 2014
What I want to do is this, this is my first class:
Java Code:
public class Footballer {
int goals;
String surname= "";
String team="";
private static int counter=0;
private int dres;
} mh_sh_highlight_all('java');
(this is just the header of the class, just how it looks)...
And this is my second class, which contains an ArrayList of the first class:
Java Code:
public class FootballTeam{
String teamname="";
String league="";
ArrayList<Footballer> f;
} mh_sh_highlight_all('java');
And this is my third class which contains an ArrayList of the second clas:
Java Code: public class FootballLeague{
String leaguename="";
ArrayList<FootballTeam> ft;
} mh_sh_highlight_all('java');
What I want to do is, know how many of footballers are there in the league? Meaning how many of "f"s are in the "ft"... I remember from C++ it was easy, you just did it something like this: ft.f[i]; (where i is a position), then you'd go through each of them, if you wanted to do something with them, or just ask for it's length, if you needed to know how much footballers are there.
View Replies
View Related
Apr 15, 2013
I am trying to create a method in BlueJ which needs the values from a Map to be copied into a List so I can use the List methods min() and max(). Here is the method I have created so far:
public String findNamesInPageRange()
{
int minOfRange = Integer.parseInt(OUDialog.request("Input number for start of range"));
int maxOfRange = Integer.parseInt(OUDialog.request("Input number for end of range"));
String foundIt = null;
for(String eachKey : bookIndex.keySet()) {
List<Integer> pageList = new ArrayList<>(); //Cannot access values from a map using this List
if((minOfRange >= Collections.min(pageList)) && (maxOfRange <= Collections.max(pageList))) {
foundIt = eachKey;
}
}
return foundIt;
}
As can be seen there is a comment showing where my problem lies.
The Map is coded as Map<String, Set<Integer>> bookIndex = new TreeMap<>();
Ive tried using bookIndex.values() as the argument of the List but I get an incompatible type error
So, how can this problem I am having be resolved?
View Replies
View Related